Class: AdvancedBilling::ProformaInvoiceTax
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- AdvancedBilling::ProformaInvoiceTax
- Defined in:
- lib/advanced_billing/models/proforma_invoice_tax.rb
Overview
ProformaInvoiceTax Model.
Instance Attribute Summary collapse
-
#line_item_breakouts ⇒ Array[InvoiceTaxBreakout]
TODO: Write general description for this method.
-
#percentage ⇒ String
TODO: Write general description for this method.
-
#source_type ⇒ ProformaInvoiceTaxSourceType
TODO: Write general description for this method.
-
#tax_amount ⇒ String
TODO: Write general description for this method.
-
#taxable_amount ⇒ String
TODO: Write general description for this method.
-
#title ⇒ String
TODO: Write general description for this method.
-
#uid ⇒ String
TODO: Write general description for this method.
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.
Instance Method Summary collapse
-
#initialize(uid: SKIP, title: SKIP, source_type: SKIP, percentage: SKIP, taxable_amount: SKIP, tax_amount: SKIP, line_item_breakouts: SKIP, additional_properties: {}) ⇒ ProformaInvoiceTax
constructor
A new instance of ProformaInvoiceTax.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(uid: SKIP, title: SKIP, source_type: SKIP, percentage: SKIP, taxable_amount: SKIP, tax_amount: SKIP, line_item_breakouts: SKIP, additional_properties: {}) ⇒ ProformaInvoiceTax
Returns a new instance of ProformaInvoiceTax.
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/advanced_billing/models/proforma_invoice_tax.rb', line 71 def initialize(uid: SKIP, title: SKIP, source_type: SKIP, percentage: SKIP, taxable_amount: SKIP, tax_amount: SKIP, line_item_breakouts: SKIP, additional_properties: {}) # Add additional model properties to the instance. additional_properties.each do |_name, _value| instance_variable_set("@#{_name}", _value) end @uid = uid unless uid == SKIP @title = title unless title == SKIP @source_type = source_type unless source_type == SKIP @percentage = percentage unless percentage == SKIP @taxable_amount = taxable_amount unless taxable_amount == SKIP @tax_amount = tax_amount unless tax_amount == SKIP @line_item_breakouts = line_item_breakouts unless line_item_breakouts == SKIP end |
Instance Attribute Details
#line_item_breakouts ⇒ Array[InvoiceTaxBreakout]
TODO: Write general description for this method
38 39 40 |
# File 'lib/advanced_billing/models/proforma_invoice_tax.rb', line 38 def line_item_breakouts @line_item_breakouts end |
#percentage ⇒ String
TODO: Write general description for this method
26 27 28 |
# File 'lib/advanced_billing/models/proforma_invoice_tax.rb', line 26 def percentage @percentage end |
#source_type ⇒ ProformaInvoiceTaxSourceType
TODO: Write general description for this method
22 23 24 |
# File 'lib/advanced_billing/models/proforma_invoice_tax.rb', line 22 def source_type @source_type end |
#tax_amount ⇒ String
TODO: Write general description for this method
34 35 36 |
# File 'lib/advanced_billing/models/proforma_invoice_tax.rb', line 34 def tax_amount @tax_amount end |
#taxable_amount ⇒ String
TODO: Write general description for this method
30 31 32 |
# File 'lib/advanced_billing/models/proforma_invoice_tax.rb', line 30 def taxable_amount @taxable_amount end |
#title ⇒ String
TODO: Write general description for this method
18 19 20 |
# File 'lib/advanced_billing/models/proforma_invoice_tax.rb', line 18 def title @title end |
#uid ⇒ String
TODO: Write general description for this method
14 15 16 |
# File 'lib/advanced_billing/models/proforma_invoice_tax.rb', line 14 def uid @uid end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
# File 'lib/advanced_billing/models/proforma_invoice_tax.rb', line 89 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. uid = hash.key?('uid') ? hash['uid'] : SKIP title = hash.key?('title') ? hash['title'] : SKIP source_type = hash.key?('source_type') ? hash['source_type'] : SKIP percentage = hash.key?('percentage') ? hash['percentage'] : SKIP taxable_amount = hash.key?('taxable_amount') ? hash['taxable_amount'] : SKIP tax_amount = hash.key?('tax_amount') ? hash['tax_amount'] : SKIP # Parameter is an array, so we need to iterate through it line_item_breakouts = nil unless hash['line_item_breakouts'].nil? line_item_breakouts = [] hash['line_item_breakouts'].each do |structure| line_item_breakouts << (InvoiceTaxBreakout.from_hash(structure) if structure) end end line_item_breakouts = SKIP unless hash.key?('line_item_breakouts') # Clean out expected properties from Hash. additional_properties = hash.reject { |k, _| names.value?(k) } # Create object from extracted values. ProformaInvoiceTax.new(uid: uid, title: title, source_type: source_type, percentage: percentage, taxable_amount: taxable_amount, tax_amount: tax_amount, line_item_breakouts: line_item_breakouts, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/advanced_billing/models/proforma_invoice_tax.rb', line 41 def self.names @_hash = {} if @_hash.nil? @_hash['uid'] = 'uid' @_hash['title'] = 'title' @_hash['source_type'] = 'source_type' @_hash['percentage'] = 'percentage' @_hash['taxable_amount'] = 'taxable_amount' @_hash['tax_amount'] = 'tax_amount' @_hash['line_item_breakouts'] = 'line_item_breakouts' @_hash end |
.nullables ⇒ Object
An array for nullable fields
67 68 69 |
# File 'lib/advanced_billing/models/proforma_invoice_tax.rb', line 67 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/advanced_billing/models/proforma_invoice_tax.rb', line 54 def self.optionals %w[ uid title source_type percentage taxable_amount tax_amount line_item_breakouts ] end |