Class: Io::Flow::V0::Models::ConsumerInvoiceLineItemForm
- Inherits:
-
ConsumerInvoiceLineForm
- Object
- ConsumerInvoiceLineForm
- Io::Flow::V0::Models::ConsumerInvoiceLineItemForm
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#item_number ⇒ Object
readonly
Returns the value of attribute item_number.
-
#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 ConsumerInvoiceLineForm
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ ConsumerInvoiceLineItemForm
constructor
A new instance of ConsumerInvoiceLineItemForm.
- #subtype_to_hash ⇒ Object
- #to_json ⇒ Object
Methods inherited from ConsumerInvoiceLineForm
Constructor Details
#initialize(incoming = {}) ⇒ ConsumerInvoiceLineItemForm
Returns a new instance of ConsumerInvoiceLineItemForm.
36748 36749 36750 36751 36752 36753 36754 36755 36756 36757 36758 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36748 def initialize(incoming={}) super(:discriminator => ConsumerInvoiceLineForm::Types::CONSUMER_INVOICE_LINE_ITEM_FORM) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:item_number, :quantity, :unit_price], 'ConsumerInvoiceLineItemForm') @item_number = HttpClient::Preconditions.assert_class('item_number', opts.delete(:item_number), String) @quantity = HttpClient::Preconditions.assert_class('quantity', opts.delete(:quantity), Integer) @unit_price = HttpClient::Preconditions.assert_class('unit_price', HttpClient::Helper.to_big_decimal(opts.delete(:unit_price)), BigDecimal) @unit_discount = (x = opts.delete(:unit_discount); x.nil? ? nil : HttpClient::Preconditions.assert_class('unit_discount', HttpClient::Helper.to_big_decimal(x), BigDecimal)) @unit_tax = (x = opts.delete(:unit_tax); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::ConsumerInvoiceLevyForm) ? x : ::Io::Flow::V0::Models::ConsumerInvoiceLevyForm.new(x))) @unit_duty = (x = opts.delete(:unit_duty); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::ConsumerInvoiceLevyForm) ? x : ::Io::Flow::V0::Models::ConsumerInvoiceLevyForm.new(x))) end |
Instance Attribute Details
#item_number ⇒ Object (readonly)
Returns the value of attribute item_number.
36746 36747 36748 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36746 def item_number @item_number end |
#quantity ⇒ Object (readonly)
Returns the value of attribute quantity.
36746 36747 36748 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36746 def quantity @quantity end |
#unit_discount ⇒ Object (readonly)
Returns the value of attribute unit_discount.
36746 36747 36748 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36746 def unit_discount @unit_discount end |
#unit_duty ⇒ Object (readonly)
Returns the value of attribute unit_duty.
36746 36747 36748 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36746 def unit_duty @unit_duty end |
#unit_price ⇒ Object (readonly)
Returns the value of attribute unit_price.
36746 36747 36748 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36746 def unit_price @unit_price end |
#unit_tax ⇒ Object (readonly)
Returns the value of attribute unit_tax.
36746 36747 36748 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36746 def unit_tax @unit_tax end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
36764 36765 36766 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36764 def copy(incoming={}) ConsumerInvoiceLineItemForm.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#subtype_to_hash ⇒ Object
36768 36769 36770 36771 36772 36773 36774 36775 36776 36777 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36768 def subtype_to_hash { :item_number => item_number, :quantity => quantity, :unit_price => unit_price.to_f.to_s, :unit_discount => unit_discount.to_f.to_s, :unit_tax => unit_tax.nil? ? nil : unit_tax.to_hash, :unit_duty => unit_duty.nil? ? nil : unit_duty.to_hash } end |
#to_json ⇒ Object
36760 36761 36762 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36760 def to_json JSON.dump(to_hash) end |