Class: ModernTreasury::InternalAccount
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ModernTreasury::InternalAccount
- Defined in:
- lib/modern_treasury/models/internal_account.rb
Overview
InternalAccount Model.
Instance Attribute Summary collapse
-
#account_details ⇒ Array[AccountDetail]
An array of account detail objects.
-
#account_type ⇒ AccountType5
Can be checking, savings or other.
-
#connection ⇒ Connection
An array of routing detail objects.
-
#counterparty_id ⇒ UUID | String
The Counterparty associated to this account.
-
#created_at ⇒ DateTime
This field will be true if this object exists in the live environment or false if it exists in the test environment.
-
#currency ⇒ Currency
Three-letter ISO currency code.
-
#id ⇒ UUID | String
TODO: Write general description for this method.
-
#ledger_account_id ⇒ UUID | String
If the internal account links to a ledger account in Modern Treasury, the id of the ledger account will be populated here.
-
#live_mode ⇒ TrueClass | FalseClass
This field will be true if this object exists in the live environment or false if it exists in the test environment.
-
#metadata ⇒ Hash[String, String]
Additional data represented as key-value pairs.
-
#name ⇒ String
A nickname for the account.
-
#object ⇒ String
TODO: Write general description for this method.
-
#parent_account_id ⇒ UUID | String
The parent InternalAccount of this account.
-
#party_address ⇒ Address
Either individual or business.
-
#party_name ⇒ String
The legal name of the entity which owns the account.
-
#party_type ⇒ PartyType5
Either individual or business.
-
#routing_details ⇒ Array[RoutingDetail]
An array of routing detail objects.
-
#updated_at ⇒ DateTime
This field will be true if this object exists in the live environment or false if it exists in the test environment.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
-
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
Instance Method Summary collapse
-
#initialize(id:, object:, live_mode:, created_at:, updated_at:, account_type:, party_name:, party_type:, party_address:, name:, account_details:, routing_details:, connection:, currency:, metadata:, parent_account_id:, counterparty_id:, ledger_account_id:) ⇒ InternalAccount
constructor
A new instance of InternalAccount.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_created_at ⇒ Object
- #to_custom_updated_at ⇒ Object
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(id:, object:, live_mode:, created_at:, updated_at:, account_type:, party_name:, party_type:, party_address:, name:, account_details:, routing_details:, connection:, currency:, metadata:, parent_account_id:, counterparty_id:, ledger_account_id:) ⇒ InternalAccount
Returns a new instance of InternalAccount.
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 |
# File 'lib/modern_treasury/models/internal_account.rb', line 132 def initialize(id:, object:, live_mode:, created_at:, updated_at:, account_type:, party_name:, party_type:, party_address:, name:, account_details:, routing_details:, connection:, currency:, metadata:, parent_account_id:, counterparty_id:, ledger_account_id:) @id = id @object = object @live_mode = live_mode @created_at = created_at @updated_at = updated_at @account_type = account_type @party_name = party_name @party_type = party_type @party_address = party_address @name = name @account_details = account_details @routing_details = routing_details @connection = connection @currency = currency @metadata = @parent_account_id = parent_account_id @counterparty_id = counterparty_id @ledger_account_id = ledger_account_id end |
Instance Attribute Details
#account_details ⇒ Array[AccountDetail]
An array of account detail objects.
58 59 60 |
# File 'lib/modern_treasury/models/internal_account.rb', line 58 def account_details @account_details end |
#account_type ⇒ AccountType5
Can be checking, savings or other.
38 39 40 |
# File 'lib/modern_treasury/models/internal_account.rb', line 38 def account_type @account_type end |
#connection ⇒ Connection
An array of routing detail objects.
66 67 68 |
# File 'lib/modern_treasury/models/internal_account.rb', line 66 def connection @connection end |
#counterparty_id ⇒ UUID | String
The Counterparty associated to this account.
83 84 85 |
# File 'lib/modern_treasury/models/internal_account.rb', line 83 def counterparty_id @counterparty_id end |
#created_at ⇒ DateTime
This field will be true if this object exists in the live environment or false if it exists in the test environment.
29 30 31 |
# File 'lib/modern_treasury/models/internal_account.rb', line 29 def created_at @created_at end |
#currency ⇒ Currency
Three-letter ISO currency code.
70 71 72 |
# File 'lib/modern_treasury/models/internal_account.rb', line 70 def currency @currency end |
#id ⇒ UUID | String
TODO: Write general description for this method
15 16 17 |
# File 'lib/modern_treasury/models/internal_account.rb', line 15 def id @id end |
#ledger_account_id ⇒ UUID | String
If the internal account links to a ledger account in Modern Treasury, the id of the ledger account will be populated here.
88 89 90 |
# File 'lib/modern_treasury/models/internal_account.rb', line 88 def ledger_account_id @ledger_account_id end |
#live_mode ⇒ TrueClass | FalseClass
This field will be true if this object exists in the live environment or false if it exists in the test environment.
24 25 26 |
# File 'lib/modern_treasury/models/internal_account.rb', line 24 def live_mode @live_mode end |
#metadata ⇒ Hash[String, String]
Additional data represented as key-value pairs. Both the key and value must be strings.
75 76 77 |
# File 'lib/modern_treasury/models/internal_account.rb', line 75 def @metadata end |
#name ⇒ String
A nickname for the account.
54 55 56 |
# File 'lib/modern_treasury/models/internal_account.rb', line 54 def name @name end |
#object ⇒ String
TODO: Write general description for this method
19 20 21 |
# File 'lib/modern_treasury/models/internal_account.rb', line 19 def object @object end |
#parent_account_id ⇒ UUID | String
The parent InternalAccount of this account.
79 80 81 |
# File 'lib/modern_treasury/models/internal_account.rb', line 79 def parent_account_id @parent_account_id end |
#party_address ⇒ Address
Either individual or business.
50 51 52 |
# File 'lib/modern_treasury/models/internal_account.rb', line 50 def party_address @party_address end |
#party_name ⇒ String
The legal name of the entity which owns the account.
42 43 44 |
# File 'lib/modern_treasury/models/internal_account.rb', line 42 def party_name @party_name end |
#party_type ⇒ PartyType5
Either individual or business.
46 47 48 |
# File 'lib/modern_treasury/models/internal_account.rb', line 46 def party_type @party_type end |
#routing_details ⇒ Array[RoutingDetail]
An array of routing detail objects.
62 63 64 |
# File 'lib/modern_treasury/models/internal_account.rb', line 62 def routing_details @routing_details end |
#updated_at ⇒ DateTime
This field will be true if this object exists in the live environment or false if it exists in the test environment.
34 35 36 |
# File 'lib/modern_treasury/models/internal_account.rb', line 34 def updated_at @updated_at end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 218 219 220 221 222 223 224 225 |
# File 'lib/modern_treasury/models/internal_account.rb', line 158 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. id = hash.key?('id') ? hash['id'] : nil object = hash.key?('object') ? hash['object'] : nil live_mode = hash.key?('live_mode') ? hash['live_mode'] : nil created_at = if hash.key?('created_at') (DateTimeHelper.from_rfc3339(hash['created_at']) if hash['created_at']) end updated_at = if hash.key?('updated_at') (DateTimeHelper.from_rfc3339(hash['updated_at']) if hash['updated_at']) end account_type = hash.key?('account_type') ? hash['account_type'] : nil party_name = hash.key?('party_name') ? hash['party_name'] : nil party_type = hash.key?('party_type') ? hash['party_type'] : nil party_address = Address.from_hash(hash['party_address']) if hash['party_address'] name = hash.key?('name') ? hash['name'] : nil # Parameter is an array, so we need to iterate through it account_details = nil unless hash['account_details'].nil? account_details = [] hash['account_details'].each do |structure| account_details << (AccountDetail.from_hash(structure) if structure) end end account_details = nil 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 << (RoutingDetail.from_hash(structure) if structure) end end routing_details = nil unless hash.key?('routing_details') connection = Connection.from_hash(hash['connection']) if hash['connection'] currency = hash.key?('currency') ? hash['currency'] : nil = hash.key?('metadata') ? hash['metadata'] : nil parent_account_id = hash.key?('parent_account_id') ? hash['parent_account_id'] : nil counterparty_id = hash.key?('counterparty_id') ? hash['counterparty_id'] : nil ledger_account_id = hash.key?('ledger_account_id') ? hash['ledger_account_id'] : nil # Create object from extracted values. InternalAccount.new(id: id, object: object, live_mode: live_mode, created_at: created_at, updated_at: updated_at, account_type: account_type, party_name: party_name, party_type: party_type, party_address: party_address, name: name, account_details: account_details, routing_details: routing_details, connection: connection, currency: currency, metadata: , parent_account_id: parent_account_id, counterparty_id: counterparty_id, ledger_account_id: ledger_account_id) end |
.names ⇒ Object
A mapping from model property names to API property names.
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/modern_treasury/models/internal_account.rb', line 91 def self.names @_hash = {} if @_hash.nil? @_hash['id'] = 'id' @_hash['object'] = 'object' @_hash['live_mode'] = 'live_mode' @_hash['created_at'] = 'created_at' @_hash['updated_at'] = 'updated_at' @_hash['account_type'] = 'account_type' @_hash['party_name'] = 'party_name' @_hash['party_type'] = 'party_type' @_hash['party_address'] = 'party_address' @_hash['name'] = 'name' @_hash['account_details'] = 'account_details' @_hash['routing_details'] = 'routing_details' @_hash['connection'] = 'connection' @_hash['currency'] = 'currency' @_hash['metadata'] = 'metadata' @_hash['parent_account_id'] = 'parent_account_id' @_hash['counterparty_id'] = 'counterparty_id' @_hash['ledger_account_id'] = 'ledger_account_id' @_hash end |
.nullables ⇒ Object
An array for nullable fields
120 121 122 123 124 125 126 127 128 129 130 |
# File 'lib/modern_treasury/models/internal_account.rb', line 120 def self.nullables %w[ account_type party_type party_address name parent_account_id counterparty_id ledger_account_id ] end |
.optionals ⇒ Object
An array for optional fields
115 116 117 |
# File 'lib/modern_treasury/models/internal_account.rb', line 115 def self.optionals [] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 |
# File 'lib/modern_treasury/models/internal_account.rb', line 237 def self.validate(value) if value.instance_of? self return ( APIHelper.valid_type?(value.id, ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value.object, ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value.live_mode, ->(val) { val.instance_of? TrueClass or val.instance_of? FalseClass }) and APIHelper.valid_type?(value.created_at, ->(val) { val.instance_of? DateTime }) and APIHelper.valid_type?(value.updated_at, ->(val) { val.instance_of? DateTime }) and APIHelper.valid_type?(value.account_type, ->(val) { AccountType5.validate(val) }) and APIHelper.valid_type?(value.party_name, ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value.party_type, ->(val) { PartyType5.validate(val) }) and APIHelper.valid_type?(value.party_address, ->(val) { Address.validate(val) }, is_model_hash: true) and APIHelper.valid_type?(value.name, ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value.account_details, ->(val) { AccountDetail.validate(val) }, is_model_hash: true, is_inner_model_hash: true) and APIHelper.valid_type?(value.routing_details, ->(val) { RoutingDetail.validate(val) }, is_model_hash: true, is_inner_model_hash: true) and APIHelper.valid_type?(value.connection, ->(val) { Connection.validate(val) }, is_model_hash: true) and APIHelper.valid_type?(value.currency, ->(val) { Currency.validate(val) }) and APIHelper.valid_type?(value., ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value.parent_account_id, ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value.counterparty_id, ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value.ledger_account_id, ->(val) { val.instance_of? String }) ) end return false unless value.instance_of? Hash ( APIHelper.valid_type?(value['id'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['object'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['live_mode'], ->(val) { val.instance_of? TrueClass or val.instance_of? FalseClass }) and APIHelper.valid_type?(value['created_at'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['updated_at'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['account_type'], ->(val) { AccountType5.validate(val) }) and APIHelper.valid_type?(value['party_name'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['party_type'], ->(val) { PartyType5.validate(val) }) and APIHelper.valid_type?(value['party_address'], ->(val) { Address.validate(val) }, is_model_hash: true) and APIHelper.valid_type?(value['name'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['account_details'], ->(val) { AccountDetail.validate(val) }, is_model_hash: true, is_inner_model_hash: true) and APIHelper.valid_type?(value['routing_details'], ->(val) { RoutingDetail.validate(val) }, is_model_hash: true, is_inner_model_hash: true) and APIHelper.valid_type?(value['connection'], ->(val) { Connection.validate(val) }, is_model_hash: true) and APIHelper.valid_type?(value['currency'], ->(val) { Currency.validate(val) }) and APIHelper.valid_type?(value['metadata'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['parent_account_id'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['counterparty_id'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['ledger_account_id'], ->(val) { val.instance_of? String }) ) end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
346 347 348 349 350 351 352 353 354 355 356 357 |
# File 'lib/modern_treasury/models/internal_account.rb', line 346 def inspect class_name = self.class.name.split('::').last "<#{class_name} id: #{@id.inspect}, object: #{@object.inspect}, live_mode:"\ " #{@live_mode.inspect}, created_at: #{@created_at.inspect}, updated_at:"\ " #{@updated_at.inspect}, account_type: #{@account_type.inspect}, party_name:"\ " #{@party_name.inspect}, party_type: #{@party_type.inspect}, party_address:"\ " #{@party_address.inspect}, name: #{@name.inspect}, account_details:"\ " #{@account_details.inspect}, routing_details: #{@routing_details.inspect}, connection:"\ " #{@connection.inspect}, currency: #{@currency.inspect}, metadata: #{@metadata.inspect},"\ " parent_account_id: #{@parent_account_id.inspect}, counterparty_id:"\ " #{@counterparty_id.inspect}, ledger_account_id: #{@ledger_account_id.inspect}>" end |
#to_custom_created_at ⇒ Object
227 228 229 |
# File 'lib/modern_treasury/models/internal_account.rb', line 227 def to_custom_created_at DateTimeHelper.to_rfc3339(created_at) end |
#to_custom_updated_at ⇒ Object
231 232 233 |
# File 'lib/modern_treasury/models/internal_account.rb', line 231 def to_custom_updated_at DateTimeHelper.to_rfc3339(updated_at) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
334 335 336 337 338 339 340 341 342 343 |
# File 'lib/modern_treasury/models/internal_account.rb', line 334 def to_s class_name = self.class.name.split('::').last "<#{class_name} id: #{@id}, object: #{@object}, live_mode: #{@live_mode}, created_at:"\ " #{@created_at}, updated_at: #{@updated_at}, account_type: #{@account_type}, party_name:"\ " #{@party_name}, party_type: #{@party_type}, party_address: #{@party_address}, name:"\ " #{@name}, account_details: #{@account_details}, routing_details: #{@routing_details},"\ " connection: #{@connection}, currency: #{@currency}, metadata: #{@metadata},"\ " parent_account_id: #{@parent_account_id}, counterparty_id: #{@counterparty_id},"\ " ledger_account_id: #{@ledger_account_id}>" end |