Class: Io::Flow::V0::Models::ConsumerInvoiceLineShipping
- Inherits:
-
ConsumerInvoiceLine
- Object
- ConsumerInvoiceLine
- Io::Flow::V0::Models::ConsumerInvoiceLineShipping
- 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 ConsumerInvoiceLine
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ ConsumerInvoiceLineShipping
constructor
A new instance of ConsumerInvoiceLineShipping.
- #subtype_to_hash ⇒ Object
- #to_json ⇒ Object
Methods inherited from ConsumerInvoiceLine
Constructor Details
#initialize(incoming = {}) ⇒ ConsumerInvoiceLineShipping
Returns a new instance of ConsumerInvoiceLineShipping.
31858 31859 31860 31861 31862 31863 31864 31865 31866 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31858 def initialize(incoming={}) super(:discriminator => ConsumerInvoiceLine::Types::CONSUMER_INVOICE_LINE_SHIPPING) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:price], 'ConsumerInvoiceLineShipping') @price = (x = opts.delete(:price); x.is_a?(::Io::Flow::V0::Models::Price) ? x : ::Io::Flow::V0::Models::Price.new(x)) @discount = (x = opts.delete(:discount); x.nil? ? nil : (x = x; 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
#discount ⇒ Object (readonly)
Returns the value of attribute discount.
31856 31857 31858 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31856 def discount @discount end |
#duty ⇒ Object (readonly)
Returns the value of attribute duty.
31856 31857 31858 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31856 def duty @duty end |
#price ⇒ Object (readonly)
Returns the value of attribute price.
31856 31857 31858 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31856 def price @price end |
#tax ⇒ Object (readonly)
Returns the value of attribute tax.
31856 31857 31858 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31856 def tax @tax end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
31872 31873 31874 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31872 def copy(incoming={}) ConsumerInvoiceLineShipping.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#subtype_to_hash ⇒ Object
31876 31877 31878 31879 31880 31881 31882 31883 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31876 def subtype_to_hash { :price => price.to_hash, :discount => discount.nil? ? nil : discount.to_hash, :tax => tax.nil? ? nil : tax.to_hash, :duty => duty.nil? ? nil : duty.to_hash } end |
#to_json ⇒ Object
31868 31869 31870 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31868 def to_json JSON.dump(to_hash) end |