Class: Io::Flow::V0::Models::ConsumerInvoiceLineItem
- Inherits:
-
ConsumerInvoiceLine
- Object
- ConsumerInvoiceLine
- Io::Flow::V0::Models::ConsumerInvoiceLineItem
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#item ⇒ Object
readonly
Returns the value of attribute item.
-
#quantity ⇒ Object
readonly
Returns the value of attribute quantity.
-
#unit_discount ⇒ Object
readonly
Returns the value of attribute unit_discount.
-
#unit_duty ⇒ Object
readonly
Returns the value of attribute unit_duty.
-
#unit_price ⇒ Object
readonly
Returns the value of attribute unit_price.
-
#unit_tax ⇒ Object
readonly
Returns the value of attribute unit_tax.
Attributes inherited from ConsumerInvoiceLine
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ ConsumerInvoiceLineItem
constructor
A new instance of ConsumerInvoiceLineItem.
- #subtype_to_hash ⇒ Object
- #to_json ⇒ Object
Methods inherited from ConsumerInvoiceLine
Constructor Details
#initialize(incoming = {}) ⇒ ConsumerInvoiceLineItem
Returns a new instance of ConsumerInvoiceLineItem.
36709 36710 36711 36712 36713 36714 36715 36716 36717 36718 36719 36720 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36709 def initialize(incoming={}) super(:discriminator => ConsumerInvoiceLine::Types::CONSUMER_INVOICE_LINE_ITEM) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:item, :description, :quantity, :unit_price], 'ConsumerInvoiceLineItem') @item = (x = opts.delete(:item); x.is_a?(::Io::Flow::V0::Models::ItemReference) ? x : ::Io::Flow::V0::Models::ItemReference.new(x)) @description = HttpClient::Preconditions.assert_class('description', opts.delete(:description), String) @quantity = HttpClient::Preconditions.assert_class('quantity', opts.delete(:quantity), Integer) @unit_price = (x = opts.delete(:unit_price); x.is_a?(::Io::Flow::V0::Models::Price) ? x : ::Io::Flow::V0::Models::Price.new(x)) @unit_discount = (x = opts.delete(:unit_discount); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::Price) ? x : ::Io::Flow::V0::Models::Price.new(x))) @unit_tax = (x = opts.delete(:unit_tax); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::ConsumerInvoiceLevy) ? x : ::Io::Flow::V0::Models::ConsumerInvoiceLevy.new(x))) @unit_duty = (x = opts.delete(:unit_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
#description ⇒ Object (readonly)
Returns the value of attribute description.
36707 36708 36709 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36707 def description @description end |
#item ⇒ Object (readonly)
Returns the value of attribute item.
36707 36708 36709 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36707 def item @item end |
#quantity ⇒ Object (readonly)
Returns the value of attribute quantity.
36707 36708 36709 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36707 def quantity @quantity end |
#unit_discount ⇒ Object (readonly)
Returns the value of attribute unit_discount.
36707 36708 36709 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36707 def unit_discount @unit_discount end |
#unit_duty ⇒ Object (readonly)
Returns the value of attribute unit_duty.
36707 36708 36709 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36707 def unit_duty @unit_duty end |
#unit_price ⇒ Object (readonly)
Returns the value of attribute unit_price.
36707 36708 36709 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36707 def unit_price @unit_price end |
#unit_tax ⇒ Object (readonly)
Returns the value of attribute unit_tax.
36707 36708 36709 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36707 def unit_tax @unit_tax end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
36726 36727 36728 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36726 def copy(incoming={}) ConsumerInvoiceLineItem.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#subtype_to_hash ⇒ Object
36730 36731 36732 36733 36734 36735 36736 36737 36738 36739 36740 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36730 def subtype_to_hash { :item => item.to_hash, :description => description, :quantity => quantity, :unit_price => unit_price.to_hash, :unit_discount => unit_discount.nil? ? nil : unit_discount.to_hash, :unit_tax => unit_tax.nil? ? nil : unit_tax.to_hash, :unit_duty => unit_duty.nil? ? nil : unit_duty.to_hash } end |
#to_json ⇒ Object
36722 36723 36724 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36722 def to_json JSON.dump(to_hash) end |