我被green_shoes
迷住了,我想用它创建twitter客户端。
我实现了登录Twitter并获得home_timeline。
我尝试实现流功能,如下所示。
require 'green_shoes'
require 'twitter'
CONSUMER_KEY = 'hoge'
CONSUMER_SECRET = 'hoge'
ACCESS_TOKEN = 'hoge'
ACCESS_TOKEN_SECRET = 'hoge'
client = Twitter::REST::Client.new do |c|
c.consumer_key = CONSUMER_KEY
c.consumer_secret = CONSUMER_SECRET
c.access_token = ACCESS_TOKEN
c.access_token_secret = ACCESS_TOKEN_SECRET
end
stream = Twitter::Streaming::Client.new do |c|
c.consumer_key = CONSUMER_KEY
c.consumer_secret = CONSUMER_SECRET
c.access_token = ACCESS_TOKEN
c.access_token_secret = ACCESS_TOKEN_SECRET
end
Shoes.app do
tweets = client.home_timeline
stack do
tweets.each do |t|
para "#{t.user.name}: #{t.text}"
end
end
stream.user do |obj|
case obj
when Twitter::Tweet
stack do
para "#{obj.user.name}: #{obj.text}"
end
end
end
end
我该怎么办?