Class: ModernTreasury::LedgerAccountCreateRequest

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

Overview

LedgerAccountCreateRequest 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(name = nil, normal_balance = nil, ledger_id = nil, currency = nil, description = SKIP, currency_exponent = SKIP, ledgerable_id = SKIP, ledgerable_type = SKIP, metadata = SKIP) ⇒ LedgerAccountCreateRequest

Returns a new instance of LedgerAccountCreateRequest.



86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/modern_treasury/models/ledger_account_create_request.rb', line 86

def initialize(name = nil, normal_balance = nil, ledger_id = nil,
               currency = nil, description = SKIP, currency_exponent = SKIP,
               ledgerable_id = SKIP, ledgerable_type = SKIP,
                = SKIP)
  @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
end

Instance Attribute Details

#currencyString

The currency of the ledger account.

Returns:

  • (String)


30
31
32
# File 'lib/modern_treasury/models/ledger_account_create_request.rb', line 30

def currency
  @currency
end

#currency_exponentInteger

The currency exponent of the ledger account.

Returns:

  • (Integer)


34
35
36
# File 'lib/modern_treasury/models/ledger_account_create_request.rb', line 34

def currency_exponent
  @currency_exponent
end

#descriptionString

The description of the ledger account.

Returns:

  • (String)


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

def description
  @description
end

#ledger_idUUID | String

The id of the ledger that this account belongs to.

Returns:

  • (UUID | String)


26
27
28
# File 'lib/modern_treasury/models/ledger_account_create_request.rb', line 26

def ledger_id
  @ledger_id
end

#ledgerable_idUUID | String

If the ledger account links to another object in Modern Treasury, the id will be populated here, otherwise null.

Returns:

  • (UUID | String)


39
40
41
# File 'lib/modern_treasury/models/ledger_account_create_request.rb', line 39

def ledgerable_id
  @ledgerable_id
end

#ledgerable_typeLedgerableTypeEnum

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.

Returns:



45
46
47
# File 'lib/modern_treasury/models/ledger_account_create_request.rb', line 45

def ledgerable_type
  @ledgerable_type
end

#metadataHash[String, String]

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

Returns:

  • (Hash[String, String])


50
51
52
# File 'lib/modern_treasury/models/ledger_account_create_request.rb', line 50

def 
  @metadata
end

#nameString

The name of the ledger account.

Returns:

  • (String)


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

def name
  @name
end

#normal_balanceNormalBalanceEnum

The normal balance of the ledger account.

Returns:



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.



102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# File 'lib/modern_treasury/models/ledger_account_create_request.rb', line 102

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 object from extracted values.
  LedgerAccountCreateRequest.new(name,
                                 normal_balance,
                                 ledger_id,
                                 currency,
                                 description,
                                 currency_exponent,
                                 ledgerable_id,
                                 ledgerable_type,
                                 )
end

.namesObject

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

.nullablesObject

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

.optionalsObject

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

#inspectObject

Provides a debugging-friendly string with detailed object information.



141
142
143
144
145
146
147
148
# File 'lib/modern_treasury/models/ledger_account_create_request.rb', line 141

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}>"
end

#to_sObject

Provides a human-readable string representation of the object.



132
133
134
135
136
137
138
# File 'lib/modern_treasury/models/ledger_account_create_request.rb', line 132

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}>"
end