Class: Rlyeh::DeepOnes::Auth::OAuth
- Defined in:
- lib/rlyeh/deep_ones/auth/oauth.rb
Instance Attribute Summary collapse
-
#access_token ⇒ Object
readonly
Returns the value of attribute access_token.
-
#authorize_params ⇒ Object
Returns the value of attribute authorize_params.
-
#client_options ⇒ Object
Returns the value of attribute client_options.
-
#consumer_key ⇒ Object
Returns the value of attribute consumer_key.
-
#consumer_secret ⇒ Object
Returns the value of attribute consumer_secret.
-
#open_timeout ⇒ Object
Returns the value of attribute open_timeout.
-
#read_timeout ⇒ Object
Returns the value of attribute read_timeout.
-
#request_params ⇒ Object
Returns the value of attribute request_params.
Attributes inherited from Base
#host, #nick, #pass, #real, #user
Instance Method Summary collapse
- #consumer ⇒ Object
-
#initialize(app, consumer_key, consumer_secret, client_options = {}) ⇒ OAuth
constructor
A new instance of OAuth.
- #request_phase(env) ⇒ Object
- #try(env) ⇒ Object
Methods inherited from Base
#authenticated?, #call, #failed, #session_id, #succeeded, #welcome
Methods included from Logger
Methods included from Rlyeh::Dispatcher
Constructor Details
#initialize(app, consumer_key, consumer_secret, client_options = {}) ⇒ OAuth
Returns a new instance of OAuth.
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/rlyeh/deep_ones/auth/oauth.rb', line 12 def initialize(app, consumer_key, consumer_secret, = {}) @consumer_key = consumer_key @consumer_secret = consumer_secret @client_options = @open_timeout = nil @read_timeout = nil @authorize_params = {} @request_params = {} super app end |
Instance Attribute Details
#access_token ⇒ Object (readonly)
Returns the value of attribute access_token.
10 11 12 |
# File 'lib/rlyeh/deep_ones/auth/oauth.rb', line 10 def access_token @access_token end |
#authorize_params ⇒ Object
Returns the value of attribute authorize_params.
9 10 11 |
# File 'lib/rlyeh/deep_ones/auth/oauth.rb', line 9 def @authorize_params end |
#client_options ⇒ Object
Returns the value of attribute client_options.
7 8 9 |
# File 'lib/rlyeh/deep_ones/auth/oauth.rb', line 7 def @client_options end |
#consumer_key ⇒ Object
Returns the value of attribute consumer_key.
7 8 9 |
# File 'lib/rlyeh/deep_ones/auth/oauth.rb', line 7 def consumer_key @consumer_key end |
#consumer_secret ⇒ Object
Returns the value of attribute consumer_secret.
7 8 9 |
# File 'lib/rlyeh/deep_ones/auth/oauth.rb', line 7 def consumer_secret @consumer_secret end |
#open_timeout ⇒ Object
Returns the value of attribute open_timeout.
8 9 10 |
# File 'lib/rlyeh/deep_ones/auth/oauth.rb', line 8 def open_timeout @open_timeout end |
#read_timeout ⇒ Object
Returns the value of attribute read_timeout.
8 9 10 |
# File 'lib/rlyeh/deep_ones/auth/oauth.rb', line 8 def read_timeout @read_timeout end |
#request_params ⇒ Object
Returns the value of attribute request_params.
9 10 11 |
# File 'lib/rlyeh/deep_ones/auth/oauth.rb', line 9 def request_params @request_params end |
Instance Method Details
#consumer ⇒ Object
23 24 25 26 27 28 |
# File 'lib/rlyeh/deep_ones/auth/oauth.rb', line 23 def consumer consumer = ::OAuth::Consumer.new @consumer_key, @consumer_secret, @client_options consumer.http.open_timeout = @open_timeout if @open_timeout consumer.http.read_timeout = @read_timeout if @read_timeout consumer end |
#request_phase(env) ⇒ Object
35 36 37 38 39 40 |
# File 'lib/rlyeh/deep_ones/auth/oauth.rb', line 35 def request_phase(env) request_token = consumer.get_request_token @request_params talk env, 'Access this URL get the PIN and paste it here.' talk env, request_token.(@authorize_params) end |
#try(env) ⇒ Object
30 31 32 33 |
# File 'lib/rlyeh/deep_ones/auth/oauth.rb', line 30 def try(env) welcome env request_phase env end |