Class: ApiReference::CreatedInvoice

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

Overview

CreatedInvoice 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:, voided_at:, paid_at:, issued_at:, scheduled_issue_at:, auto_collection:, issue_failed_at:, sync_failed_at:, payment_failed_at:, payment_started_at:, amount_due:, created_at:, currency:, customer:, due_date:, id:, invoice_pdf:, invoice_number:, subscription:, total:, customer_balance_transactions:, status:, invoice_source:, shipping_address:, billing_address:, hosted_invoice_url:, will_auto_issue:, eligible_to_issue_at:, customer_tax_id:, memo:, credit_notes:, payment_attempts:, discount:, discounts:, minimum:, minimum_amount:, maximum:, maximum_amount:, line_items:, subtotal:, invoice_date:, is_payable_now:, additional_properties: nil) ⇒ CreatedInvoice

Returns a new instance of CreatedInvoice.



308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
# File 'lib/api_reference/models/created_invoice.rb', line 308

def initialize(metadata:, voided_at:, paid_at:, issued_at:,
               scheduled_issue_at:, auto_collection:, issue_failed_at:,
               sync_failed_at:, payment_failed_at:, payment_started_at:,
               amount_due:, created_at:, currency:, customer:, due_date:,
               id:, invoice_pdf:, invoice_number:, subscription:, total:,
               customer_balance_transactions:, status:, invoice_source:,
               shipping_address:, billing_address:, hosted_invoice_url:,
               will_auto_issue:, eligible_to_issue_at:, customer_tax_id:,
               memo:, credit_notes:, payment_attempts:, discount:,
               discounts:, minimum:, minimum_amount:, maximum:,
               maximum_amount:, line_items:, subtotal:, invoice_date:,
               is_payable_now:, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @metadata = 
  @voided_at = voided_at
  @paid_at = paid_at
  @issued_at = issued_at
  @scheduled_issue_at = scheduled_issue_at
  @auto_collection = auto_collection
  @issue_failed_at = issue_failed_at
  @sync_failed_at = sync_failed_at
  @payment_failed_at = payment_failed_at
  @payment_started_at = payment_started_at
  @amount_due = amount_due
  @created_at = created_at
  @currency = currency
  @customer = customer
  @due_date = due_date
  @id = id
  @invoice_pdf = invoice_pdf
  @invoice_number = invoice_number
  @subscription = subscription
  @total = total
  @customer_balance_transactions = customer_balance_transactions
  @status = status
  @invoice_source = invoice_source
  @shipping_address = shipping_address
  @billing_address = billing_address
  @hosted_invoice_url = hosted_invoice_url
  @will_auto_issue = will_auto_issue
  @eligible_to_issue_at = eligible_to_issue_at
  @customer_tax_id = customer_tax_id
  @memo = memo
  @credit_notes = credit_notes
  @payment_attempts = payment_attempts
  @discount = discount
  @discounts = discounts
  @minimum = minimum
  @minimum_amount = minimum_amount
  @maximum = maximum
  @maximum_amount = maximum_amount
  @line_items = line_items
  @subtotal = subtotal
  @invoice_date = invoice_date
  @is_payable_now = is_payable_now
  @additional_properties = additional_properties
end

Instance Attribute Details

#amount_dueString

This is the final amount required to be charged to the customer and reflects the application of the customer balance to the total of the invoice.

Returns:

  • (String)


72
73
74
# File 'lib/api_reference/models/created_invoice.rb', line 72

def amount_due
  @amount_due
end

#auto_collectionAutoCollection

If the invoice is in draft, this timestamp will reflect when the invoice is scheduled to be issued.

Returns:



43
44
45
# File 'lib/api_reference/models/created_invoice.rb', line 43

def auto_collection
  @auto_collection
end

#billing_addressAddress

The total after any minimums and discounts have been applied.

Returns:



134
135
136
# File 'lib/api_reference/models/created_invoice.rb', line 134

def billing_address
  @billing_address
end

#created_atDateTime

The creation time of the resource in Orb.

Returns:

  • (DateTime)


76
77
78
# File 'lib/api_reference/models/created_invoice.rb', line 76

def created_at
  @created_at
end

#credit_notesArray[CreditNoteSummary]

A list of credit notes associated with the invoice

Returns:



168
169
170
# File 'lib/api_reference/models/created_invoice.rb', line 168

def credit_notes
  @credit_notes
end

#currencyString

An ISO 4217 currency string or credits

Returns:

  • (String)


80
81
82
# File 'lib/api_reference/models/created_invoice.rb', line 80

def currency
  @currency
end

#customerCustomerMinified

An ISO 4217 currency string or credits

Returns:



84
85
86
# File 'lib/api_reference/models/created_invoice.rb', line 84

def customer
  @customer
end

#customer_balance_transactionsArray[CustomerBalanceTransaction]

The total after any minimums and discounts have been applied.

Returns:



118
119
120
# File 'lib/api_reference/models/created_invoice.rb', line 118

def customer_balance_transactions
  @customer_balance_transactions
end

#customer_tax_idCustomerTaxId

If the invoice has a status of draft, this will be the time that the invoice will be eligible to be issued, otherwise it will be null. If auto-issue is true, the invoice will automatically begin issuing at this time.

Returns:



159
160
161
# File 'lib/api_reference/models/created_invoice.rb', line 159

def customer_tax_id
  @customer_tax_id
end

#discountObject

This field is deprecated in favor of discounts. If a discounts list is provided, the first discount in the list will be returned. If the list is empty, None will be returned.

Returns:

  • (Object)


178
179
180
# File 'lib/api_reference/models/created_invoice.rb', line 178

def discount
  @discount
end

#discountsArray[Object]

This field is deprecated in favor of discounts. If a discounts list is provided, the first discount in the list will be returned. If the list is empty, None will be returned.

Returns:

  • (Array[Object])


184
185
186
# File 'lib/api_reference/models/created_invoice.rb', line 184

def discounts
  @discounts
end

#due_dateDateTime

When the invoice payment is due. The due date is null if the invoice is not yet finalized.

Returns:

  • (DateTime)


89
90
91
# File 'lib/api_reference/models/created_invoice.rb', line 89

def due_date
  @due_date
end

#eligible_to_issue_atDateTime

If the invoice has a status of draft, this will be the time that the invoice will be eligible to be issued, otherwise it will be null. If auto-issue is true, the invoice will automatically begin issuing at this time.

Returns:

  • (DateTime)


152
153
154
# File 'lib/api_reference/models/created_invoice.rb', line 152

def eligible_to_issue_at
  @eligible_to_issue_at
end

#hosted_invoice_urlString

A URL for the customer-facing invoice portal. This URL expires 60 days after the link is generated, or 30 days after the invoice's due date — whichever is later.

Returns:

  • (String)


140
141
142
# File 'lib/api_reference/models/created_invoice.rb', line 140

def hosted_invoice_url
  @hosted_invoice_url
end

#idString

When the invoice payment is due. The due date is null if the invoice is not yet finalized.

Returns:

  • (String)


94
95
96
# File 'lib/api_reference/models/created_invoice.rb', line 94

def id
  @id
end

#invoice_dateDateTime

The scheduled date of the invoice

Returns:

  • (DateTime)


220
221
222
# File 'lib/api_reference/models/created_invoice.rb', line 220

def invoice_date
  @invoice_date
end

#invoice_numberString

Automatically generated invoice number to help track and reconcile invoices. Invoice numbers have a prefix such as RFOBWG. These can be sequential per account or customer.

Returns:

  • (String)


104
105
106
# File 'lib/api_reference/models/created_invoice.rb', line 104

def invoice_number
  @invoice_number
end

#invoice_pdfString

The link to download the PDF representation of the Invoice.

Returns:

  • (String)


98
99
100
# File 'lib/api_reference/models/created_invoice.rb', line 98

def invoice_pdf
  @invoice_pdf
end

#invoice_sourceInvoiceSource

The total after any minimums and discounts have been applied.

Returns:



126
127
128
# File 'lib/api_reference/models/created_invoice.rb', line 126

def invoice_source
  @invoice_source
end

#is_payable_nowTrueClass | FalseClass

True if the invoice has only in-advance fixed fees and is payable now

Returns:

  • (TrueClass | FalseClass)


224
225
226
# File 'lib/api_reference/models/created_invoice.rb', line 224

def is_payable_now
  @is_payable_now
end

#issue_failed_atDateTime

If the invoice failed to issue, this will be the last time it failed to issue (even if it is now in a different state.)

Returns:

  • (DateTime)


48
49
50
# File 'lib/api_reference/models/created_invoice.rb', line 48

def issue_failed_at
  @issue_failed_at
end

#issued_atDateTime

If the invoice has been issued, this will be the time it transitioned to issued (even if it is now in a different state.)

Returns:

  • (DateTime)


33
34
35
# File 'lib/api_reference/models/created_invoice.rb', line 33

def issued_at
  @issued_at
end

#line_itemsArray[InvoiceLineItem]

The breakdown of prices in this invoice.

Returns:



212
213
214
# File 'lib/api_reference/models/created_invoice.rb', line 212

def line_items
  @line_items
end

#maximumMaximum

This field is deprecated in favor of discounts. If a discounts list is provided, the first discount in the list will be returned. If the list is empty, None will be returned.

Returns:



202
203
204
# File 'lib/api_reference/models/created_invoice.rb', line 202

def maximum
  @maximum
end

#maximum_amountString

This field is deprecated in favor of discounts. If a discounts list is provided, the first discount in the list will be returned. If the list is empty, None will be returned.

Returns:

  • (String)


208
209
210
# File 'lib/api_reference/models/created_invoice.rb', line 208

def maximum_amount
  @maximum_amount
end

#memoString

Free-form text which is available on the invoice PDF and the Orb invoice portal.

Returns:

  • (String)


164
165
166
# File 'lib/api_reference/models/created_invoice.rb', line 164

def memo
  @memo
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/created_invoice.rb', line 18

def 
  @metadata
end

#minimumMinimum

This field is deprecated in favor of discounts. If a discounts list is provided, the first discount in the list will be returned. If the list is empty, None will be returned.

Returns:



190
191
192
# File 'lib/api_reference/models/created_invoice.rb', line 190

def minimum
  @minimum
end

#minimum_amountString

This field is deprecated in favor of discounts. If a discounts list is provided, the first discount in the list will be returned. If the list is empty, None will be returned.

Returns:

  • (String)


196
197
198
# File 'lib/api_reference/models/created_invoice.rb', line 196

def minimum_amount
  @minimum_amount
end

If the invoice has a status of paid, this gives a timestamp when the invoice was paid.

Returns:

  • (DateTime)


28
29
30
# File 'lib/api_reference/models/created_invoice.rb', line 28

def paid_at
  @paid_at
end

#payment_attemptsArray[PaymentAttempt]

A list of payment attempts associated with the invoice

Returns:



172
173
174
# File 'lib/api_reference/models/created_invoice.rb', line 172

def payment_attempts
  @payment_attempts
end

#payment_failed_atDateTime

If payment was attempted on this invoice but failed, this will be the time of the most recent attempt.

Returns:

  • (DateTime)


59
60
61
# File 'lib/api_reference/models/created_invoice.rb', line 59

def payment_failed_at
  @payment_failed_at
end

#payment_started_atDateTime

If payment was attempted on this invoice, this will be the start time of the most recent attempt. This field is especially useful for delayed-notification payment mechanisms (like bank transfers), where payment can take 3 days or more.

Returns:

  • (DateTime)


66
67
68
# File 'lib/api_reference/models/created_invoice.rb', line 66

def payment_started_at
  @payment_started_at
end

#scheduled_issue_atDateTime

If the invoice is in draft, this timestamp will reflect when the invoice is scheduled to be issued.

Returns:

  • (DateTime)


38
39
40
# File 'lib/api_reference/models/created_invoice.rb', line 38

def scheduled_issue_at
  @scheduled_issue_at
end

#shipping_addressAddress

The total after any minimums and discounts have been applied.

Returns:



130
131
132
# File 'lib/api_reference/models/created_invoice.rb', line 130

def shipping_address
  @shipping_address
end

#statusStatus1

The total after any minimums and discounts have been applied.

Returns:



122
123
124
# File 'lib/api_reference/models/created_invoice.rb', line 122

def status
  @status
end

#subscriptionSubscriptionMinified

Automatically generated invoice number to help track and reconcile invoices. Invoice numbers have a prefix such as RFOBWG. These can be sequential per account or customer.



110
111
112
# File 'lib/api_reference/models/created_invoice.rb', line 110

def subscription
  @subscription
end

#subtotalString

The total before any discounts and minimums are applied.

Returns:

  • (String)


216
217
218
# File 'lib/api_reference/models/created_invoice.rb', line 216

def subtotal
  @subtotal
end

#sync_failed_atDateTime

If the invoice failed to sync, this will be the last time an external invoicing provider sync was attempted. This field will always be null for invoices using Orb Invoicing.

Returns:

  • (DateTime)


54
55
56
# File 'lib/api_reference/models/created_invoice.rb', line 54

def sync_failed_at
  @sync_failed_at
end

#totalString

The total after any minimums and discounts have been applied.

Returns:

  • (String)


114
115
116
# File 'lib/api_reference/models/created_invoice.rb', line 114

def total
  @total
end

#voided_atDateTime

If the invoice has a status of void, this gives a timestamp when the invoice was voided.

Returns:

  • (DateTime)


23
24
25
# File 'lib/api_reference/models/created_invoice.rb', line 23

def voided_at
  @voided_at
end

#will_auto_issueTrueClass | FalseClass

This is true if the invoice will be automatically issued in the future, and false otherwise.

Returns:

  • (TrueClass | FalseClass)


145
146
147
# File 'lib/api_reference/models/created_invoice.rb', line 145

def will_auto_issue
  @will_auto_issue
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
# File 'lib/api_reference/models/created_invoice.rb', line 369

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
   = hash.key?('metadata') ? hash['metadata'] : nil
  voided_at = if hash.key?('voided_at')
                (DateTimeHelper.from_rfc3339(hash['voided_at']) if hash['voided_at'])
              end
  paid_at = if hash.key?('paid_at')
              (DateTimeHelper.from_rfc3339(hash['paid_at']) if hash['paid_at'])
            end
  issued_at = if hash.key?('issued_at')
                (DateTimeHelper.from_rfc3339(hash['issued_at']) if hash['issued_at'])
              end
  scheduled_issue_at = if hash.key?('scheduled_issue_at')
                         (DateTimeHelper.from_rfc3339(hash['scheduled_issue_at']) if hash['scheduled_issue_at'])
                       end
  auto_collection = AutoCollection.from_hash(hash['auto_collection']) if
    hash['auto_collection']
  issue_failed_at = if hash.key?('issue_failed_at')
                      (DateTimeHelper.from_rfc3339(hash['issue_failed_at']) if hash['issue_failed_at'])
                    end
  sync_failed_at = if hash.key?('sync_failed_at')
                     (DateTimeHelper.from_rfc3339(hash['sync_failed_at']) if hash['sync_failed_at'])
                   end
  payment_failed_at = if hash.key?('payment_failed_at')
                        (DateTimeHelper.from_rfc3339(hash['payment_failed_at']) if hash['payment_failed_at'])
                      end
  payment_started_at = if hash.key?('payment_started_at')
                         (DateTimeHelper.from_rfc3339(hash['payment_started_at']) if hash['payment_started_at'])
                       end
  amount_due = hash.key?('amount_due') ? hash['amount_due'] : nil
  created_at = if hash.key?('created_at')
                 (DateTimeHelper.from_rfc3339(hash['created_at']) if hash['created_at'])
               end
  currency = hash.key?('currency') ? hash['currency'] : nil
  customer = CustomerMinified.from_hash(hash['customer']) if hash['customer']
  due_date = if hash.key?('due_date')
               (DateTimeHelper.from_rfc3339(hash['due_date']) if hash['due_date'])
             end
  id = hash.key?('id') ? hash['id'] : nil
  invoice_pdf = hash.key?('invoice_pdf') ? hash['invoice_pdf'] : nil
  invoice_number =
    hash.key?('invoice_number') ? hash['invoice_number'] : nil
  subscription = SubscriptionMinified.from_hash(hash['subscription']) if hash['subscription']
  total = hash.key?('total') ? hash['total'] : nil
  # Parameter is an array, so we need to iterate through it
  customer_balance_transactions = nil
  unless hash['customer_balance_transactions'].nil?
    customer_balance_transactions = []
    hash['customer_balance_transactions'].each do |structure|
      customer_balance_transactions << (CustomerBalanceTransaction.from_hash(structure) if structure)
    end
  end

  customer_balance_transactions = nil unless hash.key?('customer_balance_transactions')
  status = hash.key?('status') ? hash['status'] : nil
  invoice_source =
    hash.key?('invoice_source') ? hash['invoice_source'] : nil
  shipping_address = Address.from_hash(hash['shipping_address']) if hash['shipping_address']
  billing_address = Address.from_hash(hash['billing_address']) if hash['billing_address']
  hosted_invoice_url =
    hash.key?('hosted_invoice_url') ? hash['hosted_invoice_url'] : nil
  will_auto_issue =
    hash.key?('will_auto_issue') ? hash['will_auto_issue'] : nil
  eligible_to_issue_at = if hash.key?('eligible_to_issue_at')
                           (DateTimeHelper.from_rfc3339(hash['eligible_to_issue_at']) if hash['eligible_to_issue_at'])
                         end
  customer_tax_id = CustomerTaxId.from_hash(hash['customer_tax_id']) if
    hash['customer_tax_id']
  memo = hash.key?('memo') ? hash['memo'] : nil
  # Parameter is an array, so we need to iterate through it
  credit_notes = nil
  unless hash['credit_notes'].nil?
    credit_notes = []
    hash['credit_notes'].each do |structure|
      credit_notes << (CreditNoteSummary.from_hash(structure) if structure)
    end
  end

  credit_notes = nil unless hash.key?('credit_notes')
  # Parameter is an array, so we need to iterate through it
  payment_attempts = nil
  unless hash['payment_attempts'].nil?
    payment_attempts = []
    hash['payment_attempts'].each do |structure|
      payment_attempts << (PaymentAttempt.from_hash(structure) if structure)
    end
  end

  payment_attempts = nil unless hash.key?('payment_attempts')
  discount = hash.key?('discount') ? hash['discount'] : nil
  discounts = hash.key?('discounts') ? APIHelper.deserialize_union_type(
    UnionTypeLookUp.get(:InvoiceLevelDiscount), hash['discounts']
  ) : nil
  minimum = Minimum.from_hash(hash['minimum']) if hash['minimum']
  minimum_amount =
    hash.key?('minimum_amount') ? hash['minimum_amount'] : nil
  maximum = Maximum.from_hash(hash['maximum']) if hash['maximum']
  maximum_amount =
    hash.key?('maximum_amount') ? hash['maximum_amount'] : nil
  # Parameter is an array, so we need to iterate through it
  line_items = nil
  unless hash['line_items'].nil?
    line_items = []
    hash['line_items'].each do |structure|
      line_items << (InvoiceLineItem.from_hash(structure) if structure)
    end
  end

  line_items = nil unless hash.key?('line_items')
  subtotal = hash.key?('subtotal') ? hash['subtotal'] : nil
  invoice_date = if hash.key?('invoice_date')
                   (DateTimeHelper.from_rfc3339(hash['invoice_date']) if hash['invoice_date'])
                 end
  is_payable_now =
    hash.key?('is_payable_now') ? hash['is_payable_now'] : 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.
  CreatedInvoice.new(metadata: ,
                     voided_at: voided_at,
                     paid_at: paid_at,
                     issued_at: issued_at,
                     scheduled_issue_at: scheduled_issue_at,
                     auto_collection: auto_collection,
                     issue_failed_at: issue_failed_at,
                     sync_failed_at: sync_failed_at,
                     payment_failed_at: payment_failed_at,
                     payment_started_at: payment_started_at,
                     amount_due: amount_due,
                     created_at: created_at,
                     currency: currency,
                     customer: customer,
                     due_date: due_date,
                     id: id,
                     invoice_pdf: invoice_pdf,
                     invoice_number: invoice_number,
                     subscription: subscription,
                     total: total,
                     customer_balance_transactions: customer_balance_transactions,
                     status: status,
                     invoice_source: invoice_source,
                     shipping_address: shipping_address,
                     billing_address: billing_address,
                     hosted_invoice_url: hosted_invoice_url,
                     will_auto_issue: will_auto_issue,
                     eligible_to_issue_at: eligible_to_issue_at,
                     customer_tax_id: customer_tax_id,
                     memo: memo,
                     credit_notes: credit_notes,
                     payment_attempts: payment_attempts,
                     discount: discount,
                     discounts: discounts,
                     minimum: minimum,
                     minimum_amount: minimum_amount,
                     maximum: maximum,
                     maximum_amount: maximum_amount,
                     line_items: line_items,
                     subtotal: subtotal,
                     invoice_date: invoice_date,
                     is_payable_now: is_payable_now,
                     additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
# File 'lib/api_reference/models/created_invoice.rb', line 227

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['metadata'] = 'metadata'
  @_hash['voided_at'] = 'voided_at'
  @_hash['paid_at'] = 'paid_at'
  @_hash['issued_at'] = 'issued_at'
  @_hash['scheduled_issue_at'] = 'scheduled_issue_at'
  @_hash['auto_collection'] = 'auto_collection'
  @_hash['issue_failed_at'] = 'issue_failed_at'
  @_hash['sync_failed_at'] = 'sync_failed_at'
  @_hash['payment_failed_at'] = 'payment_failed_at'
  @_hash['payment_started_at'] = 'payment_started_at'
  @_hash['amount_due'] = 'amount_due'
  @_hash['created_at'] = 'created_at'
  @_hash['currency'] = 'currency'
  @_hash['customer'] = 'customer'
  @_hash['due_date'] = 'due_date'
  @_hash['id'] = 'id'
  @_hash['invoice_pdf'] = 'invoice_pdf'
  @_hash['invoice_number'] = 'invoice_number'
  @_hash['subscription'] = 'subscription'
  @_hash['total'] = 'total'
  @_hash['customer_balance_transactions'] =
    'customer_balance_transactions'
  @_hash['status'] = 'status'
  @_hash['invoice_source'] = 'invoice_source'
  @_hash['shipping_address'] = 'shipping_address'
  @_hash['billing_address'] = 'billing_address'
  @_hash['hosted_invoice_url'] = 'hosted_invoice_url'
  @_hash['will_auto_issue'] = 'will_auto_issue'
  @_hash['eligible_to_issue_at'] = 'eligible_to_issue_at'
  @_hash['customer_tax_id'] = 'customer_tax_id'
  @_hash['memo'] = 'memo'
  @_hash['credit_notes'] = 'credit_notes'
  @_hash['payment_attempts'] = 'payment_attempts'
  @_hash['discount'] = 'discount'
  @_hash['discounts'] = 'discounts'
  @_hash['minimum'] = 'minimum'
  @_hash['minimum_amount'] = 'minimum_amount'
  @_hash['maximum'] = 'maximum'
  @_hash['maximum_amount'] = 'maximum_amount'
  @_hash['line_items'] = 'line_items'
  @_hash['subtotal'] = 'subtotal'
  @_hash['invoice_date'] = 'invoice_date'
  @_hash['is_payable_now'] = 'is_payable_now'
  @_hash
end

.nullablesObject

An array for nullable fields



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

def self.nullables
  %w[
    voided_at
    paid_at
    issued_at
    scheduled_issue_at
    issue_failed_at
    sync_failed_at
    payment_failed_at
    payment_started_at
    due_date
    invoice_pdf
    subscription
    shipping_address
    billing_address
    hosted_invoice_url
    eligible_to_issue_at
    customer_tax_id
    memo
    discount
    minimum
    minimum_amount
    maximum
    maximum_amount
  ]
end

.optionalsObject

An array for optional fields



276
277
278
# File 'lib/api_reference/models/created_invoice.rb', line 276

def self.optionals
  []
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:

  • The (CreatedInvoice | Hash)

    value against the validation is performed.



590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
# File 'lib/api_reference/models/created_invoice.rb', line 590

def self.validate(value)
  if value.instance_of? self
    return (
      APIHelper.valid_type?(value.,
                            ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.voided_at,
                              ->(val) { val.instance_of? DateTime }) and
        APIHelper.valid_type?(value.paid_at,
                              ->(val) { val.instance_of? DateTime }) and
        APIHelper.valid_type?(value.issued_at,
                              ->(val) { val.instance_of? DateTime }) and
        APIHelper.valid_type?(value.scheduled_issue_at,
                              ->(val) { val.instance_of? DateTime }) and
        APIHelper.valid_type?(value.auto_collection,
                              ->(val) { AutoCollection.validate(val) },
                              is_model_hash: true) and
        APIHelper.valid_type?(value.issue_failed_at,
                              ->(val) { val.instance_of? DateTime }) and
        APIHelper.valid_type?(value.sync_failed_at,
                              ->(val) { val.instance_of? DateTime }) and
        APIHelper.valid_type?(value.payment_failed_at,
                              ->(val) { val.instance_of? DateTime }) and
        APIHelper.valid_type?(value.payment_started_at,
                              ->(val) { val.instance_of? DateTime }) and
        APIHelper.valid_type?(value.amount_due,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.created_at,
                              ->(val) { val.instance_of? DateTime }) and
        APIHelper.valid_type?(value.currency,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.customer,
                              ->(val) { CustomerMinified.validate(val) },
                              is_model_hash: true) and
        APIHelper.valid_type?(value.due_date,
                              ->(val) { val.instance_of? DateTime }) and
        APIHelper.valid_type?(value.id,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.invoice_pdf,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.invoice_number,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.subscription,
                              ->(val) { SubscriptionMinified.validate(val) },
                              is_model_hash: true) and
        APIHelper.valid_type?(value.total,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.customer_balance_transactions,
                              ->(val) { CustomerBalanceTransaction.validate(val) },
                              is_model_hash: true,
                              is_inner_model_hash: true) and
        APIHelper.valid_type?(value.status,
                              ->(val) { Status1.validate(val) }) and
        APIHelper.valid_type?(value.invoice_source,
                              ->(val) { InvoiceSource.validate(val) }) and
        APIHelper.valid_type?(value.shipping_address,
                              ->(val) { Address.validate(val) },
                              is_model_hash: true) and
        APIHelper.valid_type?(value.billing_address,
                              ->(val) { Address.validate(val) },
                              is_model_hash: true) and
        APIHelper.valid_type?(value.hosted_invoice_url,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.will_auto_issue,
                              ->(val) { val.instance_of? TrueClass or val.instance_of? FalseClass }) and
        APIHelper.valid_type?(value.eligible_to_issue_at,
                              ->(val) { val.instance_of? DateTime }) and
        APIHelper.valid_type?(value.customer_tax_id,
                              ->(val) { CustomerTaxId.validate(val) },
                              is_model_hash: true) and
        APIHelper.valid_type?(value.memo,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.credit_notes,
                              ->(val) { CreditNoteSummary.validate(val) },
                              is_model_hash: true,
                              is_inner_model_hash: true) and
        APIHelper.valid_type?(value.payment_attempts,
                              ->(val) { PaymentAttempt.validate(val) },
                              is_model_hash: true,
                              is_inner_model_hash: true) and
        APIHelper.valid_type?(value.discount,
                              ->(val) { val.instance_of? Object }) and
        UnionTypeLookUp.get(:InvoiceLevelDiscount)
                       .validate(value.discounts) and
        APIHelper.valid_type?(value.minimum,
                              ->(val) { Minimum.validate(val) },
                              is_model_hash: true) and
        APIHelper.valid_type?(value.minimum_amount,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.maximum,
                              ->(val) { Maximum.validate(val) },
                              is_model_hash: true) and
        APIHelper.valid_type?(value.maximum_amount,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.line_items,
                              ->(val) { InvoiceLineItem.validate(val) },
                              is_model_hash: true,
                              is_inner_model_hash: true) and
        APIHelper.valid_type?(value.subtotal,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.invoice_date,
                              ->(val) { val.instance_of? DateTime }) and
        APIHelper.valid_type?(value.is_payable_now,
                              ->(val) { val.instance_of? TrueClass or val.instance_of? FalseClass })
    )
  end

  return false unless value.instance_of? Hash

  (
    APIHelper.valid_type?(value['metadata'],
                          ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['voided_at'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['paid_at'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['issued_at'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['scheduled_issue_at'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['auto_collection'],
                            ->(val) { AutoCollection.validate(val) },
                            is_model_hash: true) and
      APIHelper.valid_type?(value['issue_failed_at'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['sync_failed_at'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['payment_failed_at'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['payment_started_at'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['amount_due'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['created_at'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['currency'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['customer'],
                            ->(val) { CustomerMinified.validate(val) },
                            is_model_hash: true) and
      APIHelper.valid_type?(value['due_date'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['id'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['invoice_pdf'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['invoice_number'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['subscription'],
                            ->(val) { SubscriptionMinified.validate(val) },
                            is_model_hash: true) and
      APIHelper.valid_type?(value['total'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['customer_balance_transactions'],
                            ->(val) { CustomerBalanceTransaction.validate(val) },
                            is_model_hash: true,
                            is_inner_model_hash: true) and
      APIHelper.valid_type?(value['status'],
                            ->(val) { Status1.validate(val) }) and
      APIHelper.valid_type?(value['invoice_source'],
                            ->(val) { InvoiceSource.validate(val) }) and
      APIHelper.valid_type?(value['shipping_address'],
                            ->(val) { Address.validate(val) },
                            is_model_hash: true) and
      APIHelper.valid_type?(value['billing_address'],
                            ->(val) { Address.validate(val) },
                            is_model_hash: true) and
      APIHelper.valid_type?(value['hosted_invoice_url'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['will_auto_issue'],
                            ->(val) { val.instance_of? TrueClass or val.instance_of? FalseClass }) and
      APIHelper.valid_type?(value['eligible_to_issue_at'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['customer_tax_id'],
                            ->(val) { CustomerTaxId.validate(val) },
                            is_model_hash: true) and
      APIHelper.valid_type?(value['memo'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['credit_notes'],
                            ->(val) { CreditNoteSummary.validate(val) },
                            is_model_hash: true,
                            is_inner_model_hash: true) and
      APIHelper.valid_type?(value['payment_attempts'],
                            ->(val) { PaymentAttempt.validate(val) },
                            is_model_hash: true,
                            is_inner_model_hash: true) and
      APIHelper.valid_type?(value['discount'],
                            ->(val) { val.instance_of? Object }) and
      UnionTypeLookUp.get(:InvoiceLevelDiscount)
                     .validate(value['discounts']) and
      APIHelper.valid_type?(value['minimum'],
                            ->(val) { Minimum.validate(val) },
                            is_model_hash: true) and
      APIHelper.valid_type?(value['minimum_amount'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['maximum'],
                            ->(val) { Maximum.validate(val) },
                            is_model_hash: true) and
      APIHelper.valid_type?(value['maximum_amount'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['line_items'],
                            ->(val) { InvoiceLineItem.validate(val) },
                            is_model_hash: true,
                            is_inner_model_hash: true) and
      APIHelper.valid_type?(value['subtotal'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['invoice_date'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['is_payable_now'],
                            ->(val) { val.instance_of? TrueClass or val.instance_of? FalseClass })
  )
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
# File 'lib/api_reference/models/created_invoice.rb', line 825

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} metadata: #{@metadata.inspect}, voided_at: #{@voided_at.inspect}, paid_at:"\
  " #{@paid_at.inspect}, issued_at: #{@issued_at.inspect}, scheduled_issue_at:"\
  " #{@scheduled_issue_at.inspect}, auto_collection: #{@auto_collection.inspect},"\
  " issue_failed_at: #{@issue_failed_at.inspect}, sync_failed_at: #{@sync_failed_at.inspect},"\
  " payment_failed_at: #{@payment_failed_at.inspect}, payment_started_at:"\
  " #{@payment_started_at.inspect}, amount_due: #{@amount_due.inspect}, created_at:"\
  " #{@created_at.inspect}, currency: #{@currency.inspect}, customer: #{@customer.inspect},"\
  " due_date: #{@due_date.inspect}, id: #{@id.inspect}, invoice_pdf: #{@invoice_pdf.inspect},"\
  " invoice_number: #{@invoice_number.inspect}, subscription: #{@subscription.inspect}, total:"\
  " #{@total.inspect}, customer_balance_transactions:"\
  " #{@customer_balance_transactions.inspect}, status: #{@status.inspect}, invoice_source:"\
  " #{@invoice_source.inspect}, shipping_address: #{@shipping_address.inspect},"\
  " billing_address: #{@billing_address.inspect}, hosted_invoice_url:"\
  " #{@hosted_invoice_url.inspect}, will_auto_issue: #{@will_auto_issue.inspect},"\
  " eligible_to_issue_at: #{@eligible_to_issue_at.inspect}, customer_tax_id:"\
  " #{@customer_tax_id.inspect}, memo: #{@memo.inspect}, credit_notes:"\
  " #{@credit_notes.inspect}, payment_attempts: #{@payment_attempts.inspect}, discount:"\
  " #{@discount.inspect}, discounts: #{@discounts.inspect}, minimum: #{@minimum.inspect},"\
  " minimum_amount: #{@minimum_amount.inspect}, maximum: #{@maximum.inspect}, maximum_amount:"\
  " #{@maximum_amount.inspect}, line_items: #{@line_items.inspect}, subtotal:"\
  " #{@subtotal.inspect}, invoice_date: #{@invoice_date.inspect}, is_payable_now:"\
  " #{@is_payable_now.inspect}, additional_properties: #{@additional_properties}>"
end

#to_custom_created_atObject



572
573
574
# File 'lib/api_reference/models/created_invoice.rb', line 572

def to_custom_created_at
  DateTimeHelper.to_rfc3339(created_at)
end

#to_custom_due_dateObject



576
577
578
# File 'lib/api_reference/models/created_invoice.rb', line 576

def to_custom_due_date
  DateTimeHelper.to_rfc3339(due_date)
end

#to_custom_eligible_to_issue_atObject



580
581
582
# File 'lib/api_reference/models/created_invoice.rb', line 580

def to_custom_eligible_to_issue_at
  DateTimeHelper.to_rfc3339(eligible_to_issue_at)
end

#to_custom_invoice_dateObject



584
585
586
# File 'lib/api_reference/models/created_invoice.rb', line 584

def to_custom_invoice_date
  DateTimeHelper.to_rfc3339(invoice_date)
end

#to_custom_issue_failed_atObject



556
557
558
# File 'lib/api_reference/models/created_invoice.rb', line 556

def to_custom_issue_failed_at
  DateTimeHelper.to_rfc3339(issue_failed_at)
end

#to_custom_issued_atObject



548
549
550
# File 'lib/api_reference/models/created_invoice.rb', line 548

def to_custom_issued_at
  DateTimeHelper.to_rfc3339(issued_at)
end

#to_custom_paid_atObject



544
545
546
# File 'lib/api_reference/models/created_invoice.rb', line 544

def to_custom_paid_at
  DateTimeHelper.to_rfc3339(paid_at)
end

#to_custom_payment_failed_atObject



564
565
566
# File 'lib/api_reference/models/created_invoice.rb', line 564

def to_custom_payment_failed_at
  DateTimeHelper.to_rfc3339(payment_failed_at)
end

#to_custom_payment_started_atObject



568
569
570
# File 'lib/api_reference/models/created_invoice.rb', line 568

def to_custom_payment_started_at
  DateTimeHelper.to_rfc3339(payment_started_at)
end

#to_custom_scheduled_issue_atObject



552
553
554
# File 'lib/api_reference/models/created_invoice.rb', line 552

def to_custom_scheduled_issue_at
  DateTimeHelper.to_rfc3339(scheduled_issue_at)
end

#to_custom_sync_failed_atObject



560
561
562
# File 'lib/api_reference/models/created_invoice.rb', line 560

def to_custom_sync_failed_at
  DateTimeHelper.to_rfc3339(sync_failed_at)
end

#to_custom_voided_atObject



540
541
542
# File 'lib/api_reference/models/created_invoice.rb', line 540

def to_custom_voided_at
  DateTimeHelper.to_rfc3339(voided_at)
end

#to_sObject

Provides a human-readable string representation of the object.



803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
# File 'lib/api_reference/models/created_invoice.rb', line 803

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} metadata: #{@metadata}, voided_at: #{@voided_at}, paid_at: #{@paid_at},"\
  " issued_at: #{@issued_at}, scheduled_issue_at: #{@scheduled_issue_at}, auto_collection:"\
  " #{@auto_collection}, issue_failed_at: #{@issue_failed_at}, sync_failed_at:"\
  " #{@sync_failed_at}, payment_failed_at: #{@payment_failed_at}, payment_started_at:"\
  " #{@payment_started_at}, amount_due: #{@amount_due}, created_at: #{@created_at}, currency:"\
  " #{@currency}, customer: #{@customer}, due_date: #{@due_date}, id: #{@id}, invoice_pdf:"\
  " #{@invoice_pdf}, invoice_number: #{@invoice_number}, subscription: #{@subscription},"\
  " total: #{@total}, customer_balance_transactions: #{@customer_balance_transactions},"\
  " status: #{@status}, invoice_source: #{@invoice_source}, shipping_address:"\
  " #{@shipping_address}, billing_address: #{@billing_address}, hosted_invoice_url:"\
  " #{@hosted_invoice_url}, will_auto_issue: #{@will_auto_issue}, eligible_to_issue_at:"\
  " #{@eligible_to_issue_at}, customer_tax_id: #{@customer_tax_id}, memo: #{@memo},"\
  " credit_notes: #{@credit_notes}, payment_attempts: #{@payment_attempts}, discount:"\
  " #{@discount}, discounts: #{@discounts}, minimum: #{@minimum}, minimum_amount:"\
  " #{@minimum_amount}, maximum: #{@maximum}, maximum_amount: #{@maximum_amount}, line_items:"\
  " #{@line_items}, subtotal: #{@subtotal}, invoice_date: #{@invoice_date}, is_payable_now:"\
  " #{@is_payable_now}, additional_properties: #{@additional_properties}>"
end