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.



33154
33155
33156
33157
33158
33159
33160
33161
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33154

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)))
  @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.



33152
33153
33154
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33152

def duty
  @duty
end

#itemObject (readonly)

Returns the value of attribute item.



33152
33153
33154
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33152

def item
  @item
end

#price_attributesObject (readonly)

Returns the value of attribute price_attributes.



33152
33153
33154
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33152

def price_attributes
  @price_attributes
end

#vatObject (readonly)

Returns the value of attribute vat.



33152
33153
33154
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33152

def vat
  @vat
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



33167
33168
33169
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33167

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

#to_hashObject



33171
33172
33173
33174
33175
33176
33177
33178
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33171

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

#to_jsonObject



33163
33164
33165
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33163

def to_json
  JSON.dump(to_hash)
end