Skip to content

Commit

Permalink
Updated examples and moved into README
Browse files Browse the repository at this point in the history
  • Loading branch information
sferik committed Oct 27, 2010
1 parent c845b6e commit 96600cb
Show file tree
Hide file tree
Showing 13 changed files with 44 additions and 213 deletions.
52 changes: 44 additions & 8 deletions README.rdoc
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.
30 changes: 0 additions & 30 deletions examples/connect.rb

This file was deleted.

14 changes: 0 additions & 14 deletions examples/friends_followers_rank.rb

This file was deleted.

11 changes: 0 additions & 11 deletions examples/friendship_existence.rb

This file was deleted.

38 changes: 0 additions & 38 deletions examples/helpers/config_store.rb

This file was deleted.

11 changes: 0 additions & 11 deletions examples/ids.rb

This file was deleted.

11 changes: 0 additions & 11 deletions examples/lists.rb

This file was deleted.

27 changes: 0 additions & 27 deletions examples/oauth.rb

This file was deleted.

15 changes: 0 additions & 15 deletions examples/search.rb

This file was deleted.

17 changes: 0 additions & 17 deletions examples/timeline.rb

This file was deleted.

16 changes: 0 additions & 16 deletions examples/unauthorized.rb

This file was deleted.

10 changes: 0 additions & 10 deletions examples/update.rb

This file was deleted.

5 changes: 0 additions & 5 deletions examples/user.rb

This file was deleted.

0 comments on commit 96600cb

Please sign in to comment.