Skip to content

Instantly share code, notes, and snippets.

@arfon
Created January 21, 2012 03:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arfon/1651142 to your computer and use it in GitHub Desktop.
Save arfon/1651142 to your computer and use it in GitHub Desktop.
Simple Twitterstream example
require 'tweetstream'
TweetStream.configure do |config|
config.consumer_key = 'consumer_key'
config.consumer_secret = 'consumer_secret'
config.oauth_token = 'oauth_token'
config.oauth_token_secret = 'oauth_token_secret'
config.auth_method = :oauth
config.parser = :json_pure
end
client = TweetStream::Client.new
client.track("Romney", "Gingrich") do |status|
tweet_hash = {:user_id => status.user.id,
:created_at => status.created_at,
:id => status.id,
:screen_name => status.user.screen_name,
:location => status.user.location}
puts tweet_hash
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment