I advise you to use Twitter gem
Using the API you just have to do:
httpauth = Twitter::HTTPAuth.new('username', 'password')
client = Twitter::Base.new(httpauth)
client.update('Heeeeyyyyooo from the Twitter Gem')
And using OAuth (which I highly recommend):
oauth = Twitter::OAuth.new('consumer token', 'consumer secret')
oauth.authorize_from_access('access token', 'access secret')
client = Twitter::Base.new(oauth)
client.update('Heeeyyyyoooo from Twitter Gem!')
source
share