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 ⇒ InvoiceStatus
The status of the invoice before event occurrence.
-
#to_status ⇒ InvoiceStatus
The status of the invoice after event occurrence.
-
#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:, from_status:, to_status:, due_amount:, total_amount:, additional_properties: {}) ⇒ IssueInvoiceEventData
constructor
A new instance of IssueInvoiceEventData.
Methods inherited from BaseModel
Constructor Details
#initialize(consolidation_level:, from_status:, to_status:, due_amount:, total_amount:, additional_properties: {}) ⇒ IssueInvoiceEventData
Returns a new instance of IssueInvoiceEventData.
70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/advanced_billing/models/issue_invoice_event_data.rb', line 70 def initialize(consolidation_level:, from_status:, to_status:, due_amount:, total_amount:, additional_properties: {}) @consolidation_level = consolidation_level @from_status = from_status @to_status = to_status @due_amount = due_amount @total_amount = total_amount # Add additional model properties to the instance. additional_properties.each do |_name, _value| instance_variable_set("@#{_name}", _value) end 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](maxio.zendesk.com/hc/en-us/articles/24252269909389- Invoice-Consolidation).
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 ⇒ InvoiceStatus
The status of the invoice before event occurrence. See [Invoice Statuses](maxio.zendesk.com/hc/en-us/articles/24252287829645-Advan ced-Billing-Invoices-Overview#invoice-statuses) 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 ⇒ InvoiceStatus
The status of the invoice after event occurrence. See [Invoice Statuses](maxio.zendesk.com/hc/en-us/articles/24252287829645-Advan ced-Billing-Invoices-Overview#invoice-statuses) 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.
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/advanced_billing/models/issue_invoice_event_data.rb', line 85 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. consolidation_level = hash.key?('consolidation_level') ? hash['consolidation_level'] : nil from_status = hash.key?('from_status') ? hash['from_status'] : nil to_status = hash.key?('to_status') ? hash['to_status'] : nil due_amount = hash.key?('due_amount') ? hash['due_amount'] : nil total_amount = hash.key?('total_amount') ? hash['total_amount'] : nil # Clean out expected properties from Hash. names.each_value { |k| hash.delete(k) } # Create object from extracted values. IssueInvoiceEventData.new(consolidation_level: consolidation_level, from_status: from_status, to_status: to_status, due_amount: due_amount, total_amount: total_amount, additional_properties: hash) 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
66 67 68 |
# File 'lib/advanced_billing/models/issue_invoice_event_data.rb', line 66 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
61 62 63 |
# File 'lib/advanced_billing/models/issue_invoice_event_data.rb', line 61 def self.optionals [] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 |
# File 'lib/advanced_billing/models/issue_invoice_event_data.rb', line 110 def self.validate(value) if value.instance_of? self return ( APIHelper.valid_type?(value.consolidation_level, ->(val) { InvoiceConsolidationLevel.validate(val) }) and APIHelper.valid_type?(value.from_status, ->(val) { InvoiceStatus.validate(val) }) and APIHelper.valid_type?(value.to_status, ->(val) { InvoiceStatus.validate(val) }) and APIHelper.valid_type?(value.due_amount, ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value.total_amount, ->(val) { val.instance_of? String }) ) end return false unless value.instance_of? Hash ( APIHelper.valid_type?(value['consolidation_level'], ->(val) { InvoiceConsolidationLevel.validate(val) }) and APIHelper.valid_type?(value['from_status'], ->(val) { InvoiceStatus.validate(val) }) and APIHelper.valid_type?(value['to_status'], ->(val) { InvoiceStatus.validate(val) }) and APIHelper.valid_type?(value['due_amount'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['total_amount'], ->(val) { val.instance_of? String }) ) end |