Class: ModernTreasury::LedgerEntryOfTransactionVersion
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ModernTreasury::LedgerEntryOfTransactionVersion
- Defined in:
- lib/modern_treasury/models/ledger_entry_of_transaction_version.rb
Overview
LedgerEntryOfTransactionVersion Model.
Instance Attribute Summary collapse
-
#amount ⇒ Integer
Value in specified currency’s smallest unit.
-
#created_at ⇒ DateTime
This field will be true if this object exists in the live environment or false if it exists in the test environment.
-
#direction ⇒ Direction5
One of ‘credit`, `debit`.
-
#id ⇒ UUID | String
TODO: Write general description for this method.
-
#ledger_account_currency ⇒ String
The currency of the ledger account.
-
#ledger_account_currency_exponent ⇒ Integer
The currency exponent of the ledger account.
-
#ledger_account_id ⇒ UUID | String
The ledger account that this ledger entry is associated with.
-
#ledger_account_lock_version ⇒ Integer
Lock version of the ledger account.
-
#ledger_transaction_id ⇒ String
The ledger transaction that this ledger entry is associated with.
-
#live_mode ⇒ TrueClass | FalseClass
This field will be true if this object exists in the live environment or false if it exists in the test environment.
-
#metadata ⇒ Hash[String, String]
Additional data represented as key-value pairs.
-
#object ⇒ String
TODO: Write general description for this method.
-
#resulting_ledger_account_balances ⇒ LedgerBalances
Additional data represented as key-value pairs.
-
#status ⇒ Status9
Equal to the state of the ledger transaction when the ledger entry was created.
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(id:, object:, live_mode:, created_at:, amount:, direction:, status:, ledger_account_id:, ledger_account_lock_version:, ledger_account_currency:, ledger_account_currency_exponent:, ledger_transaction_id:, metadata:, resulting_ledger_account_balances:) ⇒ LedgerEntryOfTransactionVersion
constructor
A new instance of LedgerEntryOfTransactionVersion.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_created_at ⇒ Object
-
#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(id:, object:, live_mode:, created_at:, amount:, direction:, status:, ledger_account_id:, ledger_account_lock_version:, ledger_account_currency:, ledger_account_currency_exponent:, ledger_transaction_id:, metadata:, resulting_ledger_account_balances:) ⇒ LedgerEntryOfTransactionVersion
Returns a new instance of LedgerEntryOfTransactionVersion.
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 |
# File 'lib/modern_treasury/models/ledger_entry_of_transaction_version.rb', line 115 def initialize(id:, object:, live_mode:, created_at:, amount:, direction:, status:, ledger_account_id:, ledger_account_lock_version:, ledger_account_currency:, ledger_account_currency_exponent:, ledger_transaction_id:, metadata:, resulting_ledger_account_balances:) @id = id @object = object @live_mode = live_mode @created_at = created_at @amount = amount @direction = direction @status = status @ledger_account_id = ledger_account_id @ledger_account_lock_version = ledger_account_lock_version @ledger_account_currency = ledger_account_currency @ledger_account_currency_exponent = ledger_account_currency_exponent @ledger_transaction_id = ledger_transaction_id @metadata = @resulting_ledger_account_balances = resulting_ledger_account_balances end |
Instance Attribute Details
#amount ⇒ Integer
Value in specified currency’s smallest unit. e.g. $10 would be represented as 1000. Can be any integer up to 36 digits.
34 35 36 |
# File 'lib/modern_treasury/models/ledger_entry_of_transaction_version.rb', line 34 def amount @amount end |
#created_at ⇒ DateTime
This field will be true if this object exists in the live environment or false if it exists in the test environment.
29 30 31 |
# File 'lib/modern_treasury/models/ledger_entry_of_transaction_version.rb', line 29 def created_at @created_at end |
#direction ⇒ Direction5
One of ‘credit`, `debit`. Describes the direction money is flowing in the transaction. A `credit` moves money from your account to someone else’s. A ‘debit` pulls money from someone else’s account to your own. Note that wire, rtp, and check payments will always be ‘credit`.
41 42 43 |
# File 'lib/modern_treasury/models/ledger_entry_of_transaction_version.rb', line 41 def direction @direction end |
#id ⇒ UUID | String
TODO: Write general description for this method
15 16 17 |
# File 'lib/modern_treasury/models/ledger_entry_of_transaction_version.rb', line 15 def id @id end |
#ledger_account_currency ⇒ String
The currency of the ledger account.
61 62 63 |
# File 'lib/modern_treasury/models/ledger_entry_of_transaction_version.rb', line 61 def ledger_account_currency @ledger_account_currency end |
#ledger_account_currency_exponent ⇒ Integer
The currency exponent of the ledger account.
65 66 67 |
# File 'lib/modern_treasury/models/ledger_entry_of_transaction_version.rb', line 65 def ledger_account_currency_exponent @ledger_account_currency_exponent end |
#ledger_account_id ⇒ UUID | String
The ledger account that this ledger entry is associated with.
50 51 52 |
# File 'lib/modern_treasury/models/ledger_entry_of_transaction_version.rb', line 50 def ledger_account_id @ledger_account_id end |
#ledger_account_lock_version ⇒ Integer
Lock version of the ledger account. This can be passed when creating a ledger transaction to only succeed if no ledger transactions have posted since the given version. See our post about Designing the Ledgers API with Optimistic Locking for more details.
57 58 59 |
# File 'lib/modern_treasury/models/ledger_entry_of_transaction_version.rb', line 57 def ledger_account_lock_version @ledger_account_lock_version end |
#ledger_transaction_id ⇒ String
The ledger transaction that this ledger entry is associated with.
69 70 71 |
# File 'lib/modern_treasury/models/ledger_entry_of_transaction_version.rb', line 69 def ledger_transaction_id @ledger_transaction_id end |
#live_mode ⇒ TrueClass | FalseClass
This field will be true if this object exists in the live environment or false if it exists in the test environment.
24 25 26 |
# File 'lib/modern_treasury/models/ledger_entry_of_transaction_version.rb', line 24 def live_mode @live_mode end |
#metadata ⇒ Hash[String, String]
Additional data represented as key-value pairs. Both the key and value must be strings.
74 75 76 |
# File 'lib/modern_treasury/models/ledger_entry_of_transaction_version.rb', line 74 def @metadata end |
#object ⇒ String
TODO: Write general description for this method
19 20 21 |
# File 'lib/modern_treasury/models/ledger_entry_of_transaction_version.rb', line 19 def object @object end |
#resulting_ledger_account_balances ⇒ LedgerBalances
Additional data represented as key-value pairs. Both the key and value must be strings.
79 80 81 |
# File 'lib/modern_treasury/models/ledger_entry_of_transaction_version.rb', line 79 def resulting_ledger_account_balances @resulting_ledger_account_balances end |
#status ⇒ Status9
Equal to the state of the ledger transaction when the ledger entry was created. One of ‘pending`, `posted`, or `archived`.
46 47 48 |
# File 'lib/modern_treasury/models/ledger_entry_of_transaction_version.rb', line 46 def status @status end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 |
# File 'lib/modern_treasury/models/ledger_entry_of_transaction_version.rb', line 137 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. id = hash.key?('id') ? hash['id'] : nil object = hash.key?('object') ? hash['object'] : nil live_mode = hash.key?('live_mode') ? hash['live_mode'] : nil created_at = if hash.key?('created_at') (DateTimeHelper.from_rfc3339(hash['created_at']) if hash['created_at']) end amount = hash.key?('amount') ? hash['amount'] : nil direction = hash.key?('direction') ? hash['direction'] : nil status = hash.key?('status') ? hash['status'] : nil ledger_account_id = hash.key?('ledger_account_id') ? hash['ledger_account_id'] : nil ledger_account_lock_version = hash.key?('ledger_account_lock_version') ? hash['ledger_account_lock_version'] : nil ledger_account_currency = hash.key?('ledger_account_currency') ? hash['ledger_account_currency'] : nil ledger_account_currency_exponent = hash.key?('ledger_account_currency_exponent') ? hash['ledger_account_currency_exponent'] : nil ledger_transaction_id = hash.key?('ledger_transaction_id') ? hash['ledger_transaction_id'] : nil = hash.key?('metadata') ? hash['metadata'] : nil if hash['resulting_ledger_account_balances'] resulting_ledger_account_balances = LedgerBalances.from_hash(hash['resulting_ledger_account_balances']) end # Create object from extracted values. LedgerEntryOfTransactionVersion.new(id: id, object: object, live_mode: live_mode, created_at: created_at, amount: amount, direction: direction, status: status, ledger_account_id: ledger_account_id, ledger_account_lock_version: ledger_account_lock_version, ledger_account_currency: ledger_account_currency, ledger_account_currency_exponent: ledger_account_currency_exponent, ledger_transaction_id: ledger_transaction_id, metadata: , resulting_ledger_account_balances: resulting_ledger_account_balances) end |
.names ⇒ Object
A mapping from model property names to API property names.
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/modern_treasury/models/ledger_entry_of_transaction_version.rb', line 82 def self.names @_hash = {} if @_hash.nil? @_hash['id'] = 'id' @_hash['object'] = 'object' @_hash['live_mode'] = 'live_mode' @_hash['created_at'] = 'created_at' @_hash['amount'] = 'amount' @_hash['direction'] = 'direction' @_hash['status'] = 'status' @_hash['ledger_account_id'] = 'ledger_account_id' @_hash['ledger_account_lock_version'] = 'ledger_account_lock_version' @_hash['ledger_account_currency'] = 'ledger_account_currency' @_hash['ledger_account_currency_exponent'] = 'ledger_account_currency_exponent' @_hash['ledger_transaction_id'] = 'ledger_transaction_id' @_hash['metadata'] = 'metadata' @_hash['resulting_ledger_account_balances'] = 'resulting_ledger_account_balances' @_hash end |
.nullables ⇒ Object
An array for nullable fields
109 110 111 112 113 |
# File 'lib/modern_treasury/models/ledger_entry_of_transaction_version.rb', line 109 def self.nullables %w[ ledger_account_lock_version ] end |
.optionals ⇒ Object
An array for optional fields
104 105 106 |
# File 'lib/modern_treasury/models/ledger_entry_of_transaction_version.rb', line 104 def self.optionals [] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
199 200 201 202 203 204 205 206 207 208 209 210 |
# File 'lib/modern_treasury/models/ledger_entry_of_transaction_version.rb', line 199 def inspect class_name = self.class.name.split('::').last "<#{class_name} id: #{@id.inspect}, object: #{@object.inspect}, live_mode:"\ " #{@live_mode.inspect}, created_at: #{@created_at.inspect}, amount: #{@amount.inspect},"\ " direction: #{@direction.inspect}, status: #{@status.inspect}, ledger_account_id:"\ " #{@ledger_account_id.inspect}, ledger_account_lock_version:"\ " #{@ledger_account_lock_version.inspect}, ledger_account_currency:"\ " #{@ledger_account_currency.inspect}, ledger_account_currency_exponent:"\ " #{@ledger_account_currency_exponent.inspect}, ledger_transaction_id:"\ " #{@ledger_transaction_id.inspect}, metadata: #{@metadata.inspect},"\ " resulting_ledger_account_balances: #{@resulting_ledger_account_balances.inspect}>" end |
#to_custom_created_at ⇒ Object
182 183 184 |
# File 'lib/modern_treasury/models/ledger_entry_of_transaction_version.rb', line 182 def to_custom_created_at DateTimeHelper.to_rfc3339(created_at) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
187 188 189 190 191 192 193 194 195 196 |
# File 'lib/modern_treasury/models/ledger_entry_of_transaction_version.rb', line 187 def to_s class_name = self.class.name.split('::').last "<#{class_name} id: #{@id}, object: #{@object}, live_mode: #{@live_mode}, created_at:"\ " #{@created_at}, amount: #{@amount}, direction: #{@direction}, status: #{@status},"\ " ledger_account_id: #{@ledger_account_id}, ledger_account_lock_version:"\ " #{@ledger_account_lock_version}, ledger_account_currency: #{@ledger_account_currency},"\ " ledger_account_currency_exponent: #{@ledger_account_currency_exponent},"\ " ledger_transaction_id: #{@ledger_transaction_id}, metadata: #{@metadata},"\ " resulting_ledger_account_balances: #{@resulting_ledger_account_balances}>" end |