Skip to content

Instantly share code, notes, and snippets.

@stve
Created March 26, 2012 04:47
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stve/2203024 to your computer and use it in GitHub Desktop.
Save stve/2203024 to your computer and use it in GitHub Desktop.
TweetStream SiteStream example
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