-
-
Save moomerman/281759 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/ruby require 'rubygems' | |
require 'twitter_oauth' | |
@@config = YAML.load_file("config.yml") rescue nil || {} | |
@client = TwitterOAuth::Client.new( | |
:consumer_key => 'vikU4jhQVoXoF6e8WCfw3g', | |
:consumer_secret => 'xen6qlmau7hkaPvppRMoK76f9E9oB1SVQaDmPcMuAc', | |
:token => @@config[:token], | |
:secret => @@config[:secret] | |
) | |
if @client.authorized? | |
puts "yay! we're authorized!" | |
else | |
request_token = @client.request_token( | |
:oauth_callback => nil | |
) | |
session[:request_token] = request_token.token | |
session[:request_token_secret] = request_token.secret | |
puts "Please go this URL and authorize this application." | |
puts request_token.authorize_url #.gsub('authorize', 'authenticate') | |
puts "Press [Enter] to continue..." | |
gets | |
access_token = @client.authorize( | |
request_token.token, | |
request_token.secret, | |
:oauth_verifier => params[:oauth_verifier] | |
) | |
@@config[:token] = access_token.token | |
@@config[:secret] = access_token.secret | |
File.open("config.yml") do |out| | |
YAML.dump(@@config, out) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment