Class: AdvancedBilling::BankAccountAttributes

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

Overview

BankAccountAttributes Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(chargify_token = SKIP, bank_name = SKIP, bank_routing_number = SKIP, bank_account_number = SKIP, bank_account_type = SKIP, bank_branch_code = SKIP, bank_iban = SKIP, bank_account_holder_type = SKIP, payment_type = SKIP, current_vault = SKIP, vault_token = SKIP, customer_vault_token = SKIP) ⇒ BankAccountAttributes

Returns a new instance of BankAccountAttributes.



113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# File 'lib/advanced_billing/models/bank_account_attributes.rb', line 113

def initialize(chargify_token = SKIP, bank_name = SKIP,
               bank_routing_number = SKIP,  = SKIP,
                = SKIP, bank_branch_code = SKIP,
               bank_iban = SKIP,  = SKIP,
               payment_type = SKIP, current_vault = SKIP,
               vault_token = SKIP, customer_vault_token = SKIP)
  @chargify_token = chargify_token unless chargify_token == SKIP
  @bank_name = bank_name unless bank_name == SKIP
  @bank_routing_number = bank_routing_number unless bank_routing_number == SKIP
  @bank_account_number =  unless  == SKIP
  @bank_account_type =  unless  == SKIP
  @bank_branch_code = bank_branch_code unless bank_branch_code == SKIP
  @bank_iban = bank_iban unless bank_iban == SKIP
  @bank_account_holder_type =  unless  == SKIP
  @payment_type = payment_type unless payment_type == SKIP
  @current_vault = current_vault unless current_vault == SKIP
  @vault_token = vault_token unless vault_token == SKIP
  @customer_vault_token = customer_vault_token unless customer_vault_token == SKIP
end

Instance Attribute Details

#bank_account_holder_typeString

(Optional when creating a subscription with GoCardless). International Bank Account Number. Alternatively, local bank details can be provided

Returns:

  • (String)


52
53
54
# File 'lib/advanced_billing/models/bank_account_attributes.rb', line 52

def 
  @bank_account_holder_type
end

#bank_account_numberString

(Required when creating a subscription with ACH. Required when creating a subscription with GoCardless and bank_iban is blank) The customerʼs bank account number

Returns:

  • (String)


31
32
33
# File 'lib/advanced_billing/models/bank_account_attributes.rb', line 31

def 
  @bank_account_number
end

#bank_account_typeString

(Required when creating a subscription with ACH. Required when creating a subscription with GoCardless and bank_iban is blank) The customerʼs bank account number

Returns:

  • (String)


37
38
39
# File 'lib/advanced_billing/models/bank_account_attributes.rb', line 37

def 
  @bank_account_type
end

#bank_branch_codeString

(Optional when creating a subscription with GoCardless) Branch code. Alternatively, an IBAN can be provided

Returns:

  • (String)


42
43
44
# File 'lib/advanced_billing/models/bank_account_attributes.rb', line 42

def bank_branch_code
  @bank_branch_code
end

#bank_ibanString

(Optional when creating a subscription with GoCardless). International Bank Account Number. Alternatively, local bank details can be provided

Returns:

  • (String)


47
48
49
# File 'lib/advanced_billing/models/bank_account_attributes.rb', line 47

def bank_iban
  @bank_iban
end

#bank_nameString

(Required when creating a subscription with ACH or GoCardless) The name of the bank where the customer’s account resides

Returns:

  • (String)


19
20
21
# File 'lib/advanced_billing/models/bank_account_attributes.rb', line 19

def bank_name
  @bank_name
end

#bank_routing_numberString

(Required when creating a subscription with ACH. Optional when creating a subscription with GoCardless). The routing number of the bank. It becomes bank_code while passing via GoCardless API

Returns:

  • (String)


25
26
27
# File 'lib/advanced_billing/models/bank_account_attributes.rb', line 25

def bank_routing_number
  @bank_routing_number
end

#chargify_tokenString

TODO: Write general description for this method

Returns:

  • (String)


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

def chargify_token
  @chargify_token
end

#current_vaultBankAccountVault

The vault that stores the payment profile with the provided vault_token.

Returns:



