Class: Io::Flow::V0::Models::PriceDetails
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::PriceDetails
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Detailed information for the pricing of a given item within an experience.
Instance Attribute Summary collapse
-
#adjustment ⇒ Object
readonly
Returns the value of attribute adjustment.
-
#currency ⇒ Object
readonly
Returns the value of attribute currency.
-
#duty ⇒ Object
readonly
Returns the value of attribute duty.
-
#item_price ⇒ Object
readonly
Returns the value of attribute item_price.
-
#margins ⇒ Object
readonly
Returns the value of attribute margins.
-
#price ⇒ Object
readonly
Returns the value of attribute price.
-
#rounding ⇒ Object
readonly
Returns the value of attribute rounding.
-
#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 = {}) ⇒ PriceDetails
constructor
A new instance of PriceDetails.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ PriceDetails
Returns a new instance of PriceDetails.
60375 60376 60377 60378 60379 60380 60381 60382 60383 60384 60385 60386 60387 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 60375 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:currency, :item_price, :margins, :vat, :duty, :rounding, :price, :total], 'PriceDetails') @currency = HttpClient::Preconditions.assert_class('currency', opts.delete(:currency), String) @item_price = (x = opts.delete(:item_price); x.is_a?(::Io::Flow::V0::Models::PriceDetail) ? x : ::Io::Flow::V0::Models::PriceDetail.new(x)) @margins = (x = opts.delete(:margins); x.is_a?(::Io::Flow::V0::Models::PriceDetail) ? x : ::Io::Flow::V0::Models::PriceDetail.new(x)) @vat = (x = opts.delete(:vat); x.is_a?(::Io::Flow::V0::Models::PriceDetail) ? x : ::Io::Flow::V0::Models::PriceDetail.new(x)) @duty = (x = opts.delete(:duty); x.is_a?(::Io::Flow::V0::Models::PriceDetail) ? x : ::Io::Flow::V0::Models::PriceDetail.new(x)) @rounding = (x = opts.delete(:rounding); x.is_a?(::Io::Flow::V0::Models::PriceDetail) ? x : ::Io::Flow::V0::Models::PriceDetail.new(x)) @price = (x = opts.delete(:price); x.is_a?(::Io::Flow::V0::Models::Price) ? x : ::Io::Flow::V0::Models::Price.new(x)) @total = (x = opts.delete(:total); x.is_a?(::Io::Flow::V0::Models::Price) ? x : ::Io::Flow::V0::Models::Price.new(x)) @adjustment = (x = opts.delete(:adjustment); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::PriceDetail) ? x : ::Io::Flow::V0::Models::PriceDetail.new(x))) end |
Instance Attribute Details
#adjustment ⇒ Object (readonly)
Returns the value of attribute adjustment.
60373 60374 60375 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 60373 def adjustment @adjustment end |
#currency ⇒ Object (readonly)
Returns the value of attribute currency.
60373 60374 60375 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 60373 def currency @currency end |
#duty ⇒ Object (readonly)
Returns the value of attribute duty.
60373 60374 60375 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 60373 def duty @duty end |
#item_price ⇒ Object (readonly)
Returns the value of attribute item_price.
60373 60374 60375 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 60373 def item_price @item_price end |
#margins ⇒ Object (readonly)
Returns the value of attribute margins.
60373 60374 60375 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 60373 def margins @margins end |
#price ⇒ Object (readonly)
Returns the value of attribute price.
60373 60374 60375 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 60373 def price @price end |
#rounding ⇒ Object (readonly)
Returns the value of attribute rounding.
60373 60374 60375 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 60373 def rounding @rounding end |
#total ⇒ Object (readonly)
Returns the value of attribute total.
60373 60374 60375 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 60373 def total @total end |
#vat ⇒ Object (readonly)
Returns the value of attribute vat.
60373 60374 60375 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 60373 def vat @vat end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
60393 60394 60395 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 60393 def copy(incoming={}) PriceDetails.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
60397 60398 60399 60400 60401 60402 60403 60404 60405 60406 60407 60408 60409 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 60397 def to_hash { :currency => currency, :item_price => item_price.to_hash, :margins => margins.to_hash, :vat => vat.to_hash, :duty => duty.to_hash, :rounding => rounding.to_hash, :price => price.to_hash, :total => total.to_hash, :adjustment => adjustment.nil? ? nil : adjustment.to_hash } end |
#to_json ⇒ Object
60389 60390 60391 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 60389 def to_json JSON.dump(to_hash) end |