Class: AdvancedBilling::SubscriptionGroupBankAccount

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

Overview

SubscriptionGroupBankAccount Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(bank_name: SKIP, bank_account_number: SKIP, bank_routing_number: SKIP, bank_iban: SKIP, bank_branch_code: SKIP, bank_account_type: SKIP, bank_account_holder_type: SKIP, payment_type: SKIP, billing_address: SKIP, billing_city: SKIP, billing_state: SKIP, billing_zip: SKIP, billing_country: SKIP, chargify_token: SKIP, current_vault: SKIP, gateway_handle: SKIP, additional_properties: {}) ⇒ SubscriptionGroupBankAccount

Returns a new instance of SubscriptionGroupBankAccount.



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

def initialize(bank_name: SKIP, bank_account_number: SKIP,
               bank_routing_number: SKIP, bank_iban: SKIP,
               bank_branch_code: SKIP, bank_account_type: SKIP,
               bank_account_holder_type: SKIP, payment_type: SKIP,
               billing_address: SKIP, billing_city: SKIP,
               billing_state: SKIP, billing_zip: SKIP,
               billing_country: SKIP, chargify_token: SKIP,
               current_vault: SKIP, gateway_handle: SKIP,
               additional_properties: {})
  @bank_name = bank_name unless bank_name == SKIP
  @bank_account_number =  unless  == SKIP
  @bank_routing_number = bank_routing_number unless bank_routing_number == SKIP
  @bank_iban = bank_iban unless bank_iban == SKIP
  @bank_branch_code = bank_branch_code unless bank_branch_code == SKIP
  @bank_account_type =  unless  == SKIP
  @bank_account_holder_type =  unless  == SKIP
  @payment_type = payment_type unless payment_type == SKIP
  @billing_address = billing_address unless billing_address == SKIP
  @billing_city = billing_city unless billing_city == SKIP
  @billing_state = billing_state unless billing_state == SKIP
  @billing_zip = billing_zip unless billing_zip == SKIP
  @billing_country = billing_country unless billing_country == SKIP
  @chargify_token = chargify_token unless chargify_token == SKIP
  @current_vault = current_vault unless current_vault == SKIP
  @gateway_handle = gateway_handle unless gateway_handle == SKIP

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

Instance Attribute Details

#bank_account_holder_typeBankAccountHolderType

Defaults to personal



45
46
47
# File 'lib/advanced_billing/models/subscription_group_bank_account.rb', line 45

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)


21
22
23
# File 'lib/advanced_billing/models/subscription_group_bank_account.rb', line 21

def 
  @bank_account_number
end

#bank_account_typeBankAccountType

Defaults to checking

Returns:



41
42
43
# File 'lib/advanced_billing/models/subscription_group_bank_account.rb', line 41

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)


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

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)


32
33
34
# File 'lib/advanced_billing/models/subscription_group_bank_account.rb', line 32

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)


15
16
17
# File 'lib/advanced_billing/models/subscription_group_bank_account.rb', line 15

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)


27
28
29
# File 'lib/advanced_billing/models/subscription_group_bank_account.rb', line 27

def bank_routing_number
  @bank_routing_number
end

#billing_addressString

Defaults to personal

Returns:

  • (String)


53
54
55
# File 'lib/advanced_billing/models/subscription_group_bank_account.rb', line 53

def billing_address
  @billing_address
end

#billing_cityString

Defaults to personal

Returns:

  • (String)


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

def billing_city
  @billing_city
end

#billing_countryString

Defaults to personal

Returns:

  • (String)


69
70
71
# File 'lib/advanced_billing/models/subscription_group_bank_account.rb', line 69

def billing_country
  @billing_country
end

#billing_stateString

Defaults to personal

Returns:

  • (String)


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

def billing_state
  @billing_state
end

#billing_zipString

Defaults to personal

Returns:

  • (String)


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

def billing_zip
  @billing_zip
end

#chargify_tokenString

Defaults to personal

Returns:

  • (String)


73
74
75
# File 'lib/advanced_billing/models/subscription_group_bank_account.rb', line 73

def chargify_token
  @chargify_token
end

#current_vaultBankAccountVault

The vault that stores the payment profile with the provided vault_token. Use ‘bogus` for testing.

Returns:



78
79
80
# File 'lib/advanced_billing/models/subscription_group_bank_account.rb', line 78

def current_vault
  @current_vault
end

#gateway_handleString

The vault that stores the payment profile with the provided vault_token. Use ‘bogus` for testing.

