Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

upgrade the twitter gem so that it is threadsafe, and fix init issues #168

Merged
merged 1 commit into from

1 participant

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
View
4 Gemfile
@@ -33,8 +33,8 @@ gem 'nokogiri'
gem 'wunderground'
gem 'rturk'
-gem "twitter"
-gem 'twitter-stream', '>=0.1.16'
+gem "twitter", '~> 5.7.1'
+gem 'twitter-stream', :git => 'https://github.com/cantino/twitter-stream', :branch => 'master'
gem 'em-http-request'
gem 'weibo_2'
View
67 Gemfile.lock
@@ -1,3 +1,13 @@
+GIT
+ remote: https://github.com/cantino/twitter-stream
+ revision: fde6bed2b62ca487d49e4a57381bbfca6e33361b
+ branch: master
+ specs:
+ twitter-stream (0.1.15)
+ eventmachine (>= 0.12.8)
+ http_parser.rb (~> 0.6.0)
+ simple_oauth (~> 0.2.0)
+
GEM
remote: https://rubygems.org/
specs:
@@ -31,6 +41,7 @@ GEM
multi_json (~> 1.0)
addressable (2.3.5)
arel (3.0.3)
+ atomic (1.1.14)
bcrypt-ruby (3.1.1)
better_errors (1.1.0)
coderay (>= 1.0.0)
@@ -40,6 +51,7 @@ GEM
bootstrap-kaminari-views (0.0.2)
kaminari (>= 0.13)
rails (>= 3.1)
+ buftok (0.2.0)
builder (3.0.4)
coderay (1.0.9)
coffee-rails (3.2.2)
@@ -49,7 +61,7 @@ GEM
coffee-script-source
execjs
coffee-script-source (1.6.3)
- cookiejar (0.3.0)
+ cookiejar (0.3.1)
coveralls (0.7.0)
multi_json (~> 1.3)
rest-client
@@ -75,14 +87,15 @@ GEM
dotenv (0.9.0)
dotenv-rails (0.9.0)
dotenv (= 0.9.0)
- em-http-request (1.0.3)
- addressable (>= 2.2.3)
+ em-http-request (1.1.2)
+ addressable (>= 2.3.4)
cookiejar
- em-socksify
- eventmachine (>= 1.0.0.beta.4)
- http_parser.rb (>= 0.5.3)
+ em-socksify (>= 0.3)
+ eventmachine (>= 1.0.3)
+ http_parser.rb (>= 0.6.0)
em-socksify (0.3.0)
eventmachine (>= 1.0.0.beta.4)
+ equalizer (0.0.9)
erector (0.9.0)
treetop (>= 1.2.3)
erubis (2.7.0)
@@ -92,8 +105,8 @@ GEM
eventmachine (1.0.3)
execjs (1.4.0)
multi_json (~> 1.0)
- faraday (0.8.7)
- multipart-post (~> 1.1)
+ faraday (0.9.0)
+ multipart-post (>= 1.2, < 3)
fastercsv (1.5.5)
ffi (1.9.0)
foreman (0.63.0)
@@ -106,7 +119,9 @@ GEM
rails (~> 3.0)
hashie (2.0.5)
hike (1.2.3)
- http_parser.rb (0.5.3)
+ http (0.5.0)
+ http_parser.rb
+ http_parser.rb (0.6.0)
httparty (0.11.0)
multi_json (~> 1.0)
multi_xml (>= 0.5.2)
@@ -116,7 +131,7 @@ GEM
jquery-rails (3.0.4)
railties (>= 3.0, < 5.0)
thor (>= 0.14, < 2.0)
- json (1.8.0)
+ json (1.8.1)
jsonpath (0.5.3)
multi_json
jwt (0.1.8)
@@ -129,13 +144,16 @@ GEM
mail (2.5.4)
mime-types (~> 1.16)
treetop (~> 1.4.8)
+ memoizable (0.4.0)
+ thread_safe (~> 0.1.3)
method_source (0.8.1)
mime-types (1.24)
mini_portile (0.5.1)
multi_json (1.7.9)
multi_xml (0.5.5)
- multipart-post (1.2.0)
+ multipart-post (2.0.0)
mysql2 (0.3.13)
+ naught (1.0.0)
nokogiri (1.6.0)
mini_portile (~> 0.5.0)
oauth2 (0.9.2)
@@ -212,7 +230,7 @@ GEM
thor (~> 0.14)
shoulda-matchers (2.2.0)
activesupport (>= 3.0.0)
- simple_oauth (0.1.9)
+ simple_oauth (0.2.0)
simplecov (0.8.2)
docile (~> 1.1.0)
multi_json
@@ -231,6 +249,8 @@ GEM
libv8 (~> 3.16.14.0)
ref
thor (0.18.1)
+ thread_safe (0.1.3)
+ atomic
tilt (1.4.1)
tins (0.13.1)
treetop (1.4.15)
@@ -240,14 +260,17 @@ GEM
builder (>= 2.1.2)
jwt (>= 0.1.2)
multi_json (>= 1.3.0)
- twitter (4.4.0)
- faraday (~> 0.8)
- multi_json (~> 1.3)
- simple_oauth (~> 0.1.6)
- twitter-stream (0.1.16)
- eventmachine (>= 0.12.8)
- http_parser.rb (~> 0.5.1)
- simple_oauth (~> 0.1.4)
+ twitter (5.7.1)
+ addressable (~> 2.3)
+ buftok (~> 0.2.0)
+ equalizer (~> 0.0.9)
+ faraday (~> 0.9.0)
+ http (~> 0.5.0)
+ http_parser.rb (~> 0.6.0)
+ json (~> 1.8)
+ memoizable (~> 0.4.0)
+ naught (~> 1.0)
+ simple_oauth (~> 0.2.0)
typhoeus (0.6.3)
ethon (~> 0.5.11)
tzinfo (0.3.38)
@@ -309,8 +332,8 @@ DEPENDENCIES
system_timer
therubyracer
twilio-ruby
- twitter
- twitter-stream (>= 0.1.16)
+ twitter (~> 5.7.1)
+ twitter-stream!
typhoeus
uglifier (>= 1.0.3)
webmock
View
9 app/concerns/twitter_concern.rb
@@ -3,7 +3,6 @@ module TwitterConcern
included do
validate :validate_twitter_options
- after_initialize :configure_twitter
end
def validate_twitter_options
@@ -31,12 +30,12 @@ def twitter_oauth_token_secret
options['oauth_token_secret'].presence || options['access_secret'].presence || credential('twitter_oauth_token_secret')
end
- def configure_twitter
- Twitter.configure do |config|
+ def twitter
+ Twitter::REST::Client.new do |config|
config.consumer_key = twitter_consumer_key
config.consumer_secret = twitter_consumer_secret
- config.oauth_token = twitter_oauth_token
- config.oauth_token_secret = twitter_oauth_token_secret
+ config.access_token = twitter_oauth_token
+ config.access_token_secret = twitter_oauth_token_secret
end
end
end
View
3  app/models/agents/twitter_publish_agent.rb
@@ -3,6 +3,7 @@
module Agents
class TwitterPublishAgent < Agent
include TwitterConcern
+
cannot_be_scheduled!
description <<-MD
@@ -62,7 +63,7 @@ def receive(incoming_events)
end
def publish_tweet(text)
- Twitter.update(text)
+ twitter.update(text)
end
end
end
View
1  app/models/agents/twitter_stream_agent.rb
@@ -1,6 +1,7 @@
module Agents
class TwitterStreamAgent < Agent
include TwitterConcern
+
cannot_receive_events!
description <<-MD
View
2  app/models/agents/twitter_user_agent.rb
@@ -69,7 +69,7 @@ def check
opts = {:count => 200, :include_rts => true, :exclude_replies => false, :include_entities => true, :contributor_details => true}
opts.merge! :since_id => since_id unless since_id.nil?
- tweets = Twitter.user_timeline(options['username'], opts)
+ tweets = twitter.user_timeline(options['username'], opts)
tweets.each do |tweet|
memory['since_id'] = tweet.id if !memory['since_id'] || (tweet.id > memory['since_id'])
Something went wrong with that request. Please try again.