Class: Tremendous::ListFundingSources200ResponseFundingSourcesInnerMeta

Inherits:
Object
  • Object
show all
Defined in:
lib/tremendous/models/list_funding_sources200_response_funding_sources_inner_meta.rb

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ ListFundingSources200ResponseFundingSourcesInnerMeta

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
152
153
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
184
185
186
187
# File 'lib/tremendous/models/list_funding_sources200_response_funding_sources_inner_meta.rb', line 127

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::ListFundingSources200ResponseFundingSourcesInnerMeta` 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 `Tremendous::ListFundingSources200ResponseFundingSourcesInnerMeta`. 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?(:'available_cents')
    self.available_cents = attributes[:'available_cents']
  end

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#account_number_maskObject

**Only available when ‘method` is set to `bank_account`.** Last 4 digits of the account number



34
35
36
# File 'lib/tremendous/models/list_funding_sources200_response_funding_sources_inner_meta.rb', line 34

def 
  @account_number_mask
end

#account_routing_maskObject

**Only available when ‘method` is set to `bank_account`.** Last 4 digits of the routing number



37
38
39
# File 'lib/tremendous/models/list_funding_sources200_response_funding_sources_inner_meta.rb', line 37

def 
  @account_routing_mask
end

#account_typeObject

**Only available when ‘method` is set to `bank_account`.** Is this a checking or savings account



28
29
30
# File 'lib/tremendous/models/list_funding_sources200_response_funding_sources_inner_meta.rb', line 28

def 
  @account_type
end

#accountholder_nameObject

**Only available when ‘method` is set to `bank_account` or `credit_card`.** Name of the holder of the bank account or credit_card



25
26
27
# File 'lib/tremendous/models/list_funding_sources200_response_funding_sources_inner_meta.rb', line 25

def accountholder_name
  @accountholder_name
end

#available_centsObject

**Only available when ‘method` is set to `balance`.** Available amount for this funding source (in Cents USD)



19
20
21
# File 'lib/tremendous/models/list_funding_sources200_response_funding_sources_inner_meta.rb', line 19

def available_cents
  @available_cents
end

#bank_nameObject

**Only available when ‘method` is set to `bank_account`.** Name of the bank



31
32
33
# File 'lib/tremendous/models/list_funding_sources200_response_funding_sources_inner_meta.rb', line 31

def bank_name
  @bank_name
end

#expiredObject

**Only available when ‘method` is set to `credit_card`.** Is this credit card expired



49
50
51
# File 'lib/tremendous/models/list_funding_sources200_response_funding_sources_inner_meta.rb', line 49

def expired
  @expired
end

#last4Object

**Only available when ‘method` is set to `credit_card`.** Last 4 digits of the credit card number



46
47
48
# File 'lib/tremendous/models/list_funding_sources200_response_funding_sources_inner_meta.rb', line 46

def last4
  @last4
end

#last_payment_failed_atObject

**Only available when ‘method` is set to `bank_account` or `credit_card`.** Point in time when the last order failed using this bank account or credit card as a funding source.



52
53
54
# File 'lib/tremendous/models/list_funding_sources200_response_funding_sources_inner_meta.rb', line 52

def last_payment_failed_at
  @last_payment_failed_at
end

#networkObject

**Only available when ‘method` is set to `credit_card`.** Network of the credit card



43
44
45
# File 'lib/tremendous/models/list_funding_sources200_response_funding_sources_inner_meta.rb', line 43

def network
  @network
end

#pending_centsObject

**Only available when ‘method` is set to `balance`.** Funds that are already registered on your Tremendous account but which have not yet been deposited in your account (e.g. unpaid invoices) (in Cents USD).



22
23
24
# File 'lib/tremendous/models/list_funding_sources200_response_funding_sources_inner_meta.rb', line 22

def pending_cents
  @pending_cents
end

#refundableObject