61
62
63
# File 'lib/advanced_billing/models/bank_account_attributes.rb', line 61

def current_vault
  @current_vault
end

#customer_vault_tokenString

(only for Authorize.Net CIM storage or Square) The customerProfileId for the owner of the customerPaymentProfileId provided as the vault_token

Returns:

  • (String)


70
71
72
# File 'lib/advanced_billing/models/bank_account_attributes.rb', line 70

def customer_vault_token
  @customer_vault_token
end

#payment_typeString

(Optional when creating a subscription with GoCardless). International Bank Account Number. Alternatively, local bank details can be provided

Returns:

  • (String)


57
58
59
# File 'lib/advanced_billing/models/bank_account_attributes.rb', line 57

def payment_type
  @payment_type
end

#vault_tokenString

The vault that stores the payment profile with the provided vault_token.

Returns:

  • (String)


65
66
67
# File 'lib/advanced_billing/models/bank_account_attributes.rb', line 65

def vault_token
  @vault_token
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
# File 'lib/advanced_billing/models/bank_account_attributes.rb', line 134

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  chargify_token =
    hash.key?('chargify_token') ? hash['chargify_token'] : SKIP
  bank_name = hash.key?('bank_name') ? hash['bank_name'] : SKIP
  bank_routing_number =
    hash.key?('bank_routing_number') ? hash['bank_routing_number'] : SKIP
   =
    hash.key?('bank_account_number') ? hash['bank_account_number'] : SKIP
   =
    hash.key?('bank_account_type') ? hash['bank_account_type'] : SKIP
  bank_branch_code =
    hash.key?('bank_branch_code') ? hash['bank_branch_code'] : SKIP
  bank_iban = hash.key?('bank_iban') ? hash['bank_iban'] : SKIP
   =
    hash.key?('bank_account_holder_type') ? hash['bank_account_holder_type'] : SKIP
  payment_type = hash.key?('payment_type') ? hash['payment_type'] : SKIP
  current_vault = hash.key?('current_vault') ? hash['current_vault'] : SKIP
  vault_token = hash.key?('vault_token') ? hash['vault_token'] : SKIP
  customer_vault_token =
    hash.key?('customer_vault_token') ? hash['customer_vault_token'] : SKIP

  # Create object from extracted values.
  BankAccountAttributes.new(chargify_token,
                            bank_name,
                            bank_routing_number,
                            ,
                            ,
                            bank_branch_code,
                            bank_iban,
                            ,
                            payment_type,
                            current_vault,
                            vault_token,
                            customer_vault_token)
end

.namesObject

A mapping from model property names to API property names.



73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/advanced_billing/models/bank_account_attributes.rb', line 73

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['chargify_token'] = 'chargify_token'
  @_hash['bank_name'] = 'bank_name'
  @_hash['bank_routing_number'] = 'bank_routing_number'
  @_hash['bank_account_number'] = 'bank_account_number'
  @_hash['bank_account_type'] = 'bank_account_type'
  @_hash['bank_branch_code'] = 'bank_branch_code'
  @_hash['bank_iban'] = 'bank_iban'
  @_hash['bank_account_holder_type'] = 'bank_account_holder_type'
  @_hash['payment_type'] = 'payment_type'
  @_hash['current_vault'] = 'current_vault'
  @_hash['vault_token'] = 'vault_token'
  @_hash['customer_vault_token'] = 'customer_vault_token'
  @_hash
end

.nullablesObject

An array for nullable fields



109
110
111
# File 'lib/advanced_billing/models/bank_account_attributes.rb', line 109

def self.nullables
  []
end

.optionalsObject

An array for optional fields



91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/advanced_billing/models/bank_account_attributes.rb', line 91

def self.optionals
  %w[
    chargify_token
    bank_name
    bank_routing_number
    bank_account_number
    bank_account_type
    bank_branch_code
    bank_iban
    bank_account_holder_type
    payment_type
    current_vault
    vault_token
    customer_vault_token
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



175
176
177
178
179
180
181
# File 'lib/advanced_billing/models/bank_account_attributes.rb', line 175

def self.validate(value)
  return true if value.instance_of? self

  return false unless value.instance_of? Hash

  true
end