secret
Created

  • Download Gist
example2.rb
Ruby
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
# Applications that make requests on behalf of a single Twitter user can pass global configuration options as a block to the Twitter.configure method.
Twitter.configure do |config|
config.consumer_key = YOUR_CONSUMER_KEY
config.consumer_secret = YOUR_CONSUMER_SECRET
config.oauth_token = YOUR_OAUTH_TOKEN
config.oauth_token_secret = YOUR_OAUTH_TOKEN_SECRET
end
# After configuration, requests can be made like so:
Twitter.update("I'm tweeting with @gem!")
# Follow a user
Twitter.follow("ahmdrefat")
# Fetch a user
Twitter.user("ahmdrefat")
# User timeline
Twitter.user_timeline("ahmdrefat")
# Search
Twitter.search("to:ahmdrefat ruby on rails", :count => 5, :result_type => "recent").results.map do |status|
"#{status.from_user}: #{status.text}"
end

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.