Class: ModernTreasury::LedgerAccountPayout

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

Overview

LedgerAccountPayout 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(id:, object:, live_mode:, created_at:, updated_at:, ledger_id:, description:, status:, payout_ledger_account_id:, funding_ledger_account_id:, effective_at_upper_bound:, ledger_transaction_id:, amount:, currency:, currency_exponent:, metadata:) ⇒ LedgerAccountPayout

Returns a new instance of LedgerAccountPayout.



123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# File 'lib/modern_treasury/models/ledger_account_payout.rb', line 123

def initialize(id:, object:, live_mode:, created_at:, updated_at:,
               ledger_id:, description:, status:, payout_ledger_account_id:,
               funding_ledger_account_id:, effective_at_upper_bound:,
               ledger_transaction_id:, amount:, currency:,
               currency_exponent:, metadata:)
  @id = id
  @object = object
  @live_mode = live_mode
  @created_at = created_at
  @updated_at = updated_at
  @ledger_id = ledger_id
  @description = description
  @status = status
  @payout_ledger_account_id = 
  @funding_ledger_account_id = 
  @effective_at_upper_bound = effective_at_upper_bound
  @ledger_transaction_id = ledger_transaction_id
  @amount = amount
  @currency = currency
  @currency_exponent = currency_exponent
  @metadata = 
end

Instance Attribute Details

#amountInteger

The amount of the ledger account payout.

Returns:

  • (Integer)


71
72
73
# File 'lib/modern_treasury/models/ledger_account_payout.rb', line 71

def amount
  @amount
end

#created_atDateTime

This field will be true if this object exists in the live environment or false if it exists in the test environment.

Returns:

  • (DateTime)


29
30
31
# File 'lib/modern_treasury/models/ledger_account_payout.rb', line 29

def created_at
  @created_at
end

#currencyString

The currency of the ledger account payout.

Returns:

  • (String)


75
76
77
# File 'lib/modern_treasury/models/ledger_account_payout.rb', line 75

def currency
  @currency
end

#currency_exponentInteger

The currency exponent of the ledger account payout.

Returns:

  • (Integer)


79
80
81
# File 'lib/modern_treasury/models/ledger_account_payout.rb', line 79

def currency_exponent
  @currency_exponent
end

#descriptionString

The description of the ledger account payout.

Returns:

  • (String)


42
43
44
# File 'lib/modern_treasury/models/ledger_account_payout.rb', line 42

def description
  @description
end

#effective_at_upper_boundDateTime

The exclusive upper bound of the effective_at timestamp of the ledger entries to be included in the ledger account payout. The default value is the created_at timestamp of the ledger account payout.

Returns:

  • (DateTime)


63
64
65
# File 'lib/modern_treasury/models/ledger_account_payout.rb', line 63

def effective_at_upper_bound
  @effective_at_upper_bound
end

#funding_ledger_account_idUUID | String

The id of the funding ledger account that sends to or receives funds from the payout ledger account.

Returns:

  • (UUID | String)


57
58
59
# File 'lib/modern_treasury/models/ledger_account_payout.rb', line 57

def 
  @funding_ledger_account_id
end

#idUUID | String

TODO: Write general description for this method

Returns:

  • (UUID | String)


15
16
17
# File 'lib/modern_treasury/models/ledger_account_payout.rb', line 15

def id
  @id
end

#ledger_idUUID | String

The id of the ledger that this ledger account payout belongs to.

Returns:

  • (UUID | String)


38
39
40
# File 'lib/modern_treasury/models/ledger_account_payout.rb', line 38

def ledger_id
  @ledger_id
end

#ledger_transaction_idUUID | String

The id of the ledger transaction that this payout is associated with.

Returns:

  • (UUID | String)


67
68
69
# File 'lib/modern_treasury/models/ledger_account_payout.rb', line 67

def ledger_transaction_id
  @ledger_transaction_id
end

#live_modeTrueClass | FalseClass

This field will be true if this object exists in the live environment or false if it exists in the test environment.

Returns:

  • (TrueClass | FalseClass)


24
25
26
# File 'lib/modern_treasury/models/ledger_account_payout.rb', line 24

def live_mode
  @live_mode
end

#metadataHash[String, String]

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

Returns:

  • (Hash[String, String])


84
85
86
# File 'lib/modern_treasury/models/ledger_account_payout.rb', line 84

def 
  @metadata
end

#objectString

TODO: Write general description for this method

Returns:

  • (String)


19
20
21
# File 'lib/modern_treasury/models/ledger_account_payout.rb', line 19

def object
  @object
end

#payout_ledger_account_idUUID | String

The id of the payout ledger account whose ledger entries are queried against, and its balance is reduced as a result.

Returns:

  • (UUID | String)


52
53
54
# File 'lib/modern_treasury/models/ledger_account_payout.rb', line 52

def 
  @payout_ledger_account_id
end

#statusStatus6

