RKh
RKh

Reputation: 14159

Twitter/Facebook API for Ruby

I want to write a Ruby application through which:

  1. I can submit tweets to twitter.
  2. I can submit a post to facebook.
  3. I can manage real-time stats of tweets

Is there any twitter/facebook api for Ruby?

Upvotes: 4

Views: 5851

Answers (7)

Tute
Tute

Reputation: 229

MiniFB https://github.com/appoxy/mini_fb is excellent for Facebook API. But in both APIs you can do everything through HTTPParty and OAuth.

Upvotes: 1

toy
toy

Reputation: 12161

I would use this gem, it's really helpful https://github.com/moomerman/twitter_oauth

or just gem install twitter_oauth

Upvotes: 1

Kai Wren
Kai Wren

Reputation: 442

If you're inclined to retain more control over how you use the Twitter and Facebook APIs you can use the Wrest gem.

Take a look at the facebook (http://is.gd/bJspX) and twitter (http://is.gd/bJsqV) examples.

Also, while both the Twitter and Facebook APIs are HTTP APIs, they are not RESTful despite their claims to the contrary.

Upvotes: 1

Michael Kohl
Michael Kohl

Reputation: 66867

Two more libraries that didn't get mentioned yet:

Upvotes: 1

Dafydd Rees
Dafydd Rees

Reputation: 6983

Streams of tweets:

Tweetmon is a great gem for keeping real-time track of tweets. Here's an example of using it to get a stream of tweets on a specific keyword

 #!/usr/local/bin/ruby 

 if ARGV.size==1
   keyword = ARGV.shift
 else
   puts 'tweetmon usage: tweetmon <keyword>'
   exit 1
 end

 require 'yaml'
 require 'rubygems'
 require 'tweetstream'

 config = YAML::load(File.open(File.expand_path('~/.twitter')))
 user =config['username']
 password =config['password']

 TweetStream::Client.new(user,password).track(keyword) do |status|  
   puts "[#{status.created_at}-#{status.user.screen_name}] #{status.text}"
 end  

To use this gem you need: gem sources -a http://gems.github.com gem install intridea-tweetstream

To submit a tweet is just a HTTP POST - doesn't need any extra libraries to do this.

Upvotes: 4

Trevor
Trevor

Reputation: 6689

I use the Twitter gem and am quite happy with it.

For Facebook, there is the Facebooker gem.

Upvotes: 6

Marc W
Marc W

Reputation: 19251

The Twitter API is a RESTful web service. It's completely language agnostic. Use whatever language you want.

Not sure about Facebook.

Upvotes: 2

Related Questions