Skip to content
This repository has been archived by the owner on Apr 23, 2021. It is now read-only.

Commit

Permalink
specify an oauth callback for newer version of the oauth gem
Browse files Browse the repository at this point in the history
  • Loading branch information
atmos committed Aug 5, 2009
1 parent 71c61e7 commit 9968b0a
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lib/twitrsvp/app.rb
Expand Up @@ -23,6 +23,16 @@ def oauth_consumer
::TwitRSVP::OAuth.consumer
end

def absolute_url(suffix = nil)
port_part = case request.scheme
when "http"
request.port == 80 ? "" : ":#{request.port}"
when "https"
request.port == 443 ? "" : ":#{request.port}"
end
"#{request.scheme}://#{request.host}#{port_part}#{suffix}"
end

def localtime(start_date, start_time)
time_of_day = Time.parse(start_time)
year, month, day = start_date.split('/')
Expand Down Expand Up @@ -161,7 +171,7 @@ def h(text)

get '/signup' do
TwitRSVP.retryable(:times => 2) do
request_token = oauth_consumer.get_request_token
request_token = oauth_consumer.get_request_token(:oauth_callback => absolute_url('/callback'))
session[:request_token] = request_token.token
session[:request_token_secret] = request_token.secret
redirect request_token.authorize_url
Expand Down

0 comments on commit 9968b0a

Please sign in to comment.