Skip to content

Commit

Permalink
Add /tweet route
Browse files Browse the repository at this point in the history
  • Loading branch information
Cairo Noleto committed Aug 20, 2010
1 parent 7b12718 commit c64cbee
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions twifakes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,16 @@
end

get "/oauth" do
session[:oauth_verifier] = params[:oauth_verifier]
erb :show
end

get "/tweet" do
client = TwitterOAuth::Client.new(:consumer_key => config_file['consumer_key'], :consumer_secret => config_file['consumer_secret'])
access_token = client.authorize(session[:request_token], session[:request_token_secret], :oauth_verifier => params[:oauth_verifier])
session[:access_token] = client.authorize(session[:request_token], session[:request_token_secret], :oauth_verifier => session[:oauth_verifier])
@fakes = (client.info["followers_count"].to_i/12).to_i
client.update("I have #{(@fakes).to_i} fake followers, and you? http://twifakes.heroku.com/ #Twifakes") if client.authorized?
erb :show
redirect "/?s=ok"
end

private
Expand Down

0 comments on commit c64cbee

Please sign in to comment.