class Io::Flow::V0::Models::PriceDetails

Detailed information for the pricing of a given item within an experience.

Attributes

adjustment[R]
currency[R]
duty[R]
item_price[R]
margins[R]
price[R]
rounding[R]
total[R]
vat[R]

Public Class Methods

new(incoming={}) click to toggle source
# 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

Public Instance Methods

copy(incoming={}) click to toggle source
# 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() click to toggle source
# 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() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 60389
def to_json
  JSON.dump(to_hash)
end