Skip to content

Instantly share code, notes, and snippets.

@krames
Created September 6, 2013 13:00
Show Gist options
  • Select an option

  • Save krames/6463462 to your computer and use it in GitHub Desktop.

Select an option

Save krames/6463462 to your computer and use it in GitHub Desktop.
require 'tweetstream'
require 'awesome_print'
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
end
puts "Starting..."
# This will pull a sample of all tweets based on
# your Twitter account's Streaming API role.
client = TweetStream::Client.new
client.on_delete do |status_id, user_id|
puts "something about delete status id>> #{status_id} user_id>> #{user_id}"
Tweet.delete(status_id)
end
client.on_limit do |skip_count|
puts "We are being limited #{skip_count}"
end
client.on_enhance_your_calm do
puts "We need ot enhance our calm"
end
client.on_error do |message|
puts "ERROR>> #{message.inspect}"
end
client.track('easter', '@rackspace fog', '@rubygems rackspace', '@rackspace ruby', 'ruby fog') do |status|
# The status object is a special Hash with
# method access to its keys.
ap status.attrs
puts "@#{status.user.screen_name}>> #{status.text}"
# puts "TWEET>> #{status.text}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment