Class: WalleeRubySdk::TokenVersion

Inherits:
Object
  • Object
show all
Defined in:
lib/wallee-ruby-sdk/models/token_version.rb

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ TokenVersion

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
# File 'lib/wallee-ruby-sdk/models/token_version.rb', line 193

def initialize(attributes = {})
  unless attributes.is_a?(Hash)
    fail ArgumentError, "The input argument (attributes) must be a hash in `WalleeRubySdk::TokenVersion` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h|
    unless self.class.attribute_map.key?(k.to_sym)
      fail ArgumentError, "`#{k}` is not a valid attribute in `WalleeRubySdk::TokenVersion`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'payment_information_hashes')
    if (value = attributes[:'payment_information_hashes']).is_a?(Array)
      self.payment_information_hashes = value
    end
  end

  if attributes.key?(:'language')
    self.language = attributes[:'language']
  end

  if attributes.key?(:'type')
    self.type = attributes[:'type']
  end

  if attributes.key?(:'created_on')
    self.created_on = attributes[:'created_on']
  end

  if attributes.key?(:'retry_in')
    self.retry_in = attributes[:'retry_in']
  end

  if attributes.key?(:'payment_connector_configuration')
    self.payment_connector_configuration = attributes[:'payment_connector_configuration']
  end

  if attributes.key?(:'obsoleted_on')
    self.obsoleted_on = attributes[:'obsoleted_on']
  end

  if attributes.key?(:'expires_on')
    self.expires_on = attributes[:'expires_on']
  end

  if attributes.key?(:'icon_url')
    self.icon_url = attributes[:'icon_url']
  end

  if attributes.key?(:'id')
    self.id = attributes[:'id']
  end

  if attributes.key?(:'state')
    self.state = attributes[:'state']
  end

  if attributes.key?(:'processor_token')
    self.processor_token = attributes[:'processor_token']
  end

  if attributes.key?(:'planned_purge_date')
    self.planned_purge_date = attributes[:'planned_purge_date']
  end

  if attributes.key?(:'payment_method_brand')
    self.payment_method_brand = attributes[:'payment_method_brand']
  end

  if attributes.key?(:'version')
    self.version = attributes[:'version']
  end

  if attributes.key?(:'last_retried_on')
    self.last_retried_on = attributes[:'last_retried_on']
  end

  if attributes.key?(:'labels')
    if (value = attributes[:'labels']).is_a?(Array)
      self.labels = value
    end
  end

  if attributes.key?(:'token')
    self.token = attributes[:'token']
  end

  if attributes.key?(:'linked_space_id')
    self.linked_space_id = attributes[:'linked_space_id']
  end

  if attributes.key?(:'environment')
    self.environment = attributes[:'environment']
  end

  if attributes.key?(:'activated_on')
    self.activated_on = attributes[:'activated_on']
  end

  if attributes.key?(:'name')
    self.name = attributes[:'name']
  end

  if attributes.key?(:'payment_method')
    self.payment_method = attributes[:'payment_method']
  end

  if attributes.key?(:'shipping_address')
    self.shipping_address = attributes[:'shipping_address']
  end

  if attributes.key?(:'billing_address')
    self.billing_address = attributes[:'billing_address']
  end

  if attributes.key?(:'retry_strategy')
    self.retry_strategy = attributes[:'retry_strategy']
  end
end

Instance Attribute Details

#activated_onObject

The date and time when the token version was activated.



81
82
83
# File 'lib/wallee-ruby-sdk/models/token_version.rb', line 81

def activated_on
  @activated_on
end

#billing_addressObject

Returns the value of attribute billing_address.



90
91
92
# File 'lib/wallee-ruby-sdk/models/token_version.rb', line 90

def billing_address
  @billing_address
end

#created_onObject

The date and time when the object was created.



35
36
37
# File 'lib/wallee-ruby-sdk/models/token_version.rb', line 35

def created_on
  @created_on
end

#environmentObject

Returns the value of attribute environment.



78
79
80
# File 'lib/wallee-ruby-sdk/models/token_version.rb', line 78

def environment
  @environment
end

#expires_onObject

The date and time when the token version is set to expire, after which it will be marked as obsolete.



46
47
48
# File 'lib/wallee-ruby-sdk/models/token_version.rb', line 46

def expires_on
  @expires_on
end

#icon_urlObject

The URL to the token’s icon displayed to the customer.



49
50
51
# File 'lib/wallee-ruby-sdk/models/token_version.rb', line 49

def icon_url
  @icon_url
end

#idObject

A unique identifier for the object.



52
53
54
# File 'lib/wallee-ruby-sdk/models/token_version.rb', line 52

def id
  @id
end

#labelsObject

The labels providing additional information about the object.



71
72
73
# File 'lib/wallee-ruby-sdk/models/token_version.rb', line 71

def labels
  @labels
end

#languageObject

The language that is linked to the object.



30
31
32
# File 'lib/wallee-ruby-sdk/models/token_version.rb', line 30

