Class: Twitter::Login
- Inherits:
-
Object
- Object
- Twitter::Login
- Defined in:
- lib/twitter/login.rb
Defined Under Namespace
Modules: Helpers Classes: Request
Constant Summary collapse
- DEFAULTS =
{ :return_to => '/', :site => 'http://api.twitter.com', :authorize_path => '/oauth/authenticate' }
Class Attribute Summary collapse
-
.consumer_key ⇒ Object
Returns the value of attribute consumer_key.
-
.secret ⇒ Object
Returns the value of attribute secret.
-
.site ⇒ Object
Returns the value of attribute site.
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(options) ⇒ Login
constructor
A new instance of Login.
- #login_handler(options = {}) ⇒ Object
Constructor Details
Class Attribute Details
.consumer_key ⇒ Object
Returns the value of attribute consumer_key.
13 14 15 |
# File 'lib/twitter/login.rb', line 13 def consumer_key @consumer_key end |
.secret ⇒ Object
Returns the value of attribute secret.
13 14 15 |
# File 'lib/twitter/login.rb', line 13 def secret @secret end |
.site ⇒ Object
Returns the value of attribute site.
13 14 15 |
# File 'lib/twitter/login.rb', line 13 def site @site end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
10 11 12 |
# File 'lib/twitter/login.rb', line 10 def @options end |
Instance Method Details
#call(env) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/twitter/login.rb', line 33 def call(env) request = Request.new(env) if request[:oauth_verifier] # user authorized the app (request) elsif request[:denied] # user refused to log in with Twitter handle_denied_access(request) else # starting the login process; send user to Twitter redirect_to_twitter(request) end end |
#login_handler(options = {}) ⇒ Object
28 29 30 31 |
# File 'lib/twitter/login.rb', line 28 def login_handler( = {}) @options.update return self end |