Install
$ sudo gem install twitter -y
note: the twitter gem now works with hpricot 0.5+
Command Line
The command line gives you several options for user twitter. Simply type twitter to see the options.
# to post an update to twitter
$ twitter post "posting from the twitter gem"
# to see you and your friends timeline
$ twitter timeline
Important Friends
The 0.1.0 update to the gem allowed for putting an array of usernames in your .twitter file and filter your timeline to only those users.
-
Adjust your .twitter file like so
# .twitter # # Please fill in fields like this: # # email: bla@bla.com # password: secret # email: something@something.com password: supersecret important: - mattklawitter - oaknd1 - wharle - chasgrundy - jerry - From the command line do this:
$ twitter important
API Wrapping
I do my best to keep it easy to use. Below are some code samples showing a few of the methods.
twit = twit
twit.update('watching veronica mars')
puts "Public Timeline", "=" * 50
twit.timeline(:public).each do |s|
puts s.text, s.user.name
puts
end
puts '', "Friends Timeline", "=" * 50
twit.timeline(:friends).each do |s|
puts s.text, s.user.name
puts
end
puts '', "You and Your Friends Timeline", "=" * 50
twit.timeline(:user).each do |s|
puts s.text, s.user.name
puts
end
puts '', "Your Friends", "=" * 50
twit.friends.each do |u|
puts u.name, u.status.text
puts
end
puts '', "jnunemaker's Friends", "=" * 50
twit.friends_for('jnunemaker').each do |u|
puts u.name
puts
end
puts '', "Your Followers", "=" * 50
twit.followers.each do |u|
puts u.name
puts
end
Support
Please leave all support requests and suggestions at the google group.
Uses
- Snitch
- Growl + Twitter
- Twitter Woot Bot (more here)
- Tweet Quicksilver Action
- logging security events to twitter
- Shareomatic is using it for their twitter account
Using the twitter gem for something, let me know and I'll add you above.