Class: Io::Flow::V0::Models::Pricing
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::Pricing
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Pricing determines how the item price is calculated when items are requests via the experience.
Instance Attribute Summary collapse
-
#duty ⇒ Object
readonly
Returns the value of attribute duty.
-
#rounding ⇒ Object
readonly
Returns the value of attribute rounding.
-
#vat ⇒ Object
readonly
Returns the value of attribute vat.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ Pricing
constructor
A new instance of Pricing.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ Pricing
Returns a new instance of Pricing.
31658 31659 31660 31661 31662 31663 31664 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31658 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:vat, :duty], 'Pricing') @vat = (x = opts.delete(:vat); x.is_a?(::Io::Flow::V0::Models::PricingLevySetting) ? x : ::Io::Flow::V0::Models::PricingLevySetting.apply(x)) @duty = (x = opts.delete(:duty); x.is_a?(::Io::Flow::V0::Models::PricingLevySetting) ? x : ::Io::Flow::V0::Models::PricingLevySetting.apply(x)) @rounding = (x = opts.delete(:rounding); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::Rounding) ? x : ::Io::Flow::V0::Models::Rounding.new(x))) end |
Instance Attribute Details
#duty ⇒ Object (readonly)
Returns the value of attribute duty.
31656 31657 31658 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31656 def duty @duty end |
#rounding ⇒ Object (readonly)
Returns the value of attribute rounding.
31656 31657 31658 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31656 def rounding @rounding end |
#vat ⇒ Object (readonly)
Returns the value of attribute vat.
31656 31657 31658 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31656 def vat @vat end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
31670 31671 31672 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31670 def copy(incoming={}) Pricing.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
31674 31675 31676 31677 31678 31679 31680 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31674 def to_hash { :vat => vat.value, :duty => duty.value, :rounding => rounding.nil? ? nil : rounding.to_hash } end |
#to_json ⇒ Object
31666 31667 31668 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31666 def to_json JSON.dump(to_hash) end |