Class: AdvancedBilling::ProformaInvoiceDiscount
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- AdvancedBilling::ProformaInvoiceDiscount
- Defined in:
- lib/advanced_billing/models/proforma_invoice_discount.rb
Overview
ProformaInvoiceDiscount Model.
Instance Attribute Summary collapse
-
#discount_amount ⇒ String
TODO: Write general description for this method.
-
#discount_type ⇒ String
TODO: Write general description for this method.
-
#eligible_amount ⇒ String
TODO: Write general description for this method.
-
#line_item_breakouts ⇒ Array[ProformaInvoiceDiscountBreakout]
TODO: Write general description for this method.
-
#source_type ⇒ String
TODO: Write general description for this method.
-
#title ⇒ 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(title = SKIP, source_type = SKIP, discount_type = SKIP, eligible_amount = SKIP, discount_amount = SKIP, line_item_breakouts = SKIP) ⇒ ProformaInvoiceDiscount
constructor
A new instance of ProformaInvoiceDiscount.
Methods inherited from BaseModel
Constructor Details
#initialize(title = SKIP, source_type = SKIP, discount_type = SKIP, eligible_amount = SKIP, discount_amount = SKIP, line_item_breakouts = SKIP) ⇒ ProformaInvoiceDiscount
Returns a new instance of ProformaInvoiceDiscount.
65 66 67 68 69 70 71 72 73 74 |
# File 'lib/advanced_billing/models/proforma_invoice_discount.rb', line 65 def initialize(title = SKIP, source_type = SKIP, discount_type = SKIP, eligible_amount = SKIP, discount_amount = SKIP, line_item_breakouts = SKIP) @title = title unless title == SKIP @source_type = source_type unless source_type == SKIP @discount_type = discount_type unless discount_type == SKIP @eligible_amount = eligible_amount unless eligible_amount == SKIP @discount_amount = discount_amount unless discount_amount == SKIP @line_item_breakouts = line_item_breakouts unless line_item_breakouts == SKIP end |
Instance Attribute Details
#discount_amount ⇒ String
TODO: Write general description for this method
30 31 32 |
# File 'lib/advanced_billing/models/proforma_invoice_discount.rb', line 30 def discount_amount @discount_amount end |
#discount_type ⇒ String
TODO: Write general description for this method
22 23 24 |
# File 'lib/advanced_billing/models/proforma_invoice_discount.rb', line 22 def discount_type @discount_type end |
#eligible_amount ⇒ String
TODO: Write general description for this method
26 27 28 |
# File 'lib/advanced_billing/models/proforma_invoice_discount.rb', line 26 def eligible_amount @eligible_amount end |
#line_item_breakouts ⇒ Array[ProformaInvoiceDiscountBreakout]
TODO: Write general description for this method
34 35 36 |
# File 'lib/advanced_billing/models/proforma_invoice_discount.rb', line 34 def line_item_breakouts @line_item_breakouts end |
#source_type ⇒ String
TODO: Write general description for this method
18 19 20 |
# File 'lib/advanced_billing/models/proforma_invoice_discount.rb', line 18 def source_type @source_type end |
#title ⇒ String
TODO: Write general description for this method
14 15 16 |
# File 'lib/advanced_billing/models/proforma_invoice_discount.rb', line 14 def title @title end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
77 78 79 80 81 82 83 84 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/proforma_invoice_discount.rb', line 77 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. title = hash.key?('title') ? hash['title'] : SKIP source_type = hash.key?('source_type') ? hash['source_type'] : SKIP discount_type = hash.key?('discount_type') ? hash['discount_type'] : SKIP eligible_amount = hash.key?('eligible_amount') ? hash['eligible_amount'] : SKIP discount_amount = hash.key?('discount_amount') ? hash['discount_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 << (ProformaInvoiceDiscountBreakout.from_hash(structure) if structure) end end line_item_breakouts = SKIP unless hash.key?('line_item_breakouts') # Create object from extracted values. ProformaInvoiceDiscount.new(title, source_type, discount_type, eligible_amount, discount_amount, line_item_breakouts) end |
.names ⇒ Object
A mapping from model property names to API property names.
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/advanced_billing/models/proforma_invoice_discount.rb', line 37 def self.names @_hash = {} if @_hash.nil? @_hash['title'] = 'title' @_hash['source_type'] = 'source_type' @_hash['discount_type'] = 'discount_type' @_hash['eligible_amount'] = 'eligible_amount' @_hash['discount_amount'] = 'discount_amount' @_hash['line_item_breakouts'] = 'line_item_breakouts' @_hash end |
.nullables ⇒ Object
An array for nullable fields
61 62 63 |
# File 'lib/advanced_billing/models/proforma_invoice_discount.rb', line 61 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
49 50 51 52 53 54 55 56 57 58 |
# File 'lib/advanced_billing/models/proforma_invoice_discount.rb', line 49 def self.optionals %w[ title source_type discount_type eligible_amount discount_amount line_item_breakouts ] end |