Class: CDEKApiClient::Entities::AuthResponse
- Inherits:
-
Object
- Object
- CDEKApiClient::Entities::AuthResponse
- Includes:
- Validatable
- Defined in:
- lib/cdek_api_client/entities/auth_response.rb
Overview
Represents an OAuth authentication response from the CDEK API.
Instance Attribute Summary collapse
-
#access_token ⇒ Object
Returns the value of attribute access_token.
-
#expires_in ⇒ Object
Returns the value of attribute expires_in.
-
#jti ⇒ Object
Returns the value of attribute jti.
-
#scope ⇒ Object
Returns the value of attribute scope.
-
#token_type ⇒ Object
Returns the value of attribute token_type.
Instance Method Summary collapse
-
#initialize(access_token:, token_type:, expires_in:, scope:, jti:) ⇒ AuthResponse
constructor
Initializes a new AuthResponse object.
-
#to_json(*_args) ⇒ String
Converts the AuthResponse object to a JSON representation.
Methods included from Validatable
Constructor Details
#initialize(access_token:, token_type:, expires_in:, scope:, jti:) ⇒ AuthResponse
Initializes a new AuthResponse object.
27 28 29 30 31 32 33 34 |
# File 'lib/cdek_api_client/entities/auth_response.rb', line 27 def initialize(access_token:, token_type:, expires_in:, scope:, jti:) @access_token = access_token @token_type = token_type @expires_in = expires_in @scope = scope @jti = jti validate! end |
Instance Attribute Details
#access_token ⇒ Object
Returns the value of attribute access_token.
11 12 13 |
# File 'lib/cdek_api_client/entities/auth_response.rb', line 11 def access_token @access_token end |
#expires_in ⇒ Object
Returns the value of attribute expires_in.
11 12 13 |
# File 'lib/cdek_api_client/entities/auth_response.rb', line 11 def expires_in @expires_in end |
#jti ⇒ Object
Returns the value of attribute jti.
11 12 13 |
# File 'lib/cdek_api_client/entities/auth_response.rb', line 11 def jti @jti end |
#scope ⇒ Object
Returns the value of attribute scope.
11 12 13 |
# File 'lib/cdek_api_client/entities/auth_response.rb', line 11 def scope @scope end |
#token_type ⇒ Object
Returns the value of attribute token_type.
11 12 13 |
# File 'lib/cdek_api_client/entities/auth_response.rb', line 11 def token_type @token_type end |
Instance Method Details
#to_json(*_args) ⇒ String
Converts the AuthResponse object to a JSON representation.
39 40 41 42 43 44 45 46 47 |
# File 'lib/cdek_api_client/entities/auth_response.rb', line 39 def to_json(*_args) { access_token: @access_token, token_type: @token_type, expires_in: @expires_in, scope: @scope, jti: @jti }.to_json end |