Class: LoyaltyApIs::AuthTokenResponse
- Defined in:
- lib/loyalty_ap_is/models/auth_token_response.rb
Overview
AuthTokenResponse Model.
Instance Attribute Summary collapse
-
#expires_in ⇒ String
With value unlimited it means this token will never expire.
-
#owner ⇒ String
States the name of the partner to which the digest used belongs.
-
#token ⇒ String
Your Basic public token which needs to be used in the auth/ExchangeAccessCode.
-
#token_type ⇒ String
Type of the token.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(token: SKIP, token_type: SKIP, expires_in: SKIP, owner: SKIP, additional_properties: nil) ⇒ AuthTokenResponse
constructor
A new instance of AuthTokenResponse.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(token: SKIP, token_type: SKIP, expires_in: SKIP, owner: SKIP, additional_properties: nil) ⇒ AuthTokenResponse
Returns a new instance of AuthTokenResponse.
54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/loyalty_ap_is/models/auth_token_response.rb', line 54 def initialize(token: SKIP, token_type: SKIP, expires_in: SKIP, owner: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @token = token unless token == SKIP @token_type = token_type unless token_type == SKIP @expires_in = expires_in unless expires_in == SKIP @owner = owner unless owner == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#expires_in ⇒ String
With value unlimited it means this token will never expire
23 24 25 |
# File 'lib/loyalty_ap_is/models/auth_token_response.rb', line 23 def expires_in @expires_in end |
#owner ⇒ String
States the name of the partner to which the digest used belongs
27 28 29 |
# File 'lib/loyalty_ap_is/models/auth_token_response.rb', line 27 def owner @owner end |
#token ⇒ String
Your Basic public token which needs to be used in the auth/ExchangeAccessCode.
15 16 17 |
# File 'lib/loyalty_ap_is/models/auth_token_response.rb', line 15 def token @token end |
#token_type ⇒ String
Type of the token.
19 20 21 |
# File 'lib/loyalty_ap_is/models/auth_token_response.rb', line 19 def token_type @token_type end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/loyalty_ap_is/models/auth_token_response.rb', line 67 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. token = hash.key?('token') ? hash['token'] : SKIP token_type = hash.key?('tokenType') ? hash['tokenType'] : SKIP expires_in = hash.key?('expiresIn') ? hash['expiresIn'] : SKIP owner = hash.key?('owner') ? hash['owner'] : SKIP # Create a new hash for additional properties, removing known properties. new_hash = hash.reject { |k, _| names.value?(k) } additional_properties = APIHelper.get_additional_properties( new_hash, proc { |value| value } ) # Create object from extracted values. AuthTokenResponse.new(token: token, token_type: token_type, expires_in: expires_in, owner: owner, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
30 31 32 33 34 35 36 37 |
# File 'lib/loyalty_ap_is/models/auth_token_response.rb', line 30 def self.names @_hash = {} if @_hash.nil? @_hash['token'] = 'token' @_hash['token_type'] = 'tokenType' @_hash['expires_in'] = 'expiresIn' @_hash['owner'] = 'owner' @_hash end |
.nullables ⇒ Object
An array for nullable fields
50 51 52 |
# File 'lib/loyalty_ap_is/models/auth_token_response.rb', line 50 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
40 41 42 43 44 45 46 47 |
# File 'lib/loyalty_ap_is/models/auth_token_response.rb', line 40 def self.optionals %w[ token token_type expires_in owner ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
99 100 101 102 103 104 |
# File 'lib/loyalty_ap_is/models/auth_token_response.rb', line 99 def inspect class_name = self.class.name.split('::').last "<#{class_name} token: #{@token.inspect}, token_type: #{@token_type.inspect}, expires_in:"\ " #{@expires_in.inspect}, owner: #{@owner.inspect}, additional_properties:"\ " #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
92 93 94 95 96 |
# File 'lib/loyalty_ap_is/models/auth_token_response.rb', line 92 def to_s class_name = self.class.name.split('::').last "<#{class_name} token: #{@token}, token_type: #{@token_type}, expires_in: #{@expires_in},"\ " owner: #{@owner}, additional_properties: #{@additional_properties}>" end |