Post to Twitter using the Twitter gem

# installation: gem install twitter

require 'twitter'

ctoken = '28najKwhmfBRJruB94kRSd'
csecret = 'HydRCM47rSXJEaHnI3aVavwavWtFNwT7BWEJJWTaDwM'
atoken = '263224-4iLZYjX35tUm2qeMbNXwlUgEMm9QnQSnKLwq8OyecE'
asecret = 'HfKxpkrlKgKFR40Uig7aFOPYALQRdZPMChPbBOgU4I7'

Twitter.configure do |config|
  config.consumer_key       = ctoken
  config.consumer_secret    = csecret
  config.oauth_token        = atoken
  config.oauth_token_secret = asecret
end

client = Twitter::Client.new
client.update('Test post from the console')

Note: For security reasons I have purposely invalidated the tokens and secrets in this example.

Tags:
Source:
1211hrs.txt
Published:
23-10-2011 12:11