Updated to new twitter lib.

This commit is contained in:
Martin Edenhofer 2013-11-19 10:17:32 +01:00
parent b9dc843101
commit 5bc1fc9080
2 changed files with 6 additions and 4 deletions

View file

@ -21,7 +21,10 @@ class Channel::Twitter2
if channel[:options][:search] if channel[:options][:search]
channel[:options][:search].each { |search| channel[:options][:search].each { |search|
puts " - searching for #{search[:item]}" puts " - searching for #{search[:item]}"
tweets = @client.search( search[:item] ) tweets = []
client.search( search[:item], :count => 50, :result_type => "recent" ).collect do |tweet|
tweets.push tweet
end
@article_type = 'twitter status' @article_type = 'twitter status'
fetch_loop(tweets, channel, search[:group]) fetch_loop(tweets, channel, search[:group])
} }
@ -30,7 +33,7 @@ class Channel::Twitter2
# mentions # mentions
if channel[:options][:mentions] if channel[:options][:mentions]
puts " - searching for mentions" puts " - searching for mentions"
tweets = @client.mentions tweets = @client.mentions_timeline
@article_type = 'twitter status' @article_type = 'twitter status'
fetch_loop(tweets, channel, channel[:options][:mentions][:group]) fetch_loop(tweets, channel, channel[:options][:mentions][:group])
end end

View file

@ -91,8 +91,7 @@ class TwitterTest < ActiveSupport::TestCase
config.access_token = user2_token config.access_token = user2_token
config.access_token_secret = user2_token_secret config.access_token_secret = user2_token_secret
end end
tweets = client.search( hash ) client.search(hash, :count => 50, :result_type => "recent").collect do |tweet|
tweets.results.map do |tweet|
assert_equal( tweet.id, article.message_id ) assert_equal( tweet.id, article.message_id )
end end