def language
  @language
end

#last_retried_onObject

The date and time when the system last attempted a retry for this token version.



68
69
70
# File 'lib/wallee-ruby-sdk/models/token_version.rb', line 68

def last_retried_on
  @last_retried_on
end

#linked_space_idObject

The ID of the space this object belongs to.



76
77
78
# File 'lib/wallee-ruby-sdk/models/token_version.rb', line 76

def linked_space_id
  @linked_space_id
end

#nameObject

The name used to identify the token.



84
85
86
# File 'lib/wallee-ruby-sdk/models/token_version.rb', line 84

def name
  @name
end

#obsoleted_onObject

The date and time when the token version was marked obsolete.



43
44
45
# File 'lib/wallee-ruby-sdk/models/token_version.rb', line 43

def obsoleted_on
  @obsoleted_on
end

#payment_connector_configurationObject

Returns the value of attribute payment_connector_configuration.



40
41
42
# File 'lib/wallee-ruby-sdk/models/token_version.rb', line 40

def payment_connector_configuration
  @payment_connector_configuration
end

#payment_information_hashesObject

The hashed payment information that the token version represents.



27
28
29
# File 'lib/wallee-ruby-sdk/models/token_version.rb', line 27

def payment_information_hashes
  @payment_information_hashes
end

#payment_methodObject

Returns the value of attribute payment_method.



86
87
88
# File 'lib/wallee-ruby-sdk/models/token_version.rb', line 86

def payment_method
  @payment_method
end

#payment_method_brandObject

Returns the value of attribute payment_method_brand.



62
63
64
# File 'lib/wallee-ruby-sdk/models/token_version.rb', line 62

def payment_method_brand
  @payment_method_brand
end

#planned_purge_dateObject

The date and time when the object is planned to be permanently removed. If the value is empty, the object will not be removed.



60
61
62
# File 'lib/wallee-ruby-sdk/models/token_version.rb', line 60

def planned_purge_date
  @planned_purge_date
end

#processor_tokenObject

The token name as specified by the processor.



57
58
59
# File 'lib/wallee-ruby-sdk/models/token_version.rb', line 57

def processor_token
  @processor_token
end

#retry_inObject

Retry interval when the strategy advises retrying later.



38
39
40
# File 'lib/wallee-ruby-sdk/models/token_version.rb', line 38

def retry_in
  @retry_in
end

#retry_strategyObject

Returns the value of attribute retry_strategy.



92
93
94
# File 'lib/wallee-ruby-sdk/models/token_version.rb', line 92

def retry_strategy
  @retry_strategy
end

#shipping_addressObject

Returns the value of attribute shipping_address.



88
89
90
# File 'lib/wallee-ruby-sdk/models/token_version.rb', line 88

def shipping_address
  @shipping_address
end

#stateObject

Returns the value of attribute state.



54
55
56
# File 'lib/wallee-ruby-sdk/models/token_version.rb', line 54

def state
  @state
end

#tokenObject

Returns the value of attribute token.



73
74
75
# File 'lib/wallee-ruby-sdk/models/token_version.rb', line 73

def token
  @token
end

#typeObject

Returns the value of attribute type.



32
33
34
# File 'lib/wallee-ruby-sdk/models/token_version.rb', line 32

def type
  @type
end

#versionObject

The version is used for optimistic locking and incremented whenever the object is updated.



65
66
67
# File 'lib/wallee-ruby-sdk/models/token_version.rb', line 65

def version
  @version
end

Class Method Details

._deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
# File 'lib/wallee-ruby-sdk/models/token_version.rb', line 458

def self._deserialize(type, value)
  case type.to_sym
  when :Time
    Time.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :Boolean
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    # models (e.g. Pet) or oneOf
    klass = WalleeRubySdk.const_get(type)
    klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
  end
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



149
150
151
# File 'lib/wallee-ruby-sdk/models/token_version.rb', line 149

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# File 'lib/wallee-ruby-sdk/models/token_version.rb', line 117

def self.attribute_map
  {
    :'payment_information_hashes' => :'paymentInformationHashes',
    :'language' => :'language',
    :'type' => :'type',
    :'created_on' => :'createdOn',
    :'retry_in' => :'retryIn',
    :'payment_connector_configuration' => :'paymentConnectorConfiguration',
    :'obsoleted_on' => :'obsoletedOn',
    :'expires_on' => :'expiresOn',
    :'icon_url' => :'iconUrl',
    :'id' => :'id',
    :'state' => :'state',
    :'processor_token' => :'processorToken',
    :'planned_purge_date' => :'plannedPurgeDate',
    :'payment_method_brand' => :'paymentMethodBrand',
    :'version' => :'version',
    :'last_retried_on' => :'lastRetriedOn',
    :'labels' => :'labels',
    :'token' => :'token',
    :'linked_space_id' => :'linkedSpaceId',
    :'environment' => :'environment',
    :'activated_on' => :'activatedOn',
    :'name' => :'name',
    :'payment_method' => :'paymentMethod',
    :'shipping_address' => :'shippingAddress',
    :'billing_address' => :'billingAddress',
    :'retry_strategy' => :'retryStrategy'
  }