Returns:

  • (String)


83
84
85
# File 'lib/advanced_billing/models/subscription_group_bank_account.rb', line 83

def gateway_handle
  @gateway_handle
end

#payment_typePaymentType

Defaults to personal

Returns:



49
50
51
# File 'lib/advanced_billing/models/subscription_group_bank_account.rb', line 49

def payment_type
  @payment_type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  bank_name = hash.key?('bank_name') ? hash['bank_name'] : SKIP
   =
    hash.key?('bank_account_number') ? hash['bank_account_number'] : SKIP
  bank_routing_number =
    hash.key?('bank_routing_number') ? hash['bank_routing_number'] : SKIP
  bank_iban = hash.key?('bank_iban') ? hash['bank_iban'] : SKIP
  bank_branch_code =
    hash.key?('bank_branch_code') ? hash['bank_branch_code'] : SKIP
   =
    hash.key?('bank_account_type') ? hash['bank_account_type'] : SKIP
   =
    hash.key?('bank_account_holder_type') ? hash['bank_account_holder_type'] : SKIP
  payment_type = hash.key?('payment_type') ? hash['payment_type'] : SKIP
  billing_address =
    hash.key?('billing_address') ? hash['billing_address'] : SKIP
  billing_city = hash.key?('billing_city') ? hash['billing_city'] : SKIP
  billing_state = hash.key?('billing_state') ? hash['billing_state'] : SKIP
  billing_zip = hash.key?('billing_zip') ? hash['billing_zip'] : SKIP
  billing_country =
    hash.key?('billing_country') ? hash['billing_country'] : SKIP
  chargify_token =
    hash.key?('chargify_token') ? hash['chargify_token'] : SKIP
  current_vault = hash.key?('current_vault') ? hash['current_vault'] : SKIP
  gateway_handle =
    hash.key?('gateway_handle') ? hash['gateway_handle'] : SKIP

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

  # Create object from extracted values.
  SubscriptionGroupBankAccount.new(bank_name: bank_name,
                                   bank_account_number: ,
                                   bank_routing_number: bank_routing_number,
                                   bank_iban: bank_iban,
                                   bank_branch_code: bank_branch_code,
                                   bank_account_type: ,
                                   bank_account_holder_type: ,
                                   payment_type: payment_type,
                                   billing_address: billing_address,
                                   billing_city: billing_city,
                                   billing_state: billing_state,
                                   billing_zip: billing_zip,
                                   billing_country: billing_country,
                                   chargify_token: chargify_token,
                                   current_vault: current_vault,
                                   gateway_handle: gateway_handle,
                                   additional_properties: hash)
end

.namesObject

A mapping from model property names to API property names.



86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/advanced_billing/models/subscription_group_bank_account.rb', line 86

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['bank_name'] = 'bank_name'
  @_hash['bank_account_number'] = 'bank_account_number'
  @_hash['bank_routing_number'] = 'bank_routing_number'
  @_hash['bank_iban'] = 'bank_iban'
  @_hash['bank_branch_code'] = 'bank_branch_code'
  @_hash['bank_account_type'] = 'bank_account_type'
  @_hash['bank_account_holder_type'] = 'bank_account_holder_type'
  @_hash['payment_type'] = 'payment_type'
  @_hash['billing_address'] = 'billing_address'
  @_hash['billing_city'] = 'billing_city'
  @_hash['billing_state'] = 'billing_state'
  @_hash['billing_zip'] = 'billing_zip'
  @_hash['billing_country'] = 'billing_country'
  @_hash['chargify_token'] = 'chargify_token'
  @_hash['current_vault'] = 'current_vault'
  @_hash['gateway_handle'] = 'gateway_handle'
  @_hash
end

.nullablesObject

An array for nullable fields



130
131
132
# File 'lib/advanced_billing/models/subscription_group_bank_account.rb', line 130

def self.nullables
  []
end

.optionalsObject

An array for optional fields



108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/advanced_billing/models/subscription_group_bank_account.rb', line 108

def self.optionals
  %w[
    bank_name
    bank_account_number
    bank_routing_number
    bank_iban
    bank_branch_code
    bank_account_type
    bank_account_holder_type
    payment_type
    billing_address
    billing_city
    billing_state
    billing_zip
    billing_country
    chargify_token
    current_vault
    gateway_handle
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



222
223
224
225
226
227
228
# File 'lib/advanced_billing/models/subscription_group_bank_account.rb', line 222

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

  return false unless value.instance_of? Hash

  true
end