diff options
| author | mo khan <mo@mokhan.ca> | 2014-05-30 20:40:42 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2014-05-30 20:40:42 -0600 |
| commit | 76f16dd640694bc7b9ea4cc83a8f7e3f2ef98685 (patch) | |
| tree | be9ded245f90e52648670ee47e345973c5bf7289 /app/services/application | |
| parent | f124024d72a916e1615e084893d98b1fcf337b89 (diff) | |
change name of message.
Diffstat (limited to 'app/services/application')
| -rw-r--r-- | app/services/application/create_cake_command.rb | 2 | ||||
| -rw-r--r-- | app/services/application/handlers/publish_cake_to_twitter.rb | 7 |
2 files changed, 5 insertions, 4 deletions
diff --git a/app/services/application/create_cake_command.rb b/app/services/application/create_cake_command.rb index d4a5396d..f74fc0ab 100644 --- a/app/services/application/create_cake_command.rb +++ b/app/services/application/create_cake_command.rb @@ -10,7 +10,7 @@ class CreateCakeCommand @current_user.tag(cake, with: tags, on: :tags) if cake.save - @message_bus.publish(:new_creation_added, creation_id: cake.id) + @message_bus.publish(:cake_published, cake_id: cake.id) @context.create_cake_succeeded(cake) else @context.create_cake_failed(cake) diff --git a/app/services/application/handlers/publish_cake_to_twitter.rb b/app/services/application/handlers/publish_cake_to_twitter.rb index 12063540..00ecb551 100644 --- a/app/services/application/handlers/publish_cake_to_twitter.rb +++ b/app/services/application/handlers/publish_cake_to_twitter.rb @@ -1,14 +1,15 @@ class PublishCakeToTwitter - def initialize(twitter_publisher) + def initialize(twitter_publisher, cakes = Creation) @twitter = twitter_publisher + @cakes = cakes end def handles?(event) - :new_creation_added == event + :cake_published == event end def handle(message) - tweet_about(Creation.find(message[:creation_id])) + tweet_about(cakes.find(message[:cake_id])) end private |
