Class: ModernTreasury::LedgerAccountCreateRequest
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ModernTreasury::LedgerAccountCreateRequest
- Defined in:
- lib/modern_treasury/models/ledger_account_create_request.rb
Overview
LedgerAccountCreateRequest Model.
Instance Attribute Summary collapse
-
#currency ⇒ String
The currency of the ledger account.
-
#currency_exponent ⇒ Integer
The currency exponent of the ledger account.
-
#description ⇒ String
The description of the ledger account.
-
#ledger_id ⇒ UUID | String
The id of the ledger that this account belongs to.
-
#ledgerable_id ⇒ UUID | String
If the ledger account links to another object in Modern Treasury, the id will be populated here, otherwise null.
-
#ledgerable_type ⇒ LedgerableType
If the ledger account links to another object in Modern Treasury, the type will be populated here, otherwise null.
-
#metadata ⇒ Hash[String, String]
Additional data represented as key-value pairs.
-
#name ⇒ String
The name of the ledger account.
-
#normal_balance ⇒ NormalBalance
The normal balance of the ledger account.
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:, normal_balance:, ledger_id:, currency:, description: SKIP, currency_exponent: SKIP, ledgerable_id: SKIP, ledgerable_type: SKIP, metadata: SKIP, additional_properties: nil) ⇒ LedgerAccountCreateRequest
constructor
A new instance of LedgerAccountCreateRequest.
-
#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:, normal_balance:, ledger_id:, currency:, description: SKIP, currency_exponent: SKIP, ledgerable_id: SKIP, ledgerable_type: SKIP, metadata: SKIP, additional_properties: nil) ⇒ LedgerAccountCreateRequest
Returns a new instance of LedgerAccountCreateRequest.
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/modern_treasury/models/ledger_account_create_request.rb', line 86 def initialize(name:, normal_balance:, ledger_id:, currency:, description: SKIP, currency_exponent: SKIP, ledgerable_id: SKIP, ledgerable_type: 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 @normal_balance = normal_balance @ledger_id = ledger_id @currency = currency @currency_exponent = currency_exponent unless currency_exponent == SKIP @ledgerable_id = ledgerable_id unless ledgerable_id == SKIP @ledgerable_type = ledgerable_type unless ledgerable_type == SKIP @metadata = unless == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#currency ⇒ String
The currency of the ledger account.
30 31 32 |
# File 'lib/modern_treasury/models/ledger_account_create_request.rb', line 30 def currency @currency end |
#currency_exponent ⇒ Integer
The currency exponent of the ledger account.
34 35 36 |
# File 'lib/modern_treasury/models/ledger_account_create_request.rb', line 34 def currency_exponent @currency_exponent end |
#description ⇒ String
The description of the ledger account.
18 19 20 |
# File 'lib/modern_treasury/models/ledger_account_create_request.rb', line 18 def description @description end |
#ledger_id ⇒ UUID | String
The id of the ledger that this account belongs to.
26 27 28 |
# File 'lib/modern_treasury/models/ledger_account_create_request.rb', line 26 def ledger_id @ledger_id end |
#ledgerable_id ⇒ UUID | String
If the ledger account links to another object in Modern Treasury, the id will be populated here, otherwise null.
39 40 41 |
# File 'lib/modern_treasury/models/ledger_account_create_request.rb', line 39 def ledgerable_id @ledgerable_id end |
#ledgerable_type ⇒ LedgerableType
If the ledger account links to another object in Modern Treasury, the type will be populated here, otherwise null. The value is one of internal_account or external_account.
45 46 47 |
# File 'lib/modern_treasury/models/ledger_account_create_request.rb', line 45 def ledgerable_type @ledgerable_type end |
#metadata ⇒ Hash[String, String]
Additional data represented as key-value pairs. Both the key and value must be strings.
50 51 52 |
# File 'lib/modern_treasury/models/ledger_account_create_request.rb', line 50 def @metadata end |
#name ⇒ String
The name of the ledger account.
14 15 16 |
# File 'lib/modern_treasury/models/ledger_account_create_request.rb', line 14 def name @name end |
#normal_balance ⇒ NormalBalance
The normal balance of the ledger account.
22 23 24 |
# File 'lib/modern_treasury/models/ledger_account_create_request.rb', line 22 def normal_balance @normal_balance end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
106 107 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 |
# File 'lib/modern_treasury/models/ledger_account_create_request.rb', line 106 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. name = hash.key?('name') ? hash['name'] : nil normal_balance = hash.key?('normal_balance') ? hash['normal_balance'] : nil ledger_id = hash.key?('ledger_id') ? hash['ledger_id'] : nil currency = hash.key?('currency') ? hash['currency'] : nil description = hash.key?('description') ? hash['description'] : SKIP currency_exponent = hash.key?('currency_exponent') ? hash['currency_exponent'] : SKIP ledgerable_id = hash.key?('ledgerable_id') ? hash['ledgerable_id'] : SKIP ledgerable_type = hash.key?('ledgerable_type') ? hash['ledgerable_type'] : 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. LedgerAccountCreateRequest.new(name: name, normal_balance: normal_balance, ledger_id: ledger_id, currency: currency, description: description, currency_exponent: currency_exponent, ledgerable_id: ledgerable_id, ledgerable_type: ledgerable_type, metadata: , additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/modern_treasury/models/ledger_account_create_request.rb', line 53 def self.names @_hash = {} if @_hash.nil? @_hash['name'] = 'name' @_hash['description'] = 'description' @_hash['normal_balance'] = 'normal_balance' @_hash['ledger_id'] = 'ledger_id' @_hash['currency'] = 'currency' @_hash['currency_exponent'] = 'currency_exponent' @_hash['ledgerable_id'] = 'ledgerable_id' @_hash['ledgerable_type'] = 'ledgerable_type' @_hash['metadata'] = 'metadata' @_hash end |
.nullables ⇒ Object
An array for nullable fields
79 80 81 82 83 84 |
# File 'lib/modern_treasury/models/ledger_account_create_request.rb', line 79 def self.nullables %w[ description currency_exponent ] end |
.optionals ⇒ Object
An array for optional fields
68 69 70 71 72 73 74 75 76 |
# File 'lib/modern_treasury/models/ledger_account_create_request.rb', line 68 def self.optionals %w[ description currency_exponent ledgerable_id ledgerable_type metadata ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
154 155 156 157 158 159 160 161 |
# File 'lib/modern_treasury/models/ledger_account_create_request.rb', line 154 def inspect class_name = self.class.name.split('::').last "<#{class_name} name: #{@name.inspect}, description: #{@description.inspect},"\ " normal_balance: #{@normal_balance.inspect}, ledger_id: #{@ledger_id.inspect}, currency:"\ " #{@currency.inspect}, currency_exponent: #{@currency_exponent.inspect}, ledgerable_id:"\ " #{@ledgerable_id.inspect}, ledgerable_type: #{@ledgerable_type.inspect}, metadata:"\ " #{@metadata.inspect}, additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
144 145 146 147 148 149 150 151 |
# File 'lib/modern_treasury/models/ledger_account_create_request.rb', line 144 def to_s class_name = self.class.name.split('::').last "<#{class_name} name: #{@name}, description: #{@description}, normal_balance:"\ " #{@normal_balance}, ledger_id: #{@ledger_id}, currency: #{@currency}, currency_exponent:"\ " #{@currency_exponent}, ledgerable_id: #{@ledgerable_id}, ledgerable_type:"\ " #{@ledgerable_type}, metadata: #{@metadata}, additional_properties:"\ " #{@additional_properties}>" end |