ruby - How to implement twitter streaming with green_shoes? -
i'm charmed green_shoes
, want create twitter client it. achieved log in twitter , home_timeline.
i try implement streaming funciton, following.
require 'green_shoes' require 'twitter' consumer_key = 'hoge' consumer_secret = 'hoge' access_token = 'hoge' access_token_secret = 'hoge' client = twitter::rest::client.new |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 |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 tweets = client.home_timeline stack tweets.each |t| para "#{t.user.name}: #{t.text}" end end stream.user |obj| case obj when twitter::tweet stack para "#{obj.user.name}: #{obj.text}" end end end end
what should do?
Comments
Post a Comment