Class: Twitter::Login::Request

Inherits:
Rack::Request
  • Object
show all
Defined in:
lib/twitter/login.rb

Instance Method Summary collapse

Instance Method Details

#sessionObject

for storing :request_token, :access_token



74
75
76
# File 'lib/twitter/login.rb', line 74

def session
  env['rack.session'] ||= {}
end

#url_for(path) ⇒ Object

SUCKS: must duplicate logic from the ‘url` method



79
80
81
82
83
84
85
86
87
88
# File 'lib/twitter/login.rb', line 79

def url_for(path)
  url = scheme + '://' + host

  if scheme == 'https' && port != 443 ||
      scheme == 'http' && port != 80
    url << ":#{port}"
  end

  url << path
end

#wants?(mime_type) ⇒ Boolean

Returns:

  • (Boolean)


90
91
92
# File 'lib/twitter/login.rb', line 90

def wants?(mime_type)
  env['HTTP_ACCEPT'].to_s.include? mime_type
end