Created
March 26, 2012 04:47
-
-
Save stve/2203024 to your computer and use it in GitHub Desktop.
TweetStream SiteStream example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'tweetstream' | |
require 'yajl' | |
TweetStream.configure do |config| | |
config.consumer_key = ENV['consumer_key'] | |
config.consumer_secret = ENV['consumer_secret'] | |
config.oauth_token = ENV['oauth_token'] | |
config.oauth_token_secret = ENV['oauth_token_secret'] | |
config.parser = :yajl | |
config.auth_method = :oauth | |
end | |
client = TweetStream::Client.new | |
client.on_error do |error| | |
puts error | |
client.stop | |
end | |
client.sitestream(['115192457'], :followings => true) do |status_for_user| | |
end | |
# to manage the SiteStream: | |
client.control.add_user('1234') do | |
# will call a block if given one | |
end | |
client.control.remove_user('5678') do | |
# will call a block if given one | |
end | |
client.control.info do |info| | |
# yields the parsed json from the response | |
end | |
client.control.friends_ids('1234') do |friends_ids| | |
# yields the parsed json from the response | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment