Class: Stormpath::Rails::GithubAuthCodeExchange
- Inherits:
-
Object
- Object
- Stormpath::Rails::GithubAuthCodeExchange
- Defined in:
- lib/stormpath/rails/github_auth_code_exchange.rb
Constant Summary collapse
- GITHUB_EXCHANGE_URL =
URI('https://github.com/login/oauth/access_token')
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#root_url ⇒ Object
readonly
Returns the value of attribute root_url.
Instance Method Summary collapse
- #access_token ⇒ Object
-
#initialize(root_url, code) ⇒ GithubAuthCodeExchange
constructor
A new instance of GithubAuthCodeExchange.
Constructor Details
#initialize(root_url, code) ⇒ GithubAuthCodeExchange
Returns a new instance of GithubAuthCodeExchange.
8 9 10 11 12 |
# File 'lib/stormpath/rails/github_auth_code_exchange.rb', line 8 def initialize(root_url, code) raise(NoGithubAuthorizationError) if code.nil? @root_url = root_url @code = code end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
6 7 8 |
# File 'lib/stormpath/rails/github_auth_code_exchange.rb', line 6 def code @code end |
#root_url ⇒ Object (readonly)
Returns the value of attribute root_url.
6 7 8 |
# File 'lib/stormpath/rails/github_auth_code_exchange.rb', line 6 def root_url @root_url end |
Instance Method Details
#access_token ⇒ Object
14 15 16 |
# File 'lib/stormpath/rails/github_auth_code_exchange.rb', line 14 def access_token @access_token ||= fetch_access_token(exchange_auth_code.body) end |