templates/project/jobs/twitter.rb in dashing-1.3.1 vs templates/project/jobs/twitter.rb in dashing-1.3.2
- old
+ new
@@ -1,24 +1,24 @@
require 'twitter'
#### Get your twitter keys & secrets:
#### https://dev.twitter.com/docs/auth/tokens-devtwittercom
-Twitter.configure do |config|
+twitter = Twitter::REST::Client.new do |config|
config.consumer_key = 'YOUR_CONSUMER_KEY'
config.consumer_secret = 'YOUR_CONSUMER_SECRET'
config.oauth_token = 'YOUR_OAUTH_TOKEN'
config.oauth_token_secret = 'YOUR_OAUTH_SECRET'
end
search_term = URI::encode('#todayilearned')
SCHEDULER.every '10m', :first_in => 0 do |job|
begin
- tweets = Twitter.search("#{search_term}").results
+ tweets = twitter.search("#{search_term}")
if tweets
- tweets.map! do |tweet|
+ tweets = tweets.map do |tweet|
{ name: tweet.user.name, body: tweet.text, avatar: tweet.user.profile_image_url_https }
end
send_event('twitter_mentions', comments: tweets)
end
rescue Twitter::Error
\ No newline at end of file