Class: ModernTreasury::ExternalAccountCreateRequest

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/modern_treasury/models/external_account_create_request.rb

Overview

ExternalAccountCreateRequest Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(counterparty_id:, account_type: SKIP, party_type: SKIP, party_address: SKIP, name: SKIP, account_details: SKIP, routing_details: SKIP, metadata: SKIP, party_name: SKIP, party_identifier: SKIP, ledger_account: SKIP, plaid_processor_token: SKIP, contact_details: SKIP, additional_properties: nil) ⇒ ExternalAccountCreateRequest

Returns a new instance of ExternalAccountCreateRequest.



120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# File 'lib/modern_treasury/models/external_account_create_request.rb', line 120

def initialize(counterparty_id:, account_type: SKIP, party_type: SKIP,
               party_address: SKIP, name: SKIP, account_details: SKIP,
               routing_details: SKIP, metadata: SKIP, party_name: SKIP,
               party_identifier: SKIP, ledger_account: SKIP,
               plaid_processor_token: SKIP, contact_details: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @account_type =  unless  == SKIP
  @party_type = party_type unless party_type == SKIP
  @party_address = party_address unless party_address == SKIP
  @name = name unless name == SKIP
  @counterparty_id = counterparty_id
  @account_details =  unless  == SKIP
  @routing_details = routing_details unless routing_details == SKIP
  @metadata =  unless  == SKIP
  @party_name = party_name unless party_name == SKIP
  @party_identifier = party_identifier unless party_identifier == SKIP
  @ledger_account =  unless  == SKIP
  @plaid_processor_token = plaid_processor_token unless plaid_processor_token == SKIP
  @contact_details = contact_details unless contact_details == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#account_detailsArray[AccountDetail1]

A nickname for the external account. This is only for internal usage and won’t affect any payments

Returns:



37
38
39
# File 'lib/modern_treasury/models/external_account_create_request.rb', line 37

def 
  @account_details
end

#account_typeAccountType

Can be ‘checking`, `savings` or `other`.

Returns:



14
15
16
# File 'lib/modern_treasury/models/external_account_create_request.rb', line 14

def 
  @account_type
end

#contact_detailsArray[ContactDetailCreateRequest]

If you’ve enabled the Modern Treasury + Plaid integration in your Plaid account, you can pass the processor token in this field.

Returns:



72
73
74
# File 'lib/modern_treasury/models/external_account_create_request.rb', line 72

def contact_details
  @contact_details
end

#counterparty_idUUID | String

A nickname for the external account. This is only for internal usage and won’t affect any payments

Returns:

  • (UUID | String)


32
33
34
# File 'lib/modern_treasury/models/external_account_create_request.rb', line 32

def counterparty_id
  @counterparty_id
end

#ledger_accountLedgerAccountCreateRequest

If this value isn’t provided, it will be inherited from the counterparty’s name.



62
63
64
# File 'lib/modern_treasury/models/external_account_create_request.rb', line 62

def 
  @ledger_account
end

#metadataHash[String, String]

Additional data represented as key-value pairs. Both the key and value must be strings.

Returns:

  • (Hash[String, String])


47
48
49
# File 'lib/modern_treasury/models/external_account_create_request.rb', line 47

def 
  @metadata
end

#nameString

A nickname for the external account. This is only for internal usage and won’t affect any payments

Returns:

  • (String)


27
28
29
# File 'lib/modern_treasury/models/external_account_create_request.rb', line 27

def name
  @name
end

#party_addressAddressRequest

Either ‘individual` or `business`.

Returns:



22
23
24
# File 'lib/modern_treasury/models/external_account_create_request.rb', line 22

def party_address
  @party_address
end

#party_identifierString

If this value isn’t provided, it will be inherited from the counterparty’s name.

Returns:

  • (String)


57
58
59
# File 'lib/modern_treasury/models/external_account_create_request.rb', line 57

def party_identifier
  @party_identifier
end

#party_nameString

If this value isn’t provided, it will be inherited from the counterparty’s name.

Returns:

  • (String)


52
53
54
# File 'lib/modern_treasury/models/external_account_create_request.rb', line 52

def party_name
  @party_name
end

#party_typePartyType

Either ‘individual` or `business`.

Returns:



18
19
20
# File 'lib/modern_treasury/models/external_account_create_request.rb', line 18

def party_type
  @party_type
end

#plaid_processor_tokenString

If you’ve enabled the Modern Treasury + Plaid integration in your Plaid account, you can pass the processor token in this field.

Returns:

  • (String)


67
68
69
# File 'lib/modern_treasury/models/external_account_create_request.rb', line 67

def plaid_processor_token
  @plaid_processor_token
end

#routing_detailsArray[RoutingDetail1]

A nickname for the external account. This is only for internal usage and won’t affect any payments

Returns:



42
43
44
# File 'lib/modern_treasury/models/external_account_create_request.rb', line 42

def routing_details
  @routing_details
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
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
# File 'lib/modern_treasury/models/external_account_create_request.rb', line 146

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  counterparty_id =
    hash.key?('counterparty_id') ? hash['counterparty_id'] : nil
   = hash.key?('account_type') ? hash['account_type'] : SKIP
  party_type = hash.key?('party_type') ? hash['party_type'] : SKIP
  party_address = AddressRequest.from_hash(hash['party_address']) if hash['party_address']
  name = hash.key?('name') ? hash['name'] : SKIP
  # Parameter is an array, so we need to iterate through it
   = nil
  unless hash['account_details'].nil?
     = []
    hash['account_details'].each do |structure|
       << (AccountDetail1.from_hash(structure) if structure)
    end
  end

   = SKIP unless hash.key?('account_details')
  # Parameter is an array, so we need to iterate through it
  routing_details = nil
  unless hash['routing_details'].nil?
    routing_details = []
    hash['routing_details'].each do |structure|
      routing_details << (RoutingDetail1.from_hash(structure) if structure)
    end
  end

  routing_details = SKIP unless hash.key?('routing_details')
   = hash.key?('metadata') ? hash['metadata'] : SKIP
  party_name = hash.key?('party_name') ? hash['party_name'] : SKIP
  party_identifier =
    hash.key?('party_identifier') ? hash['party_identifier'] : SKIP
   = LedgerAccountCreateRequest.from_hash(hash['ledger_account']) if
    hash['ledger_account']
  plaid_processor_token =
    hash.key?('plaid_processor_token') ? hash['plaid_processor_token'] : SKIP
  # Parameter is an array, so we need to iterate through it
  contact_details = nil
  unless hash['contact_details'].nil?
    contact_details = []
    hash['contact_details'].each do |structure|
      contact_details << (ContactDetailCreateRequest.from_hash(structure) if structure)
    end
  end

  contact_details = SKIP unless hash.key?('contact_details')

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  ExternalAccountCreateRequest.new(counterparty_id: counterparty_id,
                                   account_type: ,
                                   party_type: party_type,
                                   party_address: party_address,
                                   name: name,
                                   account_details: ,
                                   routing_details: routing_details,
                                   metadata: ,
                                   party_name: party_name,
                                   party_identifier: party_identifier,
                                   ledger_account: ,
                                   plaid_processor_token: plaid_processor_token,
                                   contact_details: contact_details,
                                   additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/modern_treasury/models/external_account_create_request.rb', line 75

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['account_type'] = 'account_type'
  @_hash['party_type'] = 'party_type'
  @_hash['party_address'] = 'party_address'
  @_hash['name'] = 'name'
  @_hash['counterparty_id'] = 'counterparty_id'
  @_hash['account_details'] = 'account_details'
  @_hash['routing_details'] = 'routing_details'
  @_hash['metadata'] = 'metadata'
  @_hash['party_name'] = 'party_name'
  @_hash['party_identifier'] = 'party_identifier'
  @_hash['ledger_account'] = 'ledger_account'
  @_hash['plaid_processor_token'] = 'plaid_processor_token'
  @_hash['contact_details'] = 'contact_details'
  @_hash
end

.nullablesObject

An array for nullable fields



112
113
114
115
116
117
118
# File 'lib/modern_treasury/models/external_account_create_request.rb', line 112

def self.nullables
  %w[
    party_type
    name
    counterparty_id
  ]
end

.optionalsObject

An array for optional fields



94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/modern_treasury/models/external_account_create_request.rb', line 94

def self.optionals
  %w[
    account_type
    party_type
    party_address
    name
    account_details
    routing_details
    metadata
    party_name
    party_identifier
    ledger_account
    plaid_processor_token
    contact_details
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



231
232
233
234
235
236
237
238
239
240
241
# File 'lib/modern_treasury/models/external_account_create_request.rb', line 231

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} account_type: #{@account_type.inspect}, party_type: #{@party_type.inspect},"\
  " party_address: #{@party_address.inspect}, name: #{@name.inspect}, counterparty_id:"\
  " #{@counterparty_id.inspect}, account_details: #{@account_details.inspect},"\
  " routing_details: #{@routing_details.inspect}, metadata: #{@metadata.inspect}, party_name:"\
  " #{@party_name.inspect}, party_identifier: #{@party_identifier.inspect}, ledger_account:"\
  " #{@ledger_account.inspect}, plaid_processor_token: #{@plaid_processor_token.inspect},"\
  " contact_details: #{@contact_details.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



220
221
222
223
224
225
226
227
228
# File 'lib/modern_treasury/models/external_account_create_request.rb', line 220

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} account_type: #{@account_type}, party_type: #{@party_type}, party_address:"\
  " #{@party_address}, name: #{@name}, counterparty_id: #{@counterparty_id}, account_details:"\
  " #{@account_details}, routing_details: #{@routing_details}, metadata: #{@metadata},"\
  " party_name: #{@party_name}, party_identifier: #{@party_identifier}, ledger_account:"\
  " #{@ledger_account}, plaid_processor_token: #{@plaid_processor_token}, contact_details:"\
  " #{@contact_details}, additional_properties: #{@additional_properties}>"
end