Class: Io::Flow::V0::Models::ExportLocalizedItemPricesDetail

Inherits:
Object
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ ExportLocalizedItemPricesDetail

Returns a new instance of ExportLocalizedItemPricesDetail.



42950
42951
42952
42953
42954
42955
42956
42957
42958
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 42950

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:item, :price_attributes], 'ExportLocalizedItemPricesDetail')
  @item = (x = opts.delete(:item); x.is_a?(::Io::Flow::V0::Models::LocalizedItemPrice) ? x : ::Io::Flow::V0::Models::LocalizedItemPrice.new(x))
  @vat = (x = opts.delete(:vat); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::LocalizedItemVat) ? x : ::Io::Flow::V0::Models::LocalizedItemVat.new(x)))
  @duty = (x = opts.delete(:duty); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::LocalizedItemDuty) ? x : ::Io::Flow::V0::Models::LocalizedItemDuty.new(x)))
  @shipping_price = (x = opts.delete(:shipping_price); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::Price) ? x : ::Io::Flow::V0::Models::Price.new(x)))
  @price_attributes = HttpClient::Preconditions.assert_class('price_attributes', opts.delete(:price_attributes), Hash).inject({}) { |h, d| h[d[0]] = (x = d[1]; x.is_a?(::Io::Flow::V0::Models::PriceWithBase) ? x : ::Io::Flow::V0::Models::PriceWithBase.new(x)); h }
end

Instance Attribute Details

#dutyObject (readonly)

Returns the value of attribute duty.



42948
42949
42950
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 42948

def duty
  @duty
end

#itemObject (readonly)

Returns the value of attribute item.



42948
42949
42950
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 42948

def item
  @item
end

#price_attributesObject (readonly)

Returns the value of attribute price_attributes.



42948
42949
42950
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 42948

def price_attributes
  @price_attributes
end

#shipping_priceObject (readonly)

Returns the value of attribute shipping_price.



42948
42949
42950
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 42948

def shipping_price
  @shipping_price
end

#vatObject (readonly)

Returns the value of attribute vat.



42948
42949
42950
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 42948

def vat
  @vat
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



42964
42965
42966
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 42964

def copy(incoming={})
  ExportLocalizedItemPricesDetail.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end

#to_hashObject



42968
42969
42970
42971
42972
42973
42974
42975
42976
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 42968

def to_hash
  {
    :item => item.to_hash,
    :vat => vat.nil? ? nil : vat.to_hash,
    :duty => duty.nil? ? nil : duty.to_hash,
    :shipping_price => shipping_price.nil? ? nil : shipping_price.to_hash,
    :price_attributes => price_attributes.inject({}) { |hash, o| hash[o[0]] = o[1].nil? ? nil : o[1].to_hash; hash }
  }
end

#to_jsonObject



42960
42961
42962
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 42960

def to_json
  JSON.dump(to_hash)
end