-
-
Save ahmdrefat/4903e5d7780349be3811 to your computer and use it in GitHub Desktop.
This file contains 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
# 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment