Class: ModernTreasury::LedgerBalance
- Defined in:
- lib/modern_treasury/models/ledger_balance.rb
Overview
LedgerBalance Model.
Instance Attribute Summary collapse
-
#amount ⇒ Integer
TODO: Write general description for this method.
-
#credits ⇒ Integer
TODO: Write general description for this method.
-
#currency ⇒ String
The currency of the ledger account.
-
#currency_exponent ⇒ Integer
The currency exponent of the ledger account.
-
#debits ⇒ Integer
TODO: Write general description for this method.
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(credits:, debits:, amount:, currency:, currency_exponent:) ⇒ LedgerBalance
constructor
A new instance of LedgerBalance.
-
#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(credits:, debits:, amount:, currency:, currency_exponent:) ⇒ LedgerBalance
Returns a new instance of LedgerBalance.
53 54 55 56 57 58 59 |
# File 'lib/modern_treasury/models/ledger_balance.rb', line 53 def initialize(credits:, debits:, amount:, currency:, currency_exponent:) @credits = credits @debits = debits @amount = amount @currency = currency @currency_exponent = currency_exponent end |
Instance Attribute Details
#amount ⇒ Integer
TODO: Write general description for this method
22 23 24 |
# File 'lib/modern_treasury/models/ledger_balance.rb', line 22 def amount @amount end |
#credits ⇒ Integer
TODO: Write general description for this method
14 15 16 |
# File 'lib/modern_treasury/models/ledger_balance.rb', line 14 def credits @credits end |
#currency ⇒ String
The currency of the ledger account.
26 27 28 |
# File 'lib/modern_treasury/models/ledger_balance.rb', line 26 def currency @currency end |
#currency_exponent ⇒ Integer
The currency exponent of the ledger account.
30 31 32 |
# File 'lib/modern_treasury/models/ledger_balance.rb', line 30 def currency_exponent @currency_exponent end |
#debits ⇒ Integer
TODO: Write general description for this method
18 19 20 |
# File 'lib/modern_treasury/models/ledger_balance.rb', line 18 def debits @debits end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/modern_treasury/models/ledger_balance.rb', line 62 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. credits = hash.key?('credits') ? hash['credits'] : nil debits = hash.key?('debits') ? hash['debits'] : nil amount = hash.key?('amount') ? hash['amount'] : nil currency = hash.key?('currency') ? hash['currency'] : nil currency_exponent = hash.key?('currency_exponent') ? hash['currency_exponent'] : nil # Create object from extracted values. LedgerBalance.new(credits: credits, debits: debits, amount: amount, currency: currency, currency_exponent: currency_exponent) end |
.names ⇒ Object
A mapping from model property names to API property names.
33 34 35 36 37 38 39 40 41 |
# File 'lib/modern_treasury/models/ledger_balance.rb', line 33 def self.names @_hash = {} if @_hash.nil? @_hash['credits'] = 'credits' @_hash['debits'] = 'debits' @_hash['amount'] = 'amount' @_hash['currency'] = 'currency' @_hash['currency_exponent'] = 'currency_exponent' @_hash end |
.nullables ⇒ Object
An array for nullable fields
49 50 51 |
# File 'lib/modern_treasury/models/ledger_balance.rb', line 49 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
44 45 46 |
# File 'lib/modern_treasury/models/ledger_balance.rb', line 44 def self.optionals [] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
89 90 91 92 93 94 |
# File 'lib/modern_treasury/models/ledger_balance.rb', line 89 def inspect class_name = self.class.name.split('::').last "<#{class_name} credits: #{@credits.inspect}, debits: #{@debits.inspect}, amount:"\ " #{@amount.inspect}, currency: #{@currency.inspect}, currency_exponent:"\ " #{@currency_exponent.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
82 83 84 85 86 |
# File 'lib/modern_treasury/models/ledger_balance.rb', line 82 def to_s class_name = self.class.name.split('::').last "<#{class_name} credits: #{@credits}, debits: #{@debits}, amount: #{@amount}, currency:"\ " #{@currency}, currency_exponent: #{@currency_exponent}>" end |