Class: UnitOpenapiRubySdk::CheckPaymentAttributes

Inherits:
Object
  • Object
show all
Defined in:
lib/unit_openapi_ruby_sdk/models/check_payment_attributes.rb

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ CheckPaymentAttributes

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
191
192
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
# File 'lib/unit_openapi_ruby_sdk/models/check_payment_attributes.rb', line 161

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `UnitOpenapiRubySdk::CheckPaymentAttributes` 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|
    if (!self.class.attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `UnitOpenapiRubySdk::CheckPaymentAttributes`. 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?(:'created_at')
    self.created_at = attributes[:'created_at']
  else
    self.created_at = nil
  end

  if attributes.key?(:'updated_at')
    self.updated_at = attributes[:'updated_at']
  else
    self.updated_at = nil
  end

  if attributes.key?(:'amount')
    self.amount = attributes[:'amount']
  else
    self.amount = nil
  end

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

  if attributes.key?(:'status')
    self.status = attributes[:'status']
  else
    self.status = nil
  end

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

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

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

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

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

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

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

  if attributes.key?(:'originated')
    self.originated = attributes[:'originated']
  else
    self.originated = nil
  end

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#additional_verification_statusObject

Returns the value of attribute additional_verification_status.



64
65
66
# File 'lib/unit_openapi_ruby_sdk/models/check_payment_attributes.rb', line 64

def additional_verification_status
  @additional_verification_status
end

#amountObject

Returns the value of attribute amount.



22
23
24
# File 'lib/unit_openapi_ruby_sdk/models/check_payment_attributes.rb', line 22

def amount
  @amount
end

#check_numberObject

Returns the value of attribute check_number.



56
57
58
# File 'lib/unit_openapi_ruby_sdk/models/check_payment_attributes.rb', line 56

def check_number
  @check_number
end

#counterpartyObject

Returns the value of attribute counterparty.



34
35
36
# File 'lib/unit_openapi_ruby_sdk/models/check_payment_attributes.rb', line 34

def counterparty
  @counterparty
end

#counterparty_routing_numberObject

Returns the value of attribute counterparty_routing_number.



62
63
64
# File 'lib/unit_openapi_ruby_sdk/models/check_payment_attributes.rb', line 62

def counterparty_routing_number
  @counterparty_routing_number
end

#created_atObject

Returns the value of attribute created_at.



18
19
20
# File 'lib/unit_openapi_ruby_sdk/models/check_payment_attributes.rb', line 18

def created_at
  @created_at
end

#delivery_statusObject

Returns the value of attribute delivery_status.



30
31
32
# File 'lib/unit_openapi_ruby_sdk/models/check_payment_attributes.rb', line 30

def delivery_status
  @delivery_status
end

#descriptionObject

Returns the value of attribute description.



50
51
52
# File 'lib/unit_openapi_ruby_sdk/models/check_payment_attributes.rb', line 50

def description
  @description
end

#expected_deliveryObject

Returns the value of attribute expected_delivery.



40
41
42
# File 'lib/unit_openapi_ruby_sdk/models/check_payment_attributes.rb', line 40

def expected_delivery
  @expected_delivery
end

#expiration_dateObject

Returns the value of attribute expiration_date.



44
45
46
# File 'lib/unit_openapi_ruby_sdk/models/check_payment_attributes.rb', line 44

def expiration_date
  @expiration_date
end

#memoObject

Returns the value of attribute memo.



28
29
30
# File 'lib/unit_openapi_ruby_sdk/models/check_payment_attributes.rb', line 28

def memo
  @memo
end

#on_usObject

Returns the value of attribute on_us.



60
61
62
# File 'lib/unit_openapi_ruby_sdk/models/check_payment_attributes.rb', line 60

def on_us
  @on_us
end

#on_us_auxiliaryObject

Returns the value of attribute on_us_auxiliary.



58
59
60
# File 'lib/unit_openapi_ruby_sdk/models/check_payment_attributes.rb', line 58

def on_us_auxiliary
  @on_us_auxiliary
end

#originatedObject

Returns the value of attribute originated.



42
43
44
# File 'lib/unit_openapi_ruby_sdk/models/check_payment_attributes.rb', line 42

def originated
  @originated
end

#pending_review_reasonsObject

Returns the value of attribute pending_review_reasons.



54
55
56
# File 'lib/unit_openapi_ruby_sdk/models/check_payment_attributes.rb', line 54

def pending_review_reasons
  @pending_review_reasons
end

#postal_codeObject

Returns the value of attribute postal_code.



38
39
40
# File 'lib/unit_openapi_ruby_sdk/models/check_payment_attributes.rb', line 38

def postal_code
  @postal_code
end

#reject_reasonObject

Returns the value of attribute reject_reason.



46
47
48
# File 'lib/unit_openapi_ruby_sdk/models/check_payment_attributes.rb', line 46

def reject_reason
  @reject_reason
end

#return_cutoff_timeObject

Returns the value of attribute return_cutoff_time.



24
25
26
# File 'lib/unit_openapi_ruby_sdk/models/check_payment_attributes.rb', line 24

def return_cutoff_time
  @return_cutoff_time
end

#return_reasonObject

Returns the value of attribute return_reason.



52
53
54
# File 'lib/unit_openapi_ruby_sdk/models/check_payment_attributes.rb', line 52

def return_reason
  @return_reason
end

#send_atObject

Returns the value of attribute send_at.



32
33
34
# File 'lib/unit_openapi_ruby_sdk/models/check_payment_attributes.rb', line 32

def send_at
  @send_at
end

#statusObject

Returns the value of attribute status.



26
27
28
# File 'lib/unit_openapi_ruby_sdk/models/check_payment_attributes.rb', line 26

def status
  @status
end

#tagsObject

Returns the value of attribute tags.



48
49
50
# File 'lib/unit_openapi_ruby_sdk/models/check_payment_attributes.rb', line 48

def tags
  @tags
end

#tracked_atObject

Returns the value of attribute tracked_at.



36
37
38
# File 'lib/unit_openapi_ruby_sdk/models/check_payment_attributes.rb', line 36

def tracked_at
  @tracked_at
end

#updated_atObject

Returns the value of attribute updated_at.



20
21
22
# File 'lib/unit_openapi_ruby_sdk/models/check_payment_attributes.rb', line 20

def updated_at
  @updated_at
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



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
506
# File 'lib/unit_openapi_ruby_sdk/models/check_payment_attributes.rb', line 469

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 = UnitOpenapiRubySdk.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



119
120
121
# File 'lib/unit_openapi_ruby_sdk/models/check_payment_attributes.rb', line 119

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

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



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# File 'lib/unit_openapi_ruby_sdk/models/check_payment_attributes.rb', line 89

def self.attribute_map
  {
    :'created_at' => :'createdAt',
    :'updated_at' => :'updatedAt',
    :'amount' => :'amount',
    :'return_cutoff_time' => :'returnCutoffTime',
    :'status' => :'status',
    :'memo' => :'memo',
    :'delivery_status' => :'deliveryStatus',
    :'send_at' => :'sendAt',
    :'counterparty' => :'counterparty',
    :'tracked_at' => :'trackedAt',
    :'postal_code' => :'postalCode',
    :'expected_delivery' => :'expectedDelivery',
    :'originated' => :'originated',
    :'expiration_date' => :'expirationDate',
    :'reject_reason' => :'rejectReason',
    :'tags' => :'tags',
    :'description' => :'description',
    :'return_reason' => :'returnReason',
    :'pending_review_reasons' => :'pendingReviewReasons',
    :'check_number' => :'checkNumber',
    :'on_us_auxiliary' => :'onUsAuxiliary',
    :'on_us' => :'onUs',
    :'counterparty_routing_number' => :'counterpartyRoutingNumber',
    :'additional_verification_status' => :'additionalVerificationStatus'
  }
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



445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
# File 'lib/unit_openapi_ruby_sdk/models/check_payment_attributes.rb', line 445

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



154
155
156
157
# File 'lib/unit_openapi_ruby_sdk/models/check_payment_attributes.rb', line 154

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

.openapi_typesObject

Attribute type mapping.



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
149
150
151
# File 'lib/unit_openapi_ruby_sdk/models/check_payment_attributes.rb', line 124

def self.openapi_types
  {
    :'created_at' => :'Time',
    :'updated_at' => :'Time',
    :'amount' => :'Integer',
    :'return_cutoff_time' => :'Time',
    :'status' => :'String',
    :'memo' => :'String',
    :'delivery_status' => :'String',
    :'send_at' => :'Time',
    :'counterparty' => :'CheckPaymentCounterparty',
    :'tracked_at' => :'Time',
    :'postal_code' => :'String',
    :'expected_delivery' => :'Date',
    :'originated' => :'Boolean',
    :'expiration_date' => :'Date',
    :'reject_reason' => :'String',
    :'tags' => :'Hash<String, String>',
    :'description' => :'String',
    :'return_reason' => :'ReturnReason',
    :'pending_review_reasons' => :'Array<String>',
    :'check_number' => :'String',
    :'on_us_auxiliary' => :'String',
    :'on_us' => :'String',
    :'counterparty_routing_number' => :'String',
    :'additional_verification_status' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



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
428
# File 'lib/unit_openapi_ruby_sdk/models/check_payment_attributes.rb', line 401

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      created_at == o.created_at &&
      updated_at == o.updated_at &&
      amount == o.amount &&
      return_cutoff_time == o.return_cutoff_time &&
      status == o.status &&
      memo == o.memo &&
      delivery_status == o.delivery_status &&
      send_at == o.send_at &&
      counterparty == o.counterparty &&
      tracked_at == o.tracked_at &&
      postal_code == o.postal_code &&
      expected_delivery == o.expected_delivery &&
      originated == o.originated &&
      expiration_date == o.expiration_date &&
      reject_reason == o.reject_reason &&
      tags == o.tags &&
      description == o.description &&
      return_reason == o.return_reason &&
      pending_review_reasons == o.pending_review_reasons &&
      check_number == o.check_number &&
      on_us_auxiliary == o.on_us_auxiliary &&
      on_us == o.on_us &&
      counterparty_routing_number == o.counterparty_routing_number &&
      additional_verification_status == o.additional_verification_status
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



540
541
542
543
544
545
546
547
548
549
550
551
552
# File 'lib/unit_openapi_ruby_sdk/models/check_payment_attributes.rb', line 540

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


432
433
434
# File 'lib/unit_openapi_ruby_sdk/models/check_payment_attributes.rb', line 432

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



438
439
440
# File 'lib/unit_openapi_ruby_sdk/models/check_payment_attributes.rb', line 438

def hash
  [created_at, updated_at, amount, return_cutoff_time, status, memo, delivery_status, send_at, counterparty, tracked_at, postal_code, expected_delivery, originated, expiration_date, reject_reason, tags, description, return_reason, pending_review_reasons, check_number, on_us_auxiliary, on_us, counterparty_routing_number, additional_verification_status].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



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
# File 'lib/unit_openapi_ruby_sdk/models/check_payment_attributes.rb', line 287

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  if @created_at.nil?
    invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
  end

  if @updated_at.nil?
    invalid_properties.push('invalid value for "updated_at", updated_at cannot be nil.')
  end

  if @amount.nil?
    invalid_properties.push('invalid value for "amount", amount cannot be nil.')
  end

  if @amount < 1
    invalid_properties.push('invalid value for "amount", must be greater than or equal to 1.')
  end

  if @status.nil?
    invalid_properties.push('invalid value for "status", status cannot be nil.')
  end

  if @originated.nil?
    invalid_properties.push('invalid value for "originated", originated cannot be nil.')
  end

  if !@tags.nil? && @tags.length > 15
    invalid_properties.push('invalid value for "tags", number of items must be less than or equal to 15.')
  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



516
517
518
# File 'lib/unit_openapi_ruby_sdk/models/check_payment_attributes.rb', line 516

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



522
523
524
525
526
527
528
529
530
531
532
533
534
# File 'lib/unit_openapi_ruby_sdk/models/check_payment_attributes.rb', line 522

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



510
511
512
# File 'lib/unit_openapi_ruby_sdk/models/check_payment_attributes.rb', line 510

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



323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
# File 'lib/unit_openapi_ruby_sdk/models/check_payment_attributes.rb', line 323

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @created_at.nil?
  return false if @updated_at.nil?
  return false if @amount.nil?
  return false if @amount < 1
  return false if @status.nil?
  status_validator = EnumAttributeValidator.new('String', ["MarkedForReturn", "Returned", "Processed", "PendingReview"])
  return false unless status_validator.valid?(@status)
  delivery_status_validator = EnumAttributeValidator.new('String', ["Mailed", "InLocalArea", "Delivered", "Rerouted", "ReturnedToSender"])
  return false unless delivery_status_validator.valid?(@delivery_status)
  return false if @originated.nil?
  return false if !@tags.nil? && @tags.length > 15
  additional_verification_status_validator = EnumAttributeValidator.new('String', ["Required", "NotRequired", "Approved"])
  return false unless additional_verification_status_validator.valid?(@additional_verification_status)
  true
end