require "rubygems" require "twitter" require "oauth" #to find path of rubytwit idl_twit_path=ENV["IDLTWITPATH"] #consumer class consumer = OAuth::Consumer.new "JzXUP95EUS4YPkd02Bg", "TayJVoEAoXdxZtufVoft1YTORUPBlyBYOrygGAdyrGQ", { :site => '', :request_token_path => 'https://api.twitter.com/oauth/request_token', :access_token_path => 'https://api.twitter.com/oauth/access_token', :authorize_path => 'https://api.twitter.com/oauth/authorize'} request_token = consumer.get_request_token print "Place below URL in your browser.\n" print request_token.authorize_url+"\n" print "Write down the access pin numbers. : " pin=STDIN.readline.chomp access_token=request_token.get_access_token(:oauth_verifier => pin) f=File.open(idl_twit_path+"/oauth.inf", "w+") f.puts access_token.consumer.key f.puts access_token.consumer.secret f.puts access_token.params["oauth_token"] f.puts access_token.params["oauth_token_secret"] f.close f=File.open(idl_twit_path+"/.userid", "w+") f.puts access_token.params["screen_name"] f.close