Class: Fakturoid::Oauth::TokenResponse
- Inherits:
-
Object
- Object
- Fakturoid::Oauth::TokenResponse
- Defined in:
- lib/fakturoid/oauth/token_response.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
- #access_token ⇒ Object
- #expires_in ⇒ Object
-
#initialize(response) ⇒ TokenResponse
constructor
A new instance of TokenResponse.
- #inspect ⇒ Object
- #refresh_token ⇒ Object
- #status_code ⇒ Object
- #token_type ⇒ Object
Constructor Details
#initialize(response) ⇒ TokenResponse
Returns a new instance of TokenResponse.
8 9 10 11 12 13 |
# File 'lib/fakturoid/oauth/token_response.rb', line 8 def initialize(response) @response = response @body = MultiJson.load(response.env.body) unless Utils.empty?(response.env.body) handle_response end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
6 7 8 |
# File 'lib/fakturoid/oauth/token_response.rb', line 6 def body @body end |
#client ⇒ Object (readonly)
Returns the value of attribute client.
6 7 8 |
# File 'lib/fakturoid/oauth/token_response.rb', line 6 def client @client end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
6 7 8 |
# File 'lib/fakturoid/oauth/token_response.rb', line 6 def response @response end |
Instance Method Details
#access_token ⇒ Object
23 24 25 |
# File 'lib/fakturoid/oauth/token_response.rb', line 23 def access_token body["access_token"] end |
#expires_in ⇒ Object
27 28 29 |
# File 'lib/fakturoid/oauth/token_response.rb', line 27 def expires_in body["expires_in"] end |
#inspect ⇒ Object
35 36 37 |
# File 'lib/fakturoid/oauth/token_response.rb', line 35 def inspect "#<#{self.class.name}:#{object_id} @body=\"#{body}\" @status_code=\"#{status_code}\">" end |
#refresh_token ⇒ Object
19 20 21 |
# File 'lib/fakturoid/oauth/token_response.rb', line 19 def refresh_token body["refresh_token"] end |
#status_code ⇒ Object
15 16 17 |
# File 'lib/fakturoid/oauth/token_response.rb', line 15 def status_code response.env["status"] end |
#token_type ⇒ Object
31 32 33 |
# File 'lib/fakturoid/oauth/token_response.rb', line 31 def token_type body["token_type"] end |