Class: ModernTreasury::VirtualAccountCreateRequest
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ModernTreasury::VirtualAccountCreateRequest
- Defined in:
- lib/modern_treasury/models/virtual_account_create_request.rb
Overview
VirtualAccountCreateRequest Model.
Instance Attribute Summary collapse
-
#account_details ⇒ Array[AccountDetailCreateRequest]
An array of account detail objects.
-
#counterparty_id ⇒ UUID | String
The ID of the counterparty that the virtual account belongs to.
-
#credit_ledger_account_id ⇒ UUID | String
The ID of a credit normal ledger account.
-
#debit_ledger_account_id ⇒ UUID | String
The ID of a debit normal ledger account.
-
#description ⇒ String
An optional description for internal use.
-
#internal_account_id ⇒ UUID | String
The ID of the internal account that this virtual account is associated with.
-
#metadata ⇒ Hash[String, String]
Additional data represented as key-value pairs.
-
#name ⇒ String
The name of the virtual account.
-
#routing_details ⇒ Array[RoutingDetailCreateRequest]
An array of routing detail objects.
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.
Instance Method Summary collapse
-
#initialize(name:, internal_account_id:, description: SKIP, counterparty_id: SKIP, account_details: SKIP, routing_details: SKIP, debit_ledger_account_id: SKIP, credit_ledger_account_id: SKIP, metadata: SKIP, additional_properties: nil) ⇒ VirtualAccountCreateRequest
constructor
A new instance of VirtualAccountCreateRequest.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#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(name:, internal_account_id:, description: SKIP, counterparty_id: SKIP, account_details: SKIP, routing_details: SKIP, debit_ledger_account_id: SKIP, credit_ledger_account_id: SKIP, metadata: SKIP, additional_properties: nil) ⇒ VirtualAccountCreateRequest
Returns a new instance of VirtualAccountCreateRequest.
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/modern_treasury/models/virtual_account_create_request.rb', line 87 def initialize(name:, internal_account_id:, description: SKIP, counterparty_id: SKIP, account_details: SKIP, routing_details: SKIP, debit_ledger_account_id: SKIP, credit_ledger_account_id: SKIP, metadata: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @name = name @description = description unless description == SKIP @counterparty_id = counterparty_id unless counterparty_id == SKIP @internal_account_id = internal_account_id @account_details = account_details unless account_details == SKIP @routing_details = routing_details unless routing_details == SKIP @debit_ledger_account_id = debit_ledger_account_id unless debit_ledger_account_id == SKIP @credit_ledger_account_id = credit_ledger_account_id unless credit_ledger_account_id == SKIP @metadata = unless == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#account_details ⇒ Array[AccountDetailCreateRequest]
An array of account detail objects.
31 32 33 |
# File 'lib/modern_treasury/models/virtual_account_create_request.rb', line 31 def account_details @account_details end |
#counterparty_id ⇒ UUID | String
The ID of the counterparty that the virtual account belongs to.
22 23 24 |
# File 'lib/modern_treasury/models/virtual_account_create_request.rb', line 22 def counterparty_id @counterparty_id end |
#credit_ledger_account_id ⇒ UUID | String
The ID of a credit normal ledger account. When money leaves the virtual account, this ledger account will be credited. Must be accompanied by a debit_ledger_account_id if present.
47 48 49 |
# File 'lib/modern_treasury/models/virtual_account_create_request.rb', line 47 def credit_ledger_account_id @credit_ledger_account_id end |
#debit_ledger_account_id ⇒ UUID | String
The ID of a debit normal ledger account. When money enters the virtual account, this ledger account will be debited. Must be accompanied by a credit_ledger_account_id if present.
41 42 43 |
# File 'lib/modern_treasury/models/virtual_account_create_request.rb', line 41 def debit_ledger_account_id @debit_ledger_account_id end |
#description ⇒ String
An optional description for internal use.
18 19 20 |
# File 'lib/modern_treasury/models/virtual_account_create_request.rb', line 18 def description @description end |
#internal_account_id ⇒ UUID | String
The ID of the internal account that this virtual account is associated with.
27 28 29 |
# File 'lib/modern_treasury/models/virtual_account_create_request.rb', line 27 def internal_account_id @internal_account_id end |
#metadata ⇒ Hash[String, String]
Additional data represented as key-value pairs. Both the key and value must be strings.
52 53 54 |
# File 'lib/modern_treasury/models/virtual_account_create_request.rb', line 52 def @metadata end |
#name ⇒ String
The name of the virtual account.
14 15 16 |
# File 'lib/modern_treasury/models/virtual_account_create_request.rb', line 14 def name @name end |
#routing_details ⇒ Array[RoutingDetailCreateRequest]
An array of routing detail objects.
35 36 37 |
# File 'lib/modern_treasury/models/virtual_account_create_request.rb', line 35 def routing_details @routing_details end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 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 |
# File 'lib/modern_treasury/models/virtual_account_create_request.rb', line 108 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. name = hash.key?('name') ? hash['name'] : nil internal_account_id = hash.key?('internal_account_id') ? hash['internal_account_id'] : nil description = hash.key?('description') ? hash['description'] : SKIP counterparty_id = hash.key?('counterparty_id') ? hash['counterparty_id'] : SKIP # 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 << (AccountDetailCreateRequest.from_hash(structure) if structure) end end account_details = 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 << (RoutingDetailCreateRequest.from_hash(structure) if structure) end end routing_details = SKIP unless hash.key?('routing_details') debit_ledger_account_id = hash.key?('debit_ledger_account_id') ? hash['debit_ledger_account_id'] : SKIP credit_ledger_account_id = hash.key?('credit_ledger_account_id') ? hash['credit_ledger_account_id'] : SKIP = hash.key?('metadata') ? hash['metadata'] : SKIP # 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. VirtualAccountCreateRequest.new(name: name, internal_account_id: internal_account_id, description: description, counterparty_id: counterparty_id, account_details: account_details, routing_details: routing_details, debit_ledger_account_id: debit_ledger_account_id, credit_ledger_account_id: credit_ledger_account_id, metadata: , additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/modern_treasury/models/virtual_account_create_request.rb', line 55 def self.names @_hash = {} if @_hash.nil? @_hash['name'] = 'name' @_hash['description'] = 'description' @_hash['counterparty_id'] = 'counterparty_id' @_hash['internal_account_id'] = 'internal_account_id' @_hash['account_details'] = 'account_details' @_hash['routing_details'] = 'routing_details' @_hash['debit_ledger_account_id'] = 'debit_ledger_account_id' @_hash['credit_ledger_account_id'] = 'credit_ledger_account_id' @_hash['metadata'] = 'metadata' @_hash end |
.nullables ⇒ Object
An array for nullable fields
83 84 85 |
# File 'lib/modern_treasury/models/virtual_account_create_request.rb', line 83 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/modern_treasury/models/virtual_account_create_request.rb', line 70 def self.optionals %w[ description counterparty_id account_details routing_details debit_ledger_account_id credit_ledger_account_id metadata ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
175 176 177 178 179 180 181 182 183 184 |
# File 'lib/modern_treasury/models/virtual_account_create_request.rb', line 175 def inspect class_name = self.class.name.split('::').last "<#{class_name} name: #{@name.inspect}, description: #{@description.inspect},"\ " counterparty_id: #{@counterparty_id.inspect}, internal_account_id:"\ " #{@internal_account_id.inspect}, account_details: #{@account_details.inspect},"\ " routing_details: #{@routing_details.inspect}, debit_ledger_account_id:"\ " #{@debit_ledger_account_id.inspect}, credit_ledger_account_id:"\ " #{@credit_ledger_account_id.inspect}, metadata: #{@metadata.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
165 166 167 168 169 170 171 172 |
# File 'lib/modern_treasury/models/virtual_account_create_request.rb', line 165 def to_s class_name = self.class.name.split('::').last "<#{class_name} name: #{@name}, description: #{@description}, counterparty_id:"\ " #{@counterparty_id}, internal_account_id: #{@internal_account_id}, account_details:"\ " #{@account_details}, routing_details: #{@routing_details}, debit_ledger_account_id:"\ " #{@debit_ledger_account_id}, credit_ledger_account_id: #{@credit_ledger_account_id},"\ " metadata: #{@metadata}, additional_properties: #{@additional_properties}>" end |