update twitter gem to 5.0
This commit is contained in:
parent
0cb7abcb52
commit
9731575a3d
3 changed files with 4 additions and 8 deletions
|
@ -31,14 +31,12 @@ module Ebooks
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
Twitter.configure do |config|
|
Twitter::REST::Client.new do |config|
|
||||||
config.consumer_key = @config[:consumer_key]
|
config.consumer_key = @config[:consumer_key]
|
||||||
config.consumer_secret = @config[:consumer_secret]
|
config.consumer_secret = @config[:consumer_secret]
|
||||||
config.oauth_token = @config[:oauth_token]
|
config.oauth_token = @config[:oauth_token]
|
||||||
config.oauth_token_secret = @config[:oauth_token_secret]
|
config.oauth_token_secret = @config[:oauth_token_secret]
|
||||||
end
|
end
|
||||||
|
|
||||||
Twitter::Client.new
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def initialize(username, path, client=nil)
|
def initialize(username, path, client=nil)
|
||||||
|
|
|
@ -43,15 +43,13 @@ module Ebooks
|
||||||
config.oauth_token_secret = @oauth_token_secret
|
config.oauth_token_secret = @oauth_token_secret
|
||||||
end
|
end
|
||||||
|
|
||||||
Twitter.configure do |config|
|
@twitter = Twitter::REST::Client.new do |config|
|
||||||
config.consumer_key = @consumer_key
|
config.consumer_key = @consumer_key
|
||||||
config.consumer_secret = @consumer_secret
|
config.consumer_secret = @consumer_secret
|
||||||
config.oauth_token = @oauth_token
|
config.oauth_token = @oauth_token
|
||||||
config.oauth_token_secret = @oauth_token_secret
|
config.oauth_token_secret = @oauth_token_secret
|
||||||
end
|
end
|
||||||
|
|
||||||
@twitter = Twitter::Client.new
|
|
||||||
|
|
||||||
needs_stream = [@on_follow, @on_message, @on_mention, @on_timeline].any? {|e| !e.nil?}
|
needs_stream = [@on_follow, @on_message, @on_mention, @on_timeline].any? {|e| !e.nil?}
|
||||||
|
|
||||||
@stream = TweetStream::Client.new if needs_stream
|
@stream = TweetStream::Client.new if needs_stream
|
||||||
|
@ -119,7 +117,7 @@ module Ebooks
|
||||||
# - The tweet mentions list contains our username
|
# - The tweet mentions list contains our username
|
||||||
# - The tweet is not being retweeted by somebody else
|
# - The tweet is not being retweeted by somebody else
|
||||||
# - Or soft-retweeted by somebody else
|
# - Or soft-retweeted by somebody else
|
||||||
if mentions.map(&:downcase).include?(@username.downcase) && !ev[:retweeted_status] && !ev[:text].start_with?('RT ')
|
if mentions.map(&:downcase).include?(@username.downcase) && !ev.retweeted_status? && !ev[:text].start_with?('RT ')
|
||||||
log "Mention from @#{ev[:user][:screen_name]}: #{ev[:text]}"
|
log "Mention from @#{ev[:user][:screen_name]}: #{ev[:text]}"
|
||||||
@on_mention.call(ev, meta) if @on_mention
|
@on_mention.call(ev, meta) if @on_mention
|
||||||
else
|
else
|
||||||
|
|
|
@ -19,7 +19,7 @@ Gem::Specification.new do |gem|
|
||||||
gem.add_development_dependency 'memory_profiler'
|
gem.add_development_dependency 'memory_profiler'
|
||||||
gem.add_development_dependency 'pry-byebug'
|
gem.add_development_dependency 'pry-byebug'
|
||||||
|
|
||||||
gem.add_runtime_dependency 'twitter', '~> 4.0'
|
gem.add_runtime_dependency 'twitter', '~> 5.0'
|
||||||
gem.add_runtime_dependency 'simple_oauth', '~> 0.2.0'
|
gem.add_runtime_dependency 'simple_oauth', '~> 0.2.0'
|
||||||
gem.add_runtime_dependency 'tweetstream'
|
gem.add_runtime_dependency 'tweetstream'
|
||||||
gem.add_runtime_dependency 'rufus-scheduler'
|
gem.add_runtime_dependency 'rufus-scheduler'
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue