summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorpushmatrix <daniel.beauchamp@gmail.com>2013-11-21 17:50:11 +0100
committerpushmatrix <daniel.beauchamp@gmail.com>2013-11-21 17:50:11 +0100
commit5b045724acd44e691552c0fb8f86b61aa2e0cd06 (patch)
treefce5f5a911ab278b1801cb7b03e5089ba3b84f65 /templates
parent4177623a7a5e7967514a0d92095e0dcb32896026 (diff)
Update to use the new Twitter 5.0.0 gem.
Diffstat (limited to 'templates')
-rw-r--r--templates/project/Gemfile2
-rw-r--r--templates/project/jobs/twitter.rb6
2 files changed, 4 insertions, 4 deletions
diff --git a/templates/project/Gemfile b/templates/project/Gemfile
index e6ccd84..3c7e7a9 100644
--- a/templates/project/Gemfile
+++ b/templates/project/Gemfile
@@ -3,4 +3,4 @@ source 'https://rubygems.org'
gem 'dashing'
## Remove this if you don't need a twitter widget.
-gem 'twitter' \ No newline at end of file
+gem 'twitter', '>= 5.0.0' \ No newline at end of file
diff --git a/templates/project/jobs/twitter.rb b/templates/project/jobs/twitter.rb
index 5e70f30..26228bc 100644
--- a/templates/project/jobs/twitter.rb
+++ b/templates/project/jobs/twitter.rb
@@ -3,7 +3,7 @@ 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'
@@ -14,10 +14,10 @@ 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)