Class: ModernTreasury::LedgerBalances
- Defined in:
- lib/modern_treasury/models/ledger_balances.rb
Overview
LedgerBalances Model.
Instance Attribute Summary collapse
-
#available_balance ⇒ LedgerBalance
TODO: Write general description for this method.
-
#pending_balance ⇒ LedgerBalance
TODO: Write general description for this method.
-
#posted_balance ⇒ LedgerBalance
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(pending_balance:, posted_balance:, available_balance:) ⇒ LedgerBalances
constructor
A new instance of LedgerBalances.
-
#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(pending_balance:, posted_balance:, available_balance:) ⇒ LedgerBalances
Returns a new instance of LedgerBalances.
43 44 45 46 47 |
# File 'lib/modern_treasury/models/ledger_balances.rb', line 43 def initialize(pending_balance:, posted_balance:, available_balance:) @pending_balance = pending_balance @posted_balance = posted_balance @available_balance = available_balance end |
Instance Attribute Details
#available_balance ⇒ LedgerBalance
TODO: Write general description for this method
22 23 24 |
# File 'lib/modern_treasury/models/ledger_balances.rb', line 22 def available_balance @available_balance end |
#pending_balance ⇒ LedgerBalance
TODO: Write general description for this method
14 15 16 |
# File 'lib/modern_treasury/models/ledger_balances.rb', line 14 def pending_balance @pending_balance end |
#posted_balance ⇒ LedgerBalance
TODO: Write general description for this method
18 19 20 |
# File 'lib/modern_treasury/models/ledger_balances.rb', line 18 def posted_balance @posted_balance end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/modern_treasury/models/ledger_balances.rb', line 50 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. pending_balance = LedgerBalance.from_hash(hash['pending_balance']) if hash['pending_balance'] posted_balance = LedgerBalance.from_hash(hash['posted_balance']) if hash['posted_balance'] available_balance = LedgerBalance.from_hash(hash['available_balance']) if hash['available_balance'] # Create object from extracted values. LedgerBalances.new(pending_balance: pending_balance, posted_balance: posted_balance, available_balance: available_balance) end |
.names ⇒ Object
A mapping from model property names to API property names.
25 26 27 28 29 30 31 |
# File 'lib/modern_treasury/models/ledger_balances.rb', line 25 def self.names @_hash = {} if @_hash.nil? @_hash['pending_balance'] = 'pending_balance' @_hash['posted_balance'] = 'posted_balance' @_hash['available_balance'] = 'available_balance' @_hash end |
.nullables ⇒ Object
An array for nullable fields
39 40 41 |
# File 'lib/modern_treasury/models/ledger_balances.rb', line 39 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
34 35 36 |
# File 'lib/modern_treasury/models/ledger_balances.rb', line 34 def self.optionals [] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
74 75 76 77 78 |
# File 'lib/modern_treasury/models/ledger_balances.rb', line 74 def inspect class_name = self.class.name.split('::').last "<#{class_name} pending_balance: #{@pending_balance.inspect}, posted_balance:"\ " #{@posted_balance.inspect}, available_balance: #{@available_balance.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
67 68 69 70 71 |
# File 'lib/modern_treasury/models/ledger_balances.rb', line 67 def to_s class_name = self.class.name.split('::').last "<#{class_name} pending_balance: #{@pending_balance}, posted_balance: #{@posted_balance},"\ " available_balance: #{@available_balance}>" end |