Class: ApiReference::VoidInitiatedLedgerEntry

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/api_reference/models/void_initiated_ledger_entry.rb

Overview

VoidInitiatedLedgerEntry 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(metadata:, id:, ledger_sequence_number:, entry_status:, customer:, starting_balance:, ending_balance:, amount:, currency:, created_at:, description:, credit_block:, new_block_expiry_date:, void_reason:, void_amount:, additional_properties: nil) ⇒ VoidInitiatedLedgerEntry

Returns a new instance of VoidInitiatedLedgerEntry.



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
# File 'lib/api_reference/models/void_initiated_ledger_entry.rb', line 160

def initialize(metadata:, id:, ledger_sequence_number:, entry_status:,
               customer:, starting_balance:, ending_balance:, amount:,
               currency:, created_at:, description:, credit_block:,
               new_block_expiry_date:, void_reason:, void_amount:,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @metadata = 
  @id = id
  @ledger_sequence_number = ledger_sequence_number
  @entry_status = entry_status
  @customer = customer
  @starting_balance = starting_balance
  @ending_balance = ending_balance
  @amount = amount
  @currency = currency
  @created_at = created_at
  @description = description
  @credit_block = credit_block
  @entry_type = 'void_initiated'
  @new_block_expiry_date = new_block_expiry_date
  @void_reason = void_reason
  @void_amount = void_amount
  @additional_properties = additional_properties
end

Instance Attribute Details

#amountFloat

User specified key-value pairs for the resource. If not present, this defaults to an empty dictionary. Individual keys can be removed by setting the value to null, and the entire metadata mapping can be cleared by setting metadata to null.

Returns:

  • (Float)


67
68
69
# File 'lib/api_reference/models/void_initiated_ledger_entry.rb', line 67

def amount
  @amount
end

#created_atDateTime

User specified key-value pairs for the resource. If not present, this defaults to an empty dictionary. Individual keys can be removed by setting the value to null, and the entire metadata mapping can be cleared by setting metadata to null.

Returns:

  • (DateTime)


81
82
83
# File 'lib/api_reference/models/void_initiated_ledger_entry.rb', line 81

def created_at
  @created_at
end

#credit_blockAffectedBlock

User specified key-value pairs for the resource. If not present, this defaults to an empty dictionary. Individual keys can be removed by setting the value to null, and the entire metadata mapping can be cleared by setting metadata to null.

Returns:



95
96
97
# File 'lib/api_reference/models/void_initiated_ledger_entry.rb', line 95

def credit_block
  @credit_block
end

#currencyString

User specified key-value pairs for the resource. If not present, this defaults to an empty dictionary. Individual keys can be removed by setting the value to null, and the entire metadata mapping can be cleared by setting metadata to null.

Returns:

  • (String)


74
75
76
# File 'lib/api_reference/models/void_initiated_ledger_entry.rb', line 74

def currency
  @currency
end

#customerCustomerMinified

User specified key-value pairs for the resource. If not present, this defaults to an empty dictionary. Individual keys can be removed by setting the value to null, and the entire metadata mapping can be cleared by setting metadata to null.

Returns:



46
47
48
# File 'lib/api_reference/models/void_initiated_ledger_entry.rb', line 46

def customer
  @customer
end

#descriptionString

User specified key-value pairs for the resource. If not present, this defaults to an empty dictionary. Individual keys can be removed by setting the value to null, and the entire metadata mapping can be cleared by setting metadata to null.

Returns:

  • (String)


88
89
90
# File 'lib/api_reference/models/void_initiated_ledger_entry.rb', line 88

def description
  @description
end

#ending_balanceFloat

User specified key-value pairs for the resource. If not present, this defaults to an empty dictionary. Individual keys can be removed by setting the value to null, and the entire metadata mapping can be cleared by setting metadata to null.

Returns:

  • (Float)


60
61
62
# File 'lib/api_reference/models/void_initiated_ledger_entry.rb', line 60

def ending_balance
  @ending_balance
end

#entry_statusEntryStatus

User specified key-value pairs for the resource. If not present, this defaults to an empty dictionary. Individual keys can be removed by setting the value to null, and the entire metadata mapping can be cleared by setting metadata to null.

Returns:



39
40
41
# File 'lib/api_reference/models/void_initiated_ledger_entry.rb', line 39

def entry_status
  @entry_status
end

#entry_typeString (readonly)

User specified key-value pairs for the resource. If not present, this defaults to an empty dictionary. Individual keys can be removed by setting the value to null, and the entire metadata mapping can be cleared by setting metadata to null.

Returns:

  • (String)


102
103
104
# File 'lib/api_reference/models/void_initiated_ledger_entry.rb', line 102

def entry_type
  @entry_type
end

#idString

User specified key-value pairs for the resource. If not present, this defaults to an empty dictionary. Individual keys can be removed by setting the value to null, and the entire metadata mapping can be cleared by setting metadata to null.

Returns:

  • (String)


25
26
27
# File 'lib/api_reference/models/void_initiated_ledger_entry.rb', line 25

def id
  @id
end

#ledger_sequence_numberInteger

User specified key-value pairs for the resource. If not present, this defaults to an empty dictionary. Individual keys can be removed by setting the value to null, and the entire metadata mapping can be cleared by setting metadata to null.

Returns:

  • (Integer)


32
33
34
# File 'lib/api_reference/models/void_initiated_ledger_entry.rb', line 32

def ledger_sequence_number
  @ledger_sequence_number
end

#metadataHash[String, String]

User specified key-value pairs for the resource. If not present, this defaults to an empty dictionary. Individual keys can be removed by setting the value to null, and the entire metadata mapping can be cleared by setting metadata to null.

Returns:

  • (Hash[String, String])


18
19
20
# File 'lib/api_reference/models/void_initiated_ledger_entry.rb', line 18

def 
  @metadata
end

#new_block_expiry_dateDateTime

User specified key-value pairs for the resource. If not present, this defaults to an empty dictionary. Individual keys can be removed by setting the value to null, and the entire metadata mapping can be cleared by setting metadata to null.

Returns:

  • (DateTime)


109
110
111
# File 'lib/api_reference/models/void_initiated_ledger_entry.rb', line 109

def new_block_expiry_date
  @new_block_expiry_date
end

#starting_balanceFloat

User specified key-value pairs for the resource. If not present, this defaults to an empty dictionary. Individual keys can be removed by setting the value to null, and the entire metadata mapping can be cleared by setting metadata to null.

Returns:

  • (Float)


53
54
55
# File 'lib/api_reference/models/void_initiated_ledger_entry.rb', line 53

def starting_balance
  @starting_balance
end

#void_amountFloat

User specified key-value pairs for the resource. If not present, this defaults to an empty dictionary. Individual keys can be removed by setting the value to null, and the entire metadata mapping can be cleared by setting metadata to null.

Returns:

  • (Float)


123
124
125
# File 'lib/api_reference/models/void_initiated_ledger_entry.rb', line 123

def void_amount
  @void_amount
end

#void_reasonString

User specified key-value pairs for the resource. If not present, this defaults to an empty dictionary. Individual keys can be removed by setting the value to null, and the entire metadata mapping can be cleared by setting metadata to null.

Returns:

  • (String)


116
117
118
# File 'lib/api_reference/models/void_initiated_ledger_entry.rb', line 116

def void_reason
  @void_reason
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
# File 'lib/api_reference/models/void_initiated_ledger_entry.rb', line 188

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
   = hash.key?('metadata') ? hash['metadata'] : nil
  id = hash.key?('id') ? hash['id'] : nil
  ledger_sequence_number =
    hash.key?('ledger_sequence_number') ? hash['ledger_sequence_number'] : nil
  entry_status = hash.key?('entry_status') ? hash['entry_status'] : nil
  customer = CustomerMinified.from_hash(hash['customer']) if hash['customer']
  starting_balance =
    hash.key?('starting_balance') ? hash['starting_balance'] : nil
  ending_balance =
    hash.key?('ending_balance') ? hash['ending_balance'] : nil
  amount = hash.key?('amount') ? hash['amount'] : nil
  currency = hash.key?('currency') ? hash['currency'] : nil
  created_at = if hash.key?('created_at')
                 (DateTimeHelper.from_rfc3339(hash['created_at']) if hash['created_at'])
               end
  description = hash.key?('description') ? hash['description'] : nil
  credit_block = AffectedBlock.from_hash(hash['credit_block']) if hash['credit_block']
  new_block_expiry_date = if hash.key?('new_block_expiry_date')
                            (DateTimeHelper.from_rfc3339(hash['new_block_expiry_date']) if hash['new_block_expiry_date'])
                          end
  void_reason = hash.key?('void_reason') ? hash['void_reason'] : nil
  void_amount = hash.key?('void_amount') ? hash['void_amount'] : nil

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  VoidInitiatedLedgerEntry.new(metadata: ,
                               id: id,
                               ledger_sequence_number: ledger_sequence_number,
                               entry_status: entry_status,
                               customer: customer,
                               starting_balance: starting_balance,
                               ending_balance: ending_balance,
                               amount: amount,
                               currency: currency,
                               created_at: created_at,
                               description: description,
                               credit_block: credit_block,
                               new_block_expiry_date: new_block_expiry_date,
                               void_reason: void_reason,
                               void_amount: void_amount,
                               additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# File 'lib/api_reference/models/void_initiated_ledger_entry.rb', line 126

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['metadata'] = 'metadata'
  @_hash['id'] = 'id'
  @_hash['ledger_sequence_number'] = 'ledger_sequence_number'
  @_hash['entry_status'] = 'entry_status'
  @_hash['customer'] = 'customer'
  @_hash['starting_balance'] = 'starting_balance'
  @_hash['ending_balance'] = 'ending_balance'
  @_hash['amount'] = 'amount'
  @_hash['currency'] = 'currency'
  @_hash['created_at'] = 'created_at'
  @_hash['description'] = 'description'
  @_hash['credit_block'] = 'credit_block'
  @_hash['entry_type'] = 'entry_type'
  @_hash['new_block_expiry_date'] = 'new_block_expiry_date'
  @_hash['void_reason'] = 'void_reason'
  @_hash['void_amount'] = 'void_amount'
  @_hash
end

.nullablesObject

An array for nullable fields



153
154
155
156
157
158
# File 'lib/api_reference/models/void_initiated_ledger_entry.rb', line 153

def self.nullables
  %w[
    description
    void_reason
  ]
end

.optionalsObject

An array for optional fields



148
149
150
# File 'lib/api_reference/models/void_initiated_ledger_entry.rb', line 148

def self.optionals
  []
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
# File 'lib/api_reference/models/void_initiated_ledger_entry.rb', line 251

def self.validate(value)
  if value.instance_of? self
    return (
      APIHelper.valid_type?(value.,
                            ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.id,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.ledger_sequence_number,
                              ->(val) { val.instance_of? Integer }) and
        APIHelper.valid_type?(value.entry_status,
                              ->(val) { EntryStatus.validate(val) }) and
        APIHelper.valid_type?(value.customer,
                              ->(val) { CustomerMinified.validate(val) },
                              is_model_hash: true) and
        APIHelper.valid_type?(value.starting_balance,
                              ->(val) { val.instance_of? Float }) and
        APIHelper.valid_type?(value.ending_balance,
                              ->(val) { val.instance_of? Float }) and
        APIHelper.valid_type?(value.amount,
                              ->(val) { val.instance_of? Float }) and
        APIHelper.valid_type?(value.currency,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.created_at,
                              ->(val) { val.instance_of? DateTime }) and
        APIHelper.valid_type?(value.description,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.credit_block,
                              ->(val) { AffectedBlock.validate(val) },
                              is_model_hash: true) and
        APIHelper.valid_type?(value.entry_type,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.new_block_expiry_date,
                              ->(val) { val.instance_of? DateTime }) and
        APIHelper.valid_type?(value.void_reason,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.void_amount,
                              ->(val) { val.instance_of? Float })
    )
  end

  return false unless value.instance_of? Hash

  (
    APIHelper.valid_type?(value['metadata'],
                          ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['id'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['ledger_sequence_number'],
                            ->(val) { val.instance_of? Integer }) and
      APIHelper.valid_type?(value['entry_status'],
                            ->(val) { EntryStatus.validate(val) }) and
      APIHelper.valid_type?(value['customer'],
                            ->(val) { CustomerMinified.validate(val) },
                            is_model_hash: true) and
      APIHelper.valid_type?(value['starting_balance'],
                            ->(val) { val.instance_of? Float }) and
      APIHelper.valid_type?(value['ending_balance'],
                            ->(val) { val.instance_of? Float }) and
      APIHelper.valid_type?(value['amount'],
                            ->(val) { val.instance_of? Float }) and
      APIHelper.valid_type?(value['currency'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['created_at'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['description'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['credit_block'],
                            ->(val) { AffectedBlock.validate(val) },
                            is_model_hash: true) and
      APIHelper.valid_type?(value['entry_type'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['new_block_expiry_date'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['void_reason'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['void_amount'],
                            ->(val) { val.instance_of? Float })
  )
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



344
345
346
347
348
349
350
351
352
353
354
# File 'lib/api_reference/models/void_initiated_ledger_entry.rb', line 344

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} metadata: #{@metadata.inspect}, id: #{@id.inspect}, ledger_sequence_number:"\
  " #{@ledger_sequence_number.inspect}, entry_status: #{@entry_status.inspect}, customer:"\
  " #{@customer.inspect}, starting_balance: #{@starting_balance.inspect}, ending_balance:"\
  " #{@ending_balance.inspect}, amount: #{@amount.inspect}, currency: #{@currency.inspect},"\
  " created_at: #{@created_at.inspect}, description: #{@description.inspect}, credit_block:"\
  " #{@credit_block.inspect}, entry_type: #{@entry_type.inspect}, new_block_expiry_date:"\
  " #{@new_block_expiry_date.inspect}, void_reason: #{@void_reason.inspect}, void_amount:"\
  " #{@void_amount.inspect}, additional_properties: #{@additional_properties}>"
end

#to_custom_created_atObject



241
242
243
# File 'lib/api_reference/models/void_initiated_ledger_entry.rb', line 241

def to_custom_created_at
  DateTimeHelper.to_rfc3339(created_at)
end

#to_custom_new_block_expiry_dateObject



245
246
247
# File 'lib/api_reference/models/void_initiated_ledger_entry.rb', line 245

def to_custom_new_block_expiry_date
  DateTimeHelper.to_rfc3339(new_block_expiry_date)
end

#to_sObject

Provides a human-readable string representation of the object.



332
333
334
335
336
337
338
339
340
341
# File 'lib/api_reference/models/void_initiated_ledger_entry.rb', line 332

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} metadata: #{@metadata}, id: #{@id}, ledger_sequence_number:"\
  " #{@ledger_sequence_number}, entry_status: #{@entry_status}, customer: #{@customer},"\
  " starting_balance: #{@starting_balance}, ending_balance: #{@ending_balance}, amount:"\
  " #{@amount}, currency: #{@currency}, created_at: #{@created_at}, description:"\
  " #{@description}, credit_block: #{@credit_block}, entry_type: #{@entry_type},"\
  " new_block_expiry_date: #{@new_block_expiry_date}, void_reason: #{@void_reason},"\
  " void_amount: #{@void_amount}, additional_properties: #{@additional_properties}>"
end