**Only available when ‘method` is set to `bank_account`.** Can refunds be deposited to this bank account



40
41
42
# File 'lib/tremendous/models/list_funding_sources200_response_funding_sources_inner_meta.rb', line 40

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



349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
# File 'lib/tremendous/models/list_funding_sources200_response_funding_sources_inner_meta.rb', line 349

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



95
96
97
# File 'lib/tremendous/models/list_funding_sources200_response_funding_sources_inner_meta.rb', line 95

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

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



77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/tremendous/models/list_funding_sources200_response_funding_sources_inner_meta.rb', line 77

def self.attribute_map
  {
    :'available_cents' => :'available_cents',
    :'pending_cents' => :'pending_cents',
    :'accountholder_name' => :'accountholder_name',
    :'account_type' => :'account_type',
    :'bank_name' => :'bank_name',
    :'account_number_mask' => :'account_number_mask',
    :'account_routing_mask' => :'account_routing_mask',
    :'refundable' => :'refundable',
    :'network' => :'network',
    :'last4' => :'last4',
    :'expired' => :'expired',
    :'last_payment_failed_at' => :'last_payment_failed_at'
  }
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



325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
# File 'lib/tremendous/models/list_funding_sources200_response_funding_sources_inner_meta.rb', line 325

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



118
119
120
121
122
123
# File 'lib/tremendous/models/list_funding_sources200_response_funding_sources_inner_meta.rb', line 118

def self.openapi_nullable
  Set.new([
    :'bank_name',
    :'last_payment_failed_at'
  ])
end

.openapi_typesObject

Attribute type mapping.



100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/tremendous/models/list_funding_sources200_response_funding_sources_inner_meta.rb', line 100

def self.openapi_types
  {
    :'available_cents' => :'Integer',
    :'pending_cents' => :'Integer',
    :'accountholder_name' => :'String',
    :'account_type' => :'String',
    :'bank_name' => :'String',
    :'account_number_mask' => :'String',
    :'account_routing_mask' => :'String',
    :'refundable' => :'Boolean',
    :'network' => :'String',
    :'last4' => :'String',
    :'expired' => :'Boolean',
    :'last_payment_failed_at' => :'Time'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
# File 'lib/tremendous/models/list_funding_sources200_response_funding_sources_inner_meta.rb', line 293

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      available_cents == o.available_cents &&
      pending_cents == o.pending_cents &&
      accountholder_name == o.accountholder_name &&
       == o. &&
      bank_name == o.bank_name &&
       == o. &&
       == o. &&
      refundable == o.refundable &&
      network == o.network &&
      last4 == o.last4 &&
      expired == o.expired &&
      last_payment_failed_at == o.last_payment_failed_at
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



420
421
422
423
424
425
426
427
428
429
430
431
432
# File 'lib/tremendous/models/list_funding_sources200_response_funding_sources_inner_meta.rb', line 420

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


312
313
314
# File 'lib/tremendous/models/list_funding_sources200_response_funding_sources_inner_meta.rb', line 312

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



318
319
320
# File 'lib/tremendous/models/list_funding_sources200_response_funding_sources_inner_meta.rb', line 318

def hash
  [available_cents, pending_cents, accountholder_name, , bank_name, , , refundable, network, last4, expired, last_payment_failed_at].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
# File 'lib/tremendous/models/list_funding_sources200_response_funding_sources_inner_meta.rb', line 191

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  pattern = Regexp.new(/[0-9]{4}/)
  if !@account_number_mask.nil? && @account_number_mask !~ pattern
    invalid_properties.push("invalid value for \"account_number_mask\", must conform to the pattern #{pattern}.")
  end

  pattern = Regexp.new(/[0-9]{4}/)
  if !@account_routing_mask.nil? && @account_routing_mask !~ pattern
    invalid_properties.push("invalid value for \"account_routing_mask\", must conform to the pattern #{pattern}.")
  end

  pattern = Regexp.new(/[0-9]{4}/)
  if !@last4.nil? && @last4 !~ pattern
    invalid_properties.push("invalid value for \"last4\", must conform to the pattern #{pattern}.")
  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



396
397
398
# File 'lib/tremendous/models/list_funding_sources200_response_funding_sources_inner_meta.rb', line 396

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



402
403
404
405
406
407
408
409
410
411
412
413
414
# File 'lib/tremendous/models/list_funding_sources200_response_funding_sources_inner_meta.rb', line 402

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



390
391
392
# File 'lib/tremendous/models/list_funding_sources200_response_funding_sources_inner_meta.rb', line 390

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



214
215
216
217
218
219
220
221
222
223
224
# File 'lib/tremendous/models/list_funding_sources200_response_funding_sources_inner_meta.rb', line 214

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
   = EnumAttributeValidator.new('String', ["checking", "savings"])
  return false unless .valid?(@account_type)
  return false if !@account_number_mask.nil? && @account_number_mask !~ Regexp.new(/[0-9]{4}/)
  return false if !@account_routing_mask.nil? && @account_routing_mask !~ Regexp.new(/[0-9]{4}/)
  network_validator = EnumAttributeValidator.new('String', ["MasterCard", "Amex", "JCB", "Diner's Club", "visa", "discover", "laser", "elo", "maestro", "solo"])
  return false unless network_validator.valid?(@network)
  return false if !@last4.nil? && @last4 !~ Regexp.new(/[0-9]{4}/)
  true
end