class Twimock::API::OAuth::Authorize
Constants
- METHOD
- PATH
Public Instance Methods
call(env)
click to toggle source
Calls superclass method
Twimock::API::OAuth#call
# File lib/twimock/api/oauth/authorize.rb, line 13 def call(env) return super unless called?(env) begin request = Rack::Request.new(env) @oauth_token = request.params["oauth_token"] @cancel = request.params["cancel"] if !validate_request_token(@oauth_token) raise Twimock::Errors::InvalidRequestToken.new elsif @cancel == "true" raise Twimock::Errors::OAuthCancelled.new end status = 200 body = "" header = { "Content-Length" => body.bytesize.to_s } [ status, header, [ body ] ] rescue Twimock::Errors::InvalidRequestToken => @error unauthorized rescue Twimock::Errors::OAuthCancelled => @error oauth_cancelled rescue => @error internal_server_error end end
Private Instance Methods
oauth_cancelled()
click to toggle source
# File lib/twimock/api/oauth/authorize.rb, line 41 def oauth_cancelled status = 200 body = Twimock::API::OAuth::Cancelled.view(@oauth_token) header = { "Content-Length" => body.bytesize.to_s } [ status, header, [ body ] ] end