end

.build_from_hash(attributes) ⇒ Object

Returns the model itself

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
# File 'lib/wallee-ruby-sdk/models/token_version.rb', line 434

def self.build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  transformed_hash = {}
  openapi_types.each_pair do |key, type|
    if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = nil
    elsif type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[attribute_map[key]].is_a?(Array)
        transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
      end
    elsif !attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
    end
  end
  new(transformed_hash)
end

.openapi_nullableObject

List of attributes with nullable: true



186
187
188
189
# File 'lib/wallee-ruby-sdk/models/token_version.rb', line 186

def self.openapi_nullable
  Set.new([
  ])
end

.openapi_typesObject

Attribute type mapping.



154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
# File 'lib/wallee-ruby-sdk/models/token_version.rb', line 154

def self.openapi_types
  {
    :'payment_information_hashes' => :'Array<PaymentInformationHash>',
    :'language' => :'String',
    :'type' => :'TokenVersionType',
    :'created_on' => :'Time',
    :'retry_in' => :'String',
    :'payment_connector_configuration' => :'PaymentConnectorConfiguration',
    :'obsoleted_on' => :'Time',
    :'expires_on' => :'Time',
    :'icon_url' => :'String',
    :'id' => :'Integer',
    :'state' => :'TokenVersionState',
    :'processor_token' => :'String',
    :'planned_purge_date' => :'Time',
    :'payment_method_brand' => :'PaymentMethodBrand',
    :'version' => :'Integer',
    :'last_retried_on' => :'Time',
    :'labels' => :'Array<Label>',
    :'token' => :'Token',
    :'linked_space_id' => :'Integer',
    :'environment' => :'ChargeAttemptEnvironment',
    :'activated_on' => :'Time',
    :'name' => :'String',
    :'payment_method' => :'PaymentMethod',
    :'shipping_address' => :'Address',
    :'billing_address' => :'Address',
    :'retry_strategy' => :'TokenVersionRetryStrategy'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
# File 'lib/wallee-ruby-sdk/models/token_version.rb', line 390

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      payment_information_hashes == o.payment_information_hashes &&
      language == o.language &&
      type == o.type &&
      created_on == o.created_on &&
      retry_in == o.retry_in &&
      payment_connector_configuration == o.payment_connector_configuration &&
      obsoleted_on == o.obsoleted_on &&
      expires_on == o.expires_on &&
      icon_url == o.icon_url &&
      id == o.id &&
      state == o.state &&
      processor_token == o.processor_token &&
      planned_purge_date == o.planned_purge_date &&
      payment_method_brand == o.payment_method_brand &&
      version == o.version &&
      last_retried_on == o.last_retried_on &&
      labels == o.labels &&
      token == o.token &&
      linked_space_id == o.linked_space_id &&
      environment == o.environment &&
      activated_on == o.activated_on &&
      name == o.name &&
      payment_method == o.payment_method &&
      shipping_address == o.shipping_address &&
      billing_address == o.billing_address &&
      retry_strategy == o.retry_strategy
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



529
530
531
532
533
534
535
536
537
538
539
540
541
# File 'lib/wallee-ruby-sdk/models/token_version.rb', line 529

def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map { |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


423
424
425
# File 'lib/wallee-ruby-sdk/models/token_version.rb', line 423

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



429
430
431
# File 'lib/wallee-ruby-sdk/models/token_version.rb', line 429

def hash
  [payment_information_hashes, language, type, created_on, retry_in, payment_connector_configuration, obsoleted_on, expires_on, icon_url, id, state, processor_token, planned_purge_date, payment_method_brand, version, last_retried_on, labels, token, linked_space_id, environment, activated_on, name, payment_method, shipping_address, billing_address, retry_strategy].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



317
318
319
320
321
322
323
324
325
326
327
328
329
# File 'lib/wallee-ruby-sdk/models/token_version.rb', line 317

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  if !@processor_token.nil? && @processor_token.to_s.length > 150
    invalid_properties.push('invalid value for "processor_token", the character length must be smaller than or equal to 150.')
  end

  if !@name.nil? && @name.to_s.length > 150
    invalid_properties.push('invalid value for "name", the character length must be smaller than or equal to 150.')
  end

  invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



505
506
507
# File 'lib/wallee-ruby-sdk/models/token_version.rb', line 505

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



511
512
513
514
515
516
517
518
519
520
521
522
523
# File 'lib/wallee-ruby-sdk/models/token_version.rb', line 511

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



499
500
501
# File 'lib/wallee-ruby-sdk/models/token_version.rb', line 499

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



333
334
335
336
337
338
# File 'lib/wallee-ruby-sdk/models/token_version.rb', line 333

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if !@processor_token.nil? && @processor_token.to_s.length > 150
  return false if !@name.nil? && @name.to_s.length > 150
  true
end