
You've heard of Twitter, an online service that allows you and your friends to communicate up-to-the-second by sending short messages. Twitter has built-in features to deliver the updates to your instant messaging account (such as Google Talk) or to your cell phone. Yesterday we covered real-time Flash visualization of RailsConf twitters.
Want to incorporate Twitter functionality into your own projects? Enter the Twitter gem by John Nunemaker. Observe:
# to post an update to twitter $ twitter post "posting from the twitter gem" # to see you and your friends timeline $ twitter timeline
The command line interface is very simple, and configuring it is easy using a YAML file. Of course, it also sports a Ruby API:
twit.update('me got dizzy this time')
# Show your friends' status
twit.timeline(:friends).each do |s|
puts s.text, s.user.name
end
Use RubyGems as usual to install it:
gem install twitter --include-dependencies
Head on to Twitter gem site for more information.

Comments
John Nunemaker ·
Thanks for the link. One note, the gem uses hpricot to parse the xml and there is an annoying bug that reared it's head in the 0.5+ versions (it doesn't like xml elements named text). That said, be sure to sudo gem install hpricot --source http://code.whytheluckystiff.net -v 0.4.86 and uninstall any hpricot versions 0.5+.
Hendy Irawan ·
Thank you John for your tip! :-)
John Nunemaker ·
I just pushed a new version of the gem today which negates the previous comment. You can now just sudo gem install twitter -y. :)
Hendy Irawan ·
Super thanks John :)
Koen Van der Auwera ·
Shareomatic! uses the twitter gem for it's twittering and it's works just perfect!
Good work!
Hendy Irawan ·
Thank you Mr. Koen Van der Auwera for sharing your experience. Yep, I fully agree John Nunemaker's work is awesome! :)