Class: Warden::GitHub::OAuth
- Inherits:
-
Object
- Object
- Warden::GitHub::OAuth
- Defined in:
- lib/warden/github/oauth.rb
Constant Summary collapse
- BadVerificationCode =
Class.new(StandardError)
Instance Attribute Summary collapse
-
#client_id ⇒ Object
readonly
Returns the value of attribute client_id.
-
#client_secret ⇒ Object
readonly
Returns the value of attribute client_secret.
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#redirect_uri ⇒ Object
readonly
Returns the value of attribute redirect_uri.
-
#scope ⇒ Object
readonly
Returns the value of attribute scope.
-
#state ⇒ Object
readonly
Returns the value of attribute state.
Instance Method Summary collapse
- #access_token ⇒ Object
- #authorize_uri ⇒ Object
-
#initialize(attrs = {}) ⇒ OAuth
constructor
A new instance of OAuth.
Constructor Details
#initialize(attrs = {}) ⇒ OAuth
Returns a new instance of OAuth.
16 17 18 19 20 21 22 23 |
# File 'lib/warden/github/oauth.rb', line 16 def initialize(attrs={}) @code = attrs[:code] @state = attrs[:state] @scope = attrs[:scope] @client_id = attrs.fetch(:client_id) @client_secret = attrs.fetch(:client_secret) @redirect_uri = attrs.fetch(:redirect_uri) end |
Instance Attribute Details
#client_id ⇒ Object (readonly)
Returns the value of attribute client_id.
9 10 11 |
# File 'lib/warden/github/oauth.rb', line 9 def client_id @client_id end |
#client_secret ⇒ Object (readonly)
Returns the value of attribute client_secret.
9 10 11 |
# File 'lib/warden/github/oauth.rb', line 9 def client_secret @client_secret end |
#code ⇒ Object (readonly)
Returns the value of attribute code.
9 10 11 |
# File 'lib/warden/github/oauth.rb', line 9 def code @code end |
#redirect_uri ⇒ Object (readonly)
Returns the value of attribute redirect_uri.
9 10 11 |
# File 'lib/warden/github/oauth.rb', line 9 def redirect_uri @redirect_uri end |
#scope ⇒ Object (readonly)
Returns the value of attribute scope.
9 10 11 |
# File 'lib/warden/github/oauth.rb', line 9 def scope @scope end |
#state ⇒ Object (readonly)
Returns the value of attribute state.
9 10 11 |
# File 'lib/warden/github/oauth.rb', line 9 def state @state end |
Instance Method Details
#access_token ⇒ Object
34 35 36 |
# File 'lib/warden/github/oauth.rb', line 34 def access_token @access_token ||= load_access_token end |
#authorize_uri ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'lib/warden/github/oauth.rb', line 25 def @authorize_uri ||= build_uri( '/login/oauth/authorize', :client_id => client_id, :redirect_uri => redirect_uri, :scope => scope, :state => state) end |