Class: ModernTreasury::LedgerAccountCategoryCreateRequest
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ModernTreasury::LedgerAccountCategoryCreateRequest
- Defined in:
- lib/modern_treasury/models/ledger_account_category_create_request.rb
Overview
LedgerAccountCategoryCreateRequest Model.
Instance Attribute Summary collapse
-
#currency ⇒ String
The currency of the ledger account category.
-
#currency_exponent ⇒ Integer
The currency exponent of the ledger account category.
-
#description ⇒ String
The description of the ledger account category.
-
#ledger_id ⇒ UUID | String
The id of the ledger that this account category belongs to.
-
#metadata ⇒ Hash[String, String]
Additional data represented as key-value pairs.
-
#name ⇒ String
The name of the ledger account category.
-
#normal_balance ⇒ NormalBalance2
The normal balance of the ledger account category.
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:, currency:, ledger_id:, normal_balance:, description: SKIP, metadata: SKIP, currency_exponent: SKIP, additional_properties: nil) ⇒ LedgerAccountCategoryCreateRequest
constructor
A new instance of LedgerAccountCategoryCreateRequest.
-
#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:, currency:, ledger_id:, normal_balance:, description: SKIP, metadata: SKIP, currency_exponent: SKIP, additional_properties: nil) ⇒ LedgerAccountCategoryCreateRequest
Returns a new instance of LedgerAccountCategoryCreateRequest.
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/modern_treasury/models/ledger_account_category_create_request.rb', line 71 def initialize(name:, currency:, ledger_id:, normal_balance:, description: SKIP, metadata: SKIP, currency_exponent: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @name = name @description = description unless description == SKIP @metadata = unless == SKIP @currency = currency @currency_exponent = currency_exponent unless currency_exponent == SKIP @ledger_id = ledger_id @normal_balance = normal_balance @additional_properties = additional_properties end |
Instance Attribute Details
#currency ⇒ String
The currency of the ledger account category.
27 28 29 |
# File 'lib/modern_treasury/models/ledger_account_category_create_request.rb', line 27 def currency @currency end |
#currency_exponent ⇒ Integer
The currency exponent of the ledger account category.
31 32 33 |
# File 'lib/modern_treasury/models/ledger_account_category_create_request.rb', line 31 def currency_exponent @currency_exponent end |
#description ⇒ String
The description of the ledger account category.
18 19 20 |
# File 'lib/modern_treasury/models/ledger_account_category_create_request.rb', line 18 def description @description end |
#ledger_id ⇒ UUID | String
The id of the ledger that this account category belongs to.
35 36 37 |
# File 'lib/modern_treasury/models/ledger_account_category_create_request.rb', line 35 def ledger_id @ledger_id end |
#metadata ⇒ Hash[String, String]
Additional data represented as key-value pairs. Both the key and value must be strings.
23 24 25 |
# File 'lib/modern_treasury/models/ledger_account_category_create_request.rb', line 23 def @metadata end |
#name ⇒ String
The name of the ledger account category.
14 15 16 |
# File 'lib/modern_treasury/models/ledger_account_category_create_request.rb', line 14 def name @name end |
#normal_balance ⇒ NormalBalance2
The normal balance of the ledger account category.
39 40 41 |
# File 'lib/modern_treasury/models/ledger_account_category_create_request.rb', line 39 def normal_balance @normal_balance end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
# File 'lib/modern_treasury/models/ledger_account_category_create_request.rb', line 88 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. name = hash.key?('name') ? hash['name'] : nil currency = hash.key?('currency') ? hash['currency'] : nil ledger_id = hash.key?('ledger_id') ? hash['ledger_id'] : nil normal_balance = hash.key?('normal_balance') ? hash['normal_balance'] : nil description = hash.key?('description') ? hash['description'] : SKIP = hash.key?('metadata') ? hash['metadata'] : SKIP currency_exponent = hash.key?('currency_exponent') ? hash['currency_exponent'] : 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. LedgerAccountCategoryCreateRequest.new(name: name, currency: currency, ledger_id: ledger_id, normal_balance: normal_balance, description: description, metadata: , currency_exponent: currency_exponent, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/modern_treasury/models/ledger_account_category_create_request.rb', line 42 def self.names @_hash = {} if @_hash.nil? @_hash['name'] = 'name' @_hash['description'] = 'description' @_hash['metadata'] = 'metadata' @_hash['currency'] = 'currency' @_hash['currency_exponent'] = 'currency_exponent' @_hash['ledger_id'] = 'ledger_id' @_hash['normal_balance'] = 'normal_balance' @_hash end |
.nullables ⇒ Object
An array for nullable fields
64 65 66 67 68 69 |
# File 'lib/modern_treasury/models/ledger_account_category_create_request.rb', line 64 def self.nullables %w[ description currency_exponent ] end |
.optionals ⇒ Object
An array for optional fields
55 56 57 58 59 60 61 |
# File 'lib/modern_treasury/models/ledger_account_category_create_request.rb', line 55 def self.optionals %w[ description metadata currency_exponent ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
130 131 132 133 134 135 136 |
# File 'lib/modern_treasury/models/ledger_account_category_create_request.rb', line 130 def inspect class_name = self.class.name.split('::').last "<#{class_name} name: #{@name.inspect}, description: #{@description.inspect}, metadata:"\ " #{@metadata.inspect}, currency: #{@currency.inspect}, currency_exponent:"\ " #{@currency_exponent.inspect}, ledger_id: #{@ledger_id.inspect}, normal_balance:"\ " #{@normal_balance.inspect}, additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
121 122 123 124 125 126 127 |
# File 'lib/modern_treasury/models/ledger_account_category_create_request.rb', line 121 def to_s class_name = self.class.name.split('::').last "<#{class_name} name: #{@name}, description: #{@description}, metadata: #{@metadata},"\ " currency: #{@currency}, currency_exponent: #{@currency_exponent}, ledger_id:"\ " #{@ledger_id}, normal_balance: #{@normal_balance}, additional_properties:"\ " #{@additional_properties}>" end |