Class: AdvancedBilling::PaymentMethodBankAccount

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/advanced_billing/models/payment_method_bank_account.rb

Overview

PaymentMethodBankAccount Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(masked_account_number:, masked_routing_number:, type:, additional_properties: {}) ⇒ PaymentMethodBankAccount

Returns a new instance of PaymentMethodBankAccount.



43
44
45
46
47
48
49
50
51
52
53
# File 'lib/advanced_billing/models/payment_method_bank_account.rb', line 43

def initialize(masked_account_number:, masked_routing_number:, type:,
               additional_properties: {})
  @masked_account_number = 
  @masked_routing_number = masked_routing_number
  @type = type

  # Add additional model properties to the instance.
  additional_properties.each do |_name, _value|
    instance_variable_set("@#{_name}", _value)
  end
end

Instance Attribute Details

#masked_account_numberString

TODO: Write general description for this method

Returns:

  • (String)


14
15
16
# File 'lib/advanced_billing/models/payment_method_bank_account.rb', line 14

def 
  @masked_account_number
end

#masked_routing_numberString

TODO: Write general description for this method

Returns:

  • (String)


18
19
20
# File 'lib/advanced_billing/models/payment_method_bank_account.rb', line 18

def masked_routing_number
  @masked_routing_number
end

#typeInvoiceEventPaymentMethod

TODO: Write general description for this method



22
23
24
# File 'lib/advanced_billing/models/payment_method_bank_account.rb', line 22

def type
  @type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/advanced_billing/models/payment_method_bank_account.rb', line 56

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
   =
    hash.key?('masked_account_number') ? hash['masked_account_number'] : nil
  masked_routing_number =
    hash.key?('masked_routing_number') ? hash['masked_routing_number'] : nil
  type = hash.key?('type') ? hash['type'] : nil

  # Clean out expected properties from Hash.
  names.each_value { |k| hash.delete(k) }

  # Create object from extracted values.
  PaymentMethodBankAccount.new(masked_account_number: ,
                               masked_routing_number: masked_routing_number,
                               type: type,
                               additional_properties: hash)
end

.namesObject

A mapping from model property names to API property names.



25
26
27
28
29
30
31
# File 'lib/advanced_billing/models/payment_method_bank_account.rb', line 25

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['masked_account_number'] = 'masked_account_number'
  @_hash['masked_routing_number'] = 'masked_routing_number'
  @_hash['type'] = 'type'
  @_hash
end

.nullablesObject

An array for nullable fields



39
40
41
# File 'lib/advanced_billing/models/payment_method_bank_account.rb', line 39

def self.nullables
  []
end

.optionalsObject

An array for optional fields



34
35
36
# File 'lib/advanced_billing/models/payment_method_bank_account.rb', line 34

def self.optionals
  []
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/advanced_billing/models/payment_method_bank_account.rb', line 78

def self.validate(value)
  if value.instance_of? self
    return (
      APIHelper.valid_type?(value.,
                            ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.masked_routing_number,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.type,
                              ->(val) { InvoiceEventPaymentMethod.validate(val) })
    )
  end

  return false unless value.instance_of? Hash

  (
    APIHelper.valid_type?(value['masked_account_number'],
                          ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['masked_routing_number'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['type'],
                            ->(val) { InvoiceEventPaymentMethod.validate(val) })
  )
end