Skip to content

Commit

Permalink
Merge pull request huginn#208 from knu/tweet_id
Browse files Browse the repository at this point in the history
Include tweet_id in payload for each successful tweet.
  • Loading branch information
cantino committed Apr 13, 2014
2 parents 0e7c5c5 + ef81624 commit e732234
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion app/models/agents/twitter_publish_agent.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,11 @@ def receive(incoming_events)
incoming_events.each do |event|
tweet_text = Utils.value_at(event.payload, options['message_path'])
begin
publish_tweet tweet_text
tweet = publish_tweet tweet_text
create_event :payload => {
'success' => true,
'published_tweet' => tweet_text,
'tweet_id' => tweet.id,
'agent_id' => event.agent_id,
'event_id' => event.id
}
Expand Down
7 changes: 5 additions & 2 deletions spec/models/agents/twitter_publish_agent_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@
@event.save!

@sent_messages = []
stub.any_instance_of(Agents::TwitterPublishAgent).publish_tweet { |message| @sent_messages << message}
stub.any_instance_of(Agents::TwitterPublishAgent).publish_tweet { |message|
@sent_messages << message
OpenStruct.new(:id => 454209588376502272)
}
end

describe '#receive' do
Expand Down Expand Up @@ -53,4 +56,4 @@
@checker.reload.should_not be_working # More time has passed than the expected receive period without any new events
end
end
end
end

0 comments on commit e732234

Please sign in to comment.