Class: AdvancedBilling::ProformaInvoiceDiscountBreakout

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/advanced_billing/models/proforma_invoice_discount_breakout.rb

Overview

ProformaInvoiceDiscountBreakout Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(eligible_amount = SKIP, discount_amount = SKIP) ⇒ ProformaInvoiceDiscountBreakout

Returns a new instance of ProformaInvoiceDiscountBreakout.



41
42
43
44
# File 'lib/advanced_billing/models/proforma_invoice_discount_breakout.rb', line 41

def initialize(eligible_amount = SKIP, discount_amount = SKIP)
  @eligible_amount = eligible_amount unless eligible_amount == SKIP
  @discount_amount = discount_amount unless discount_amount == SKIP
end

Instance Attribute Details

#discount_amountString

TODO: Write general description for this method

Returns:

  • (String)


18
19
20
# File 'lib/advanced_billing/models/proforma_invoice_discount_breakout.rb', line 18

def discount_amount
  @discount_amount
end

#eligible_amountString

TODO: Write general description for this method

Returns:

  • (String)


14
15
16
# File 'lib/advanced_billing/models/proforma_invoice_discount_breakout.rb', line 14

def eligible_amount
  @eligible_amount
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/advanced_billing/models/proforma_invoice_discount_breakout.rb', line 47

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  eligible_amount =
    hash.key?('eligible_amount') ? hash['eligible_amount'] : SKIP
  discount_amount =
    hash.key?('discount_amount') ? hash['discount_amount'] : SKIP

  # Create object from extracted values.
  ProformaInvoiceDiscountBreakout.new(eligible_amount,
                                      discount_amount)
end

.namesObject

A mapping from model property names to API property names.



21
22
23
24
25
26
# File 'lib/advanced_billing/models/proforma_invoice_discount_breakout.rb', line 21

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['eligible_amount'] = 'eligible_amount'
  @_hash['discount_amount'] = 'discount_amount'
  @_hash
end

.nullablesObject

An array for nullable fields



37
38
39
# File 'lib/advanced_billing/models/proforma_invoice_discount_breakout.rb', line 37

def self.nullables
  []
end

.optionalsObject

An array for optional fields



29
30
31
32
33
34
# File 'lib/advanced_billing/models/proforma_invoice_discount_breakout.rb', line 29

def self.optionals
  %w[
    eligible_amount
    discount_amount
  ]
end