The status of the ledger account payout. One of ‘processing`, `pending`, `posted`, `archiving` or `archived`.

Returns:



47
48
49
# File 'lib/modern_treasury/models/ledger_account_payout.rb', line 47

def status
  @status
end

#updated_atDateTime

This field will be true if this object exists in the live environment or false if it exists in the test environment.

Returns:

  • (DateTime)


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

def updated_at
  @updated_at
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
# File 'lib/modern_treasury/models/ledger_account_payout.rb', line 147

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
  updated_at = if hash.key?('updated_at')
                 (DateTimeHelper.from_rfc3339(hash['updated_at']) if hash['updated_at'])
               end
  ledger_id = hash.key?('ledger_id') ? hash['ledger_id'] : nil
  description = hash.key?('description') ? hash['description'] : nil
  status = hash.key?('status') ? hash['status'] : nil
   =
    hash.key?('payout_ledger_account_id') ? hash['payout_ledger_account_id'] : nil
   =
    hash.key?('funding_ledger_account_id') ? hash['funding_ledger_account_id'] : nil
  effective_at_upper_bound = if hash.key?('effective_at_upper_bound')
                               (DateTimeHelper.from_rfc3339(hash['effective_at_upper_bound']) if hash['effective_at_upper_bound'])
                             end
  ledger_transaction_id =
    hash.key?('ledger_transaction_id') ? hash['ledger_transaction_id'] : 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
   = hash.key?('metadata') ? hash['metadata'] : nil

  # Create object from extracted values.
  LedgerAccountPayout.new(id: id,
                          object: object,
                          live_mode: live_mode,
                          created_at: created_at,
                          updated_at: updated_at,
                          ledger_id: ledger_id,
                          description: description,
                          status: status,
                          payout_ledger_account_id: ,
                          funding_ledger_account_id: ,
                          effective_at_upper_bound: effective_at_upper_bound,
                          ledger_transaction_id: ledger_transaction_id,
                          amount: amount,
                          currency: currency,
                          currency_exponent: currency_exponent,
                          metadata: )
end

.namesObject

A mapping from model property names to API property names.



87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/modern_treasury/models/ledger_account_payout.rb', line 87

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['id'] = 'id'
  @_hash['object'] = 'object'
  @_hash['live_mode'] = 'live_mode'
  @_hash['created_at'] = 'created_at'
  @_hash['updated_at'] = 'updated_at'
  @_hash['ledger_id'] = 'ledger_id'
  @_hash['description'] = 'description'
  @_hash['status'] = 'status'
  @_hash['payout_ledger_account_id'] = 'payout_ledger_account_id'
  @_hash['funding_ledger_account_id'] = 'funding_ledger_account_id'
  @_hash['effective_at_upper_bound'] = 'effective_at_upper_bound'
  @_hash['ledger_transaction_id'] = 'ledger_transaction_id'
  @_hash['amount'] = 'amount'
  @_hash['currency'] = 'currency'
  @_hash['currency_exponent'] = 'currency_exponent'
  @_hash['metadata'] = 'metadata'
  @_hash
end

.nullablesObject

An array for nullable fields



114
115
116
117
118
119
120
121
# File 'lib/modern_treasury/models/ledger_account_payout.rb', line 114

def self.nullables
  %w[
    description
    ledger_transaction_id
    amount
    currency_exponent
  ]
end

.optionalsObject

An array for optional fields



109
110
111
# File 'lib/modern_treasury/models/ledger_account_payout.rb', line 109

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



222
223
224
225
226
227
228
229
230
231
232
233
234
# File 'lib/modern_treasury/models/ledger_account_payout.rb', line 222

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}, updated_at:"\
  " #{@updated_at.inspect}, ledger_id: #{@ledger_id.inspect}, description:"\
  " #{@description.inspect}, status: #{@status.inspect}, payout_ledger_account_id:"\
  " #{@payout_ledger_account_id.inspect}, funding_ledger_account_id:"\
  " #{@funding_ledger_account_id.inspect}, effective_at_upper_bound:"\
  " #{@effective_at_upper_bound.inspect}, ledger_transaction_id:"\
  " #{@ledger_transaction_id.inspect}, amount: #{@amount.inspect}, currency:"\
  " #{@currency.inspect}, currency_exponent: #{@currency_exponent.inspect}, metadata:"\
  " #{@metadata.inspect}>"
end

#to_custom_created_atObject



197
198
199
# File 'lib/modern_treasury/models/ledger_account_payout.rb', line 197

def to_custom_created_at
  DateTimeHelper.to_rfc3339(created_at)
end

#to_custom_effective_at_upper_boundObject



205
206
207
# File 'lib/modern_treasury/models/ledger_account_payout.rb', line 205

def to_custom_effective_at_upper_bound
  DateTimeHelper.to_rfc3339(effective_at_upper_bound)
end

#to_custom_updated_atObject



201
202
203
# File 'lib/modern_treasury/models/ledger_account_payout.rb', line 201

def to_custom_updated_at
  DateTimeHelper.to_rfc3339(updated_at)
end

#to_sObject

Provides a human-readable string representation of the object.



210
211
212
213
214
215
216
217
218
219
# File 'lib/modern_treasury/models/ledger_account_payout.rb', line 210

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} id: #{@id}, object: #{@object}, live_mode: #{@live_mode}, created_at:"\
  " #{@created_at}, updated_at: #{@updated_at}, ledger_id: #{@ledger_id}, description:"\
  " #{@description}, status: #{@status}, payout_ledger_account_id:"\
  " #{@payout_ledger_account_id}, funding_ledger_account_id: #{@funding_ledger_account_id},"\
  " effective_at_upper_bound: #{@effective_at_upper_bound}, ledger_transaction_id:"\
  " #{@ledger_transaction_id}, amount: #{@amount}, currency: #{@currency}, currency_exponent:"\
  " #{@currency_exponent}, metadata: #{@metadata}>"
end