Class: AdvancedBilling::IssueInvoiceEventData
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- AdvancedBilling::IssueInvoiceEventData
- Defined in:
- lib/advanced_billing/models/issue_invoice_event_data.rb
Overview
Example schema for an ‘issue_invoice` event
Instance Attribute Summary collapse
-
#consolidation_level ⇒ InvoiceConsolidationLevel
Consolidation level of the invoice, which is applicable to invoice consolidation.
-
#due_amount ⇒ String
Amount due on the invoice, which is ‘total_amount - credit_amount - paid_amount`.
-
#from_status ⇒ Status
The status of the invoice before event occurence.
-
#to_status ⇒ Status
The status of the invoice after event occurence.
-
#total_amount ⇒ String
The invoice total, which is ‘subtotal_amount - discount_amount + tax_amount`.’.
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.
-
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
Instance Method Summary collapse
-
#initialize(consolidation_level = SKIP, from_status = SKIP, to_status = SKIP, due_amount = SKIP, total_amount = SKIP) ⇒ IssueInvoiceEventData
constructor
A new instance of IssueInvoiceEventData.
Methods inherited from BaseModel
Constructor Details
#initialize(consolidation_level = SKIP, from_status = SKIP, to_status = SKIP, due_amount = SKIP, total_amount = SKIP) ⇒ IssueInvoiceEventData
Returns a new instance of IssueInvoiceEventData.
76 77 78 79 80 81 82 83 |
# File 'lib/advanced_billing/models/issue_invoice_event_data.rb', line 76 def initialize(consolidation_level = SKIP, from_status = SKIP, to_status = SKIP, due_amount = SKIP, total_amount = SKIP) @consolidation_level = consolidation_level unless consolidation_level == SKIP @from_status = from_status unless from_status == SKIP @to_status = to_status unless to_status == SKIP @due_amount = due_amount unless due_amount == SKIP @total_amount = total_amount unless total_amount == SKIP end |
Instance Attribute Details
#consolidation_level ⇒ InvoiceConsolidationLevel
Consolidation level of the invoice, which is applicable to invoice consolidation. It will hold one of the following values:
-
“none”: A normal invoice with no consolidation.
-
“child”: An invoice segment which has been combined into a consolidated
invoice.
-
“parent”: A consolidated invoice, whose contents are composed of invoice
segments. “Parent” invoices do not have lines of their own, but they have subtotals and totals which aggregate the member invoice segments. See also the [invoice consolidation documentation](chargify.zendesk.com/hc/en-us/articles/440774639183 5).
25 26 27 |
# File 'lib/advanced_billing/models/issue_invoice_event_data.rb', line 25 def consolidation_level @consolidation_level end |
#due_amount ⇒ String
Amount due on the invoice, which is ‘total_amount - credit_amount - paid_amount`.
42 43 44 |
# File 'lib/advanced_billing/models/issue_invoice_event_data.rb', line 42 def due_amount @due_amount end |
#from_status ⇒ Status
The status of the invoice before event occurence. See [Invoice Statuses](chargify.zendesk.com/hc/en-us/articles/4407737494171#lin e-item-breakdowns) for more.
31 32 33 |
# File 'lib/advanced_billing/models/issue_invoice_event_data.rb', line 31 def from_status @from_status end |
#to_status ⇒ Status
The status of the invoice after event occurence. See [Invoice Statuses](chargify.zendesk.com/hc/en-us/articles/4407737494171#lin e-item-breakdowns) for more.
37 38 39 |
# File 'lib/advanced_billing/models/issue_invoice_event_data.rb', line 37 def to_status @to_status end |
#total_amount ⇒ String
The invoice total, which is ‘subtotal_amount - discount_amount + tax_amount`.’
47 48 49 |
# File 'lib/advanced_billing/models/issue_invoice_event_data.rb', line 47 def total_amount @total_amount end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/advanced_billing/models/issue_invoice_event_data.rb', line 86 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. consolidation_level = hash.key?('consolidation_level') ? hash['consolidation_level'] : SKIP from_status = hash.key?('from_status') ? hash['from_status'] : SKIP to_status = hash.key?('to_status') ? hash['to_status'] : SKIP due_amount = hash.key?('due_amount') ? hash['due_amount'] : SKIP total_amount = hash.key?('total_amount') ? hash['total_amount'] : SKIP # Create object from extracted values. IssueInvoiceEventData.new(consolidation_level, from_status, to_status, due_amount, total_amount) end |
.names ⇒ Object
A mapping from model property names to API property names.
50 51 52 53 54 55 56 57 58 |
# File 'lib/advanced_billing/models/issue_invoice_event_data.rb', line 50 def self.names @_hash = {} if @_hash.nil? @_hash['consolidation_level'] = 'consolidation_level' @_hash['from_status'] = 'from_status' @_hash['to_status'] = 'to_status' @_hash['due_amount'] = 'due_amount' @_hash['total_amount'] = 'total_amount' @_hash end |
.nullables ⇒ Object
An array for nullable fields
72 73 74 |
# File 'lib/advanced_billing/models/issue_invoice_event_data.rb', line 72 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
61 62 63 64 65 66 67 68 69 |
# File 'lib/advanced_billing/models/issue_invoice_event_data.rb', line 61 def self.optionals %w[ consolidation_level from_status to_status due_amount total_amount ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
107 108 109 110 111 112 113 |
# File 'lib/advanced_billing/models/issue_invoice_event_data.rb', line 107 def self.validate(value) return true if value.instance_of? self return false unless value.instance_of? Hash true end |