Class: PostfinancecheckoutRubySdk::TokenVersion

Inherits:
Object
  • Object
show all
Defined in:
lib/postfinancecheckout-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



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
314
315
316
317
318
319
320
321
# File 'lib/postfinancecheckout-ruby-sdk/models/token_version.rb', line 200

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

  # check to see if the attribute exists and convert string to symbol for hash key
  acceptable_attribute_map = self.class.acceptable_attribute_map
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!acceptable_attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `PostfinancecheckoutRubySdk::TokenVersion`. Please check the name to make sure it's valid. List of attributes: " + acceptable_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.



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

def activated_on
  @activated_on
end

#billing_addressObject

Returns the value of attribute billing_address.



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

def billing_address
  @billing_address
end

#created_onObject

The date and time when the object was created.



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

def created_on
  @created_on
end

#environmentObject

Returns the value of attribute environment.



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

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.



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

def expires_on
  @expires_on
end

#icon_urlObject

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



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

def icon_url
  @icon_url
end

#idObject

A unique identifier for the object.



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

def id
  @id
end

#labelsObject

The labels providing additional information about the object.



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

def labels
  @labels
end

#languageObject

The language that is linked to the object.



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

def language
  @language
end

#last_retried_onObject

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



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

def last_retried_on
  @last_retried_on
end

#linked_space_idObject

The ID of the space this object belongs to.



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

def linked_space_id
  @linked_space_id
end

#nameObject

The name used to identify the token.



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

def name
  @name
end

#obsoleted_onObject

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



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

def obsoleted_on
  @obsoleted_on
end

#payment_connector_configurationObject

Returns the value of attribute payment_connector_configuration.



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

def payment_connector_configuration
  @payment_connector_configuration
end

#payment_information_hashesObject

The hashed payment information that the token version represents.



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

def payment_information_hashes
  @payment_information_hashes
end

#payment_methodObject

Returns the value of attribute payment_method.



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

def payment_method
  @payment_method
end

#payment_method_brandObject

Returns the value of attribute payment_method_brand.



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

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.



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

def planned_purge_date
  @planned_purge_date
end

#processor_tokenObject

The token name as specified by the processor.



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

def processor_token
  @processor_token
end

#retry_inObject

Retry interval when the strategy advises retrying later.



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

def retry_in
  @retry_in
end

#retry_strategyObject

Returns the value of attribute retry_strategy.



94
95
96
# File 'lib/postfinancecheckout-ruby-sdk/models/token_version.rb', line 94

def retry_strategy
  @retry_strategy
end

#shipping_addressObject

Returns the value of attribute shipping_address.



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

def shipping_address
  @shipping_address
end

#stateObject

Returns the value of attribute state.



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

def state
  @state
end

#tokenObject

Returns the value of attribute token.



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

def token
  @token
end

#typeObject

Returns the value of attribute type.



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

def type
  @type
end

#versionObject

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



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

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



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
496
497
498
499
500
501
502
503
504
505
# File 'lib/postfinancecheckout-ruby-sdk/models/token_version.rb', line 468

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 = PostfinancecheckoutRubySdk.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_attribute_mapObject

Returns attribute mapping this model knows about



151
152
153
# File 'lib/postfinancecheckout-ruby-sdk/models/token_version.rb', line 151

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



156
157
158
# File 'lib/postfinancecheckout-ruby-sdk/models/token_version.rb', line 156

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



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
147
148
# File 'lib/postfinancecheckout-ruby-sdk/models/token_version.rb', line 119

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

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
# File 'lib/postfinancecheckout-ruby-sdk/models/token_version.rb', line 444

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



193
194
195
196
# File 'lib/postfinancecheckout-ruby-sdk/models/token_version.rb', line 193

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

.openapi_typesObject

Attribute type mapping.



161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
# File 'lib/postfinancecheckout-ruby-sdk/models/token_version.rb', line 161

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



398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
# File 'lib/postfinancecheckout-ruby-sdk/models/token_version.rb', line 398

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



539
540
541
542
543
544
545
546
547
548
549
550
551
# File 'lib/postfinancecheckout-ruby-sdk/models/token_version.rb', line 539

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


431
432
433
# File 'lib/postfinancecheckout-ruby-sdk/models/token_version.rb', line 431

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



437
438
439
# File 'lib/postfinancecheckout-ruby-sdk/models/token_version.rb', line 437

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



325
326
327
328
329
330
331
332
333
334
335
336
337
# File 'lib/postfinancecheckout-ruby-sdk/models/token_version.rb', line 325

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



515
516
517
# File 'lib/postfinancecheckout-ruby-sdk/models/token_version.rb', line 515

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



521
522
523
524
525
526
527
528
529
530
531
532
533
# File 'lib/postfinancecheckout-ruby-sdk/models/token_version.rb', line 521

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



509
510
511
# File 'lib/postfinancecheckout-ruby-sdk/models/token_version.rb', line 509

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



341
342
343
344
345
346
# File 'lib/postfinancecheckout-ruby-sdk/models/token_version.rb', line 341

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