Class: LoyaltyApIs::AuthTokenResponse

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/loyalty_ap_is/models/auth_token_response.rb

Overview

AuthTokenResponse Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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_inString

With value unlimited it means this token will never expire

Returns:

  • (String)


23
24
25
# File 'lib/loyalty_ap_is/models/auth_token_response.rb', line 23

def expires_in
  @expires_in
end

#ownerString

States the name of the partner to which the digest used belongs

Returns:

  • (String)


27
28
29
# File 'lib/loyalty_ap_is/models/auth_token_response.rb', line 27

def owner
  @owner
end

#tokenString

Your Basic public token which needs to be used in the auth/ExchangeAccessCode.

Returns:

  • (String)


15
16
17
# File 'lib/loyalty_ap_is/models/auth_token_response.rb', line 15

def token
  @token
end

#token_typeString

Type of the token.

Returns:

  • (String)


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

.namesObject

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

.nullablesObject

An array for nullable fields



50
51
52
# File 'lib/loyalty_ap_is/models/auth_token_response.rb', line 50

def self.nullables
  []
end

.optionalsObject

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

#inspectObject

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_sObject

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