Class: Io::Flow::V0::Models::KlaviyoOrderPrices
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::KlaviyoOrderPrices
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Contains cart related data.
Instance Attribute Summary collapse
-
#discount ⇒ Object
readonly
Returns the value of attribute discount.
-
#duty ⇒ Object
readonly
Returns the value of attribute duty.
-
#insurance ⇒ Object
readonly
Returns the value of attribute insurance.
-
#shipping ⇒ Object
readonly
Returns the value of attribute shipping.
-
#subtotal ⇒ Object
readonly
Returns the value of attribute subtotal.
-
#total ⇒ Object
readonly
Returns the value of attribute total.
-
#vat ⇒ Object
readonly
Returns the value of attribute vat.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ KlaviyoOrderPrices
constructor
A new instance of KlaviyoOrderPrices.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ KlaviyoOrderPrices
Returns a new instance of KlaviyoOrderPrices.
47885 47886 47887 47888 47889 47890 47891 47892 47893 47894 47895 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47885 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:subtotal, :total], 'KlaviyoOrderPrices') @subtotal = (x = opts.delete(:subtotal); x.is_a?(::Io::Flow::V0::Models::PriceWithBase) ? x : ::Io::Flow::V0::Models::PriceWithBase.new(x)) @vat = (x = opts.delete(:vat); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::PriceWithBase) ? x : ::Io::Flow::V0::Models::PriceWithBase.new(x))) @duty = (x = opts.delete(:duty); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::PriceWithBase) ? x : ::Io::Flow::V0::Models::PriceWithBase.new(x))) @discount = (x = opts.delete(:discount); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::PriceWithBase) ? x : ::Io::Flow::V0::Models::PriceWithBase.new(x))) @shipping = (x = opts.delete(:shipping); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::PriceWithBase) ? x : ::Io::Flow::V0::Models::PriceWithBase.new(x))) @insurance = (x = opts.delete(:insurance); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::PriceWithBase) ? x : ::Io::Flow::V0::Models::PriceWithBase.new(x))) @total = (x = opts.delete(:total); x.is_a?(::Io::Flow::V0::Models::PriceWithBase) ? x : ::Io::Flow::V0::Models::PriceWithBase.new(x)) end |
Instance Attribute Details
#discount ⇒ Object (readonly)
Returns the value of attribute discount.
47883 47884 47885 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47883 def discount @discount end |
#duty ⇒ Object (readonly)
Returns the value of attribute duty.
47883 47884 47885 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47883 def duty @duty end |
#insurance ⇒ Object (readonly)
Returns the value of attribute insurance.
47883 47884 47885 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47883 def insurance @insurance end |
#shipping ⇒ Object (readonly)
Returns the value of attribute shipping.
47883 47884 47885 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47883 def shipping @shipping end |
#subtotal ⇒ Object (readonly)
Returns the value of attribute subtotal.
47883 47884 47885 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47883 def subtotal @subtotal end |
#total ⇒ Object (readonly)
Returns the value of attribute total.
47883 47884 47885 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47883 def total @total end |
#vat ⇒ Object (readonly)
Returns the value of attribute vat.
47883 47884 47885 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47883 def vat @vat end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
47901 47902 47903 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47901 def copy(incoming={}) KlaviyoOrderPrices.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
47905 47906 47907 47908 47909 47910 47911 47912 47913 47914 47915 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47905 def to_hash { :subtotal => subtotal.to_hash, :vat => vat.nil? ? nil : vat.to_hash, :duty => duty.nil? ? nil : duty.to_hash, :discount => discount.nil? ? nil : discount.to_hash, :shipping => shipping.nil? ? nil : shipping.to_hash, :insurance => insurance.nil? ? nil : insurance.to_hash, :total => total.to_hash } end |
#to_json ⇒ Object
47897 47898 47899 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47897 def to_json JSON.dump(to_hash) end |