Class: Io::Flow::V0::Models::ConsumerInvoiceLineDiscount
- Inherits:
-
ConsumerInvoiceLine
- Object
- ConsumerInvoiceLine
- Io::Flow::V0::Models::ConsumerInvoiceLineDiscount
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#duty ⇒ Object
readonly
Returns the value of attribute duty.
-
#price ⇒ Object
readonly
Returns the value of attribute price.
-
#tax ⇒ Object
readonly
Returns the value of attribute tax.
Attributes inherited from ConsumerInvoiceLine
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ ConsumerInvoiceLineDiscount
constructor
A new instance of ConsumerInvoiceLineDiscount.
- #subtype_to_hash ⇒ Object
- #to_json ⇒ Object
Methods inherited from ConsumerInvoiceLine
Constructor Details
#initialize(incoming = {}) ⇒ ConsumerInvoiceLineDiscount
Returns a new instance of ConsumerInvoiceLineDiscount.
22493 22494 22495 22496 22497 22498 22499 22500 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22493 def initialize(incoming={}) super(:discriminator => ConsumerInvoiceLine::Types::CONSUMER_INVOICE_LINE_DISCOUNT) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:price], 'ConsumerInvoiceLineDiscount') @price = (x = opts.delete(:price); x.is_a?(::Io::Flow::V0::Models::Price) ? x : ::Io::Flow::V0::Models::Price.new(x)) @tax = (x = opts.delete(:tax); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::ConsumerInvoiceLevy) ? x : ::Io::Flow::V0::Models::ConsumerInvoiceLevy.new(x))) @duty = (x = opts.delete(:duty); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::ConsumerInvoiceLevy) ? x : ::Io::Flow::V0::Models::ConsumerInvoiceLevy.new(x))) end |
Instance Attribute Details
#duty ⇒ Object (readonly)
Returns the value of attribute duty.
22491 22492 22493 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22491 def duty @duty end |
#price ⇒ Object (readonly)
Returns the value of attribute price.
22491 22492 22493 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22491 def price @price end |
#tax ⇒ Object (readonly)
Returns the value of attribute tax.
22491 22492 22493 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22491 def tax @tax end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
22506 22507 22508 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22506 def copy(incoming={}) ConsumerInvoiceLineDiscount.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#subtype_to_hash ⇒ Object
22510 22511 22512 22513 22514 22515 22516 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22510 def subtype_to_hash { :price => price.to_hash, :tax => tax.nil? ? nil : tax.to_hash, :duty => duty.nil? ? nil : duty.to_hash } end |
#to_json ⇒ Object
22502 22503 22504 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22502 def to_json JSON.dump(to_hash) end |