-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated examples and moved into README
- Loading branch information
Showing
13 changed files
with
44 additions
and
213 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,58 @@ | ||
= The twitter Ruby gem | ||
==== A Ruby wrapper for the Twitter REST and Search APIs. | ||
== Examples | ||
See the examples directory. | ||
|
||
http://github.com/jnunemaker/twitter/tree/master/examples | ||
require 'rubygems' | ||
require 'twitter' | ||
|
||
# Register an app at http://dev.twitter.com/apps to get your Twitter OAuth credentials | ||
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 | ||
|
||
# Initialize a Twitter client | ||
client = Twitter::Client.new | ||
# Post a status update | ||
client.update("I just posted a status update via the Twitter Ruby Gem!") | ||
# Read the latest tweet in your home timeline | ||
puts client.home_timeline.first.text | ||
# Get a user's location | ||
puts client.user("sferik").location | ||
# Get a status update by id | ||
puts client.status(27558893223).text | ||
# Get your most popular friend | ||
puts client.friends.sort{|a, b| a.followers_count <=> b.followers_count}.reverse.first.name | ||
# Get your most popular follower | ||
puts client.followers.sort{|a, b| a.followers_count <=> b.followers_count}.reverse.first.name | ||
# Get your rate limit status | ||
puts client.rate_limit_status.remaining_hits.to_s + " Twitter API request(s) remaining this hour" | ||
|
||
# Initialize a Twitter search client | ||
search = Twitter::Search.new(:endpoint => "http://search.twitter.com/") | ||
# Find the 3 most recent proposals to @justinbieber | ||
search.to('justinbieber').containing('marry me').result_type('recent').per_page(3).each{|s| puts "#{s.from_user}: #{s.text}"} | ||
# Reset the search client | ||
search.clear | ||
# Find a Japanese-language status update tagged #ruby | ||
puts search.hashtag('ruby').language('ja').no_retweets.per_page(1).fetch.results.first.text | ||
# Find another | ||
puts search.fetch_next_page.results.first.text | ||
|
||
== Docs | ||
http://rdoc.info/projects/jnunemaker/twitter | ||
http://rdoc.info/github/jnunemaker/twitter | ||
== Submitting Bugs/Features | ||
We use the GitHub issue tracker for bugs and feature requests. If you want to report a bug or missing feature, please make sure it hasn't already been reported, then create a new issue. When submitting a bug report, please include a Gist[http://gist.github.com/] of the stack trace and any details that may be necessary to reproduce the bug, including the version of the gem you're using, your Ruby version, and your operating system. Ideally, bug reports should be submitted with failing tests, but this is not necessary. | ||
We use the GitHub issue tracker for bugs and feature requests. If you want to report a bug or missing feature, please make sure it hasn't already been reported, then create a new issue. When submitting a bug report, please include a Gist[http://gist.github.com/] of the stack trace and any details that may be necessary to reproduce the bug, including the version of the gem you're using, your Ruby version, and your operating system. Ideally, bug reports should be submitted with failing/pending specs. | ||
|
||
http://github.com/jnunemaker/twitter/issues | ||
== Submitting Patches | ||
1. Fork the project. | ||
2. Create a topic branch. | ||
3. Commit your feature or bug fix. | ||
4. Add specs for feature or bug fix. This is important so it doesn't break in the future. | ||
5. Run `bundle exec rake spec:rcov`. If your changes are not covered, go back to 4. | ||
6. Please do not include changes to the gemspec, version, or history file. (If you want to create your own version, please do so in a separate commit.) | ||
7. Submit a pull request. | ||
4. Add specs for your feature or bug fix. This is important so it doesn't break in the future. | ||
5. Run `bundle exec rake spec:rcov`. If your changes are not 100% covered, go back to step 4. | ||
6. Submit a pull request. Please do not include changes to the gemspec, version, or history file. (If you want to create your own version for some reason, please do so in a separate commit.) | ||
== Copyright | ||
Copyright (c) 2010 John Nunemaker, Wynn Netherland, Erik Michaels-Ober, Steve Richert. See LICENSE for details. |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.