Class: Doorkeeper::OAuth::TokenResponse
- Inherits:
-
Object
- Object
- Doorkeeper::OAuth::TokenResponse
- Defined in:
- lib/doorkeeper/oauth/token_response.rb
Instance Attribute Summary collapse
-
#token ⇒ Object
(also: #issued_token)
readonly
Returns the value of attribute token.
Instance Method Summary collapse
- #body ⇒ Object
- #headers ⇒ Object
-
#initialize(token) ⇒ TokenResponse
constructor
A new instance of TokenResponse.
- #status ⇒ Object
Constructor Details
#initialize(token) ⇒ TokenResponse
Returns a new instance of TokenResponse.
10 11 12 |
# File 'lib/doorkeeper/oauth/token_response.rb', line 10 def initialize(token) @token = token end |
Instance Attribute Details
#token ⇒ Object (readonly) Also known as: issued_token
Returns the value of attribute token.
6 7 8 |
# File 'lib/doorkeeper/oauth/token_response.rb', line 6 def token @token end |
Instance Method Details
#body ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/doorkeeper/oauth/token_response.rb', line 14 def body @body ||= { "access_token" => token.plaintext_token, "token_type" => token.token_type, "expires_in" => token.expires_in_seconds, "refresh_token" => token.plaintext_refresh_token, "scope" => token.scopes_string, "created_at" => token.created_at.to_i, }.reject { |_, value| value.blank? } end |
#headers ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/doorkeeper/oauth/token_response.rb', line 29 def headers { "Cache-Control" => "no-store, no-cache", "Content-Type" => "application/json; charset=utf-8", "Pragma" => "no-cache", } end |
#status ⇒ Object
25 26 27 |
# File 'lib/doorkeeper/oauth/token_response.rb', line 25 def status :ok end |