Class: Io::Flow::V0::Models::ShopifyLocalCartMetadata
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::ShopifyLocalCartMetadata
- 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.
-
#promotions ⇒ Object
readonly
Returns the value of attribute promotions.
-
#rules ⇒ Object
readonly
Returns the value of attribute rules.
-
#subtotal ⇒ Object
readonly
Returns the value of attribute subtotal.
-
#total_price ⇒ Object
readonly
Returns the value of attribute total_price.
-
#vat ⇒ Object
readonly
Returns the value of attribute vat.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ ShopifyLocalCartMetadata
constructor
A new instance of ShopifyLocalCartMetadata.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ ShopifyLocalCartMetadata
Returns a new instance of ShopifyLocalCartMetadata.
45566 45567 45568 45569 45570 45571 45572 45573 45574 45575 45576 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45566 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:total_price, :promotions, :subtotal], 'ShopifyLocalCartMetadata') @total_price = (x = opts.delete(:total_price); x.is_a?(::Io::Flow::V0::Models::PriceWithBase) ? x : ::Io::Flow::V0::Models::PriceWithBase.new(x)) @promotions = (x = opts.delete(:promotions); x.is_a?(::Io::Flow::V0::Models::Promotions) ? x : ::Io::Flow::V0::Models::Promotions.new(x)) @rules = (x = opts.delete(:rules); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::OrderRulesSummary) ? x : ::Io::Flow::V0::Models::OrderRulesSummary.new(x))) @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))) end |
Instance Attribute Details
#discount ⇒ Object (readonly)
Returns the value of attribute discount.
45564 45565 45566 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45564 def discount @discount end |
#duty ⇒ Object (readonly)
Returns the value of attribute duty.
45564 45565 45566 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45564 def duty @duty end |
#promotions ⇒ Object (readonly)
Returns the value of attribute promotions.
45564 45565 45566 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45564 def promotions @promotions end |
#rules ⇒ Object (readonly)
Returns the value of attribute rules.
45564 45565 45566 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45564 def rules @rules end |
#subtotal ⇒ Object (readonly)
Returns the value of attribute subtotal.
45564 45565 45566 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45564 def subtotal @subtotal end |
#total_price ⇒ Object (readonly)
Returns the value of attribute total_price.
45564 45565 45566 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45564 def total_price @total_price end |
#vat ⇒ Object (readonly)
Returns the value of attribute vat.
45564 45565 45566 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45564 def vat @vat end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
45582 45583 45584 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45582 def copy(incoming={}) ShopifyLocalCartMetadata.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
45586 45587 45588 45589 45590 45591 45592 45593 45594 45595 45596 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45586 def to_hash { :total_price => total_price.to_hash, :promotions => promotions.to_hash, :rules => rules.nil? ? nil : rules.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 } end |
#to_json ⇒ Object
45578 45579 45580 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45578 def to_json JSON.dump(to_hash) end |