Class: Io::Flow::V0::Models::ConsumerInvoiceLineShippingForm
- Inherits:
-
ConsumerInvoiceLineForm
- Object
- ConsumerInvoiceLineForm
- Io::Flow::V0::Models::ConsumerInvoiceLineShippingForm
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#discount ⇒ Object
readonly
Returns the value of attribute discount.
-
#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 ConsumerInvoiceLineForm
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ ConsumerInvoiceLineShippingForm
constructor
A new instance of ConsumerInvoiceLineShippingForm.
- #subtype_to_hash ⇒ Object
- #to_json ⇒ Object
Methods inherited from ConsumerInvoiceLineForm
Constructor Details
#initialize(incoming = {}) ⇒ ConsumerInvoiceLineShippingForm
Returns a new instance of ConsumerInvoiceLineShippingForm.
36818 36819 36820 36821 36822 36823 36824 36825 36826 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36818 def initialize(incoming={}) super(:discriminator => ConsumerInvoiceLineForm::Types::CONSUMER_INVOICE_LINE_SHIPPING_FORM) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:price], 'ConsumerInvoiceLineShippingForm') @price = HttpClient::Preconditions.assert_class('price', HttpClient::Helper.to_big_decimal(opts.delete(:price)), BigDecimal) @discount = (x = opts.delete(:discount); x.nil? ? nil : HttpClient::Preconditions.assert_class('discount', HttpClient::Helper.to_big_decimal(x), BigDecimal)) @tax = (x = opts.delete(:tax); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::ConsumerInvoiceLevyForm) ? x : ::Io::Flow::V0::Models::ConsumerInvoiceLevyForm.new(x))) @duty = (x = opts.delete(: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
#discount ⇒ Object (readonly)
Returns the value of attribute discount.
36816 36817 36818 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36816 def discount @discount end |
#duty ⇒ Object (readonly)
Returns the value of attribute duty.
36816 36817 36818 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36816 def duty @duty end |
#price ⇒ Object (readonly)
Returns the value of attribute price.
36816 36817 36818 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36816 def price @price end |
#tax ⇒ Object (readonly)
Returns the value of attribute tax.
36816 36817 36818 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36816 def tax @tax end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
36832 36833 36834 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36832 def copy(incoming={}) ConsumerInvoiceLineShippingForm.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#subtype_to_hash ⇒ Object
36836 36837 36838 36839 36840 36841 36842 36843 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36836 def subtype_to_hash { :price => price.to_f.to_s, :discount => discount.to_f.to_s, :tax => tax.nil? ? nil : tax.to_hash, :duty => duty.nil? ? nil : duty.to_hash } end |
#to_json ⇒ Object
36828 36829 36830 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36828 def to_json JSON.dump(to_hash) end |