1

I am creating a mini blog application and i would like my users after updating their status on my site, it should update their twitter and facebook status as well. What gem can i use for this situation and how can i go about it using ruby on rails 3.1. Note: All users have their account and should be able to update their status directly. Thank you

Community
  • 1
  • 1
Uchenna
  • 4,059
  • 6
  • 40
  • 73

1 Answers1

1

Here's a Ruby wrapper for the Twitter API: http://twitter.rubyforge.org/

As the link says, install it with

gem install twitter

You'll need to register a twitter app here: http://dev.twitter.com/apps, use this to authenticate like so:

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

then use the following line to update a user's status:

Twitter.update("I'm tweeting with @gem!")
Alex L
  • 8,748
  • 5
  • 49
  • 75
  • 1
    (Sorry about commenting to extend my answer - I'm only allowed to post two URLs) For Facebook, there is a previous question here that may help: http://stackoverflow.com/questions/5206253/ruby-on-rails-integration-with-facebook Also here: http://stackoverflow.com/questions/3742770/rails-3-facebook-plugin-gem – Alex L Jan 06 '12 at 05:38
  • nice and looks simple, but this would happen for different users and would it know the exert user to post on the user's page – Uchenna Jan 06 '12 at 05:42
  • You'd either need to store a database of user's twitter login info, or get them to put it in each time. Perhaps a javascript solution? https://dev.twitter.com/docs/tweet-button ? – Alex L Jan 06 '12 at 10:41