Class: Io::Flow::V0::Models::LocalItemAttributePricing

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

Overview

Localized item attribute pricing information

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ LocalItemAttributePricing

Returns a new instance of LocalItemAttributePricing.



48700
48701
48702
48703
48704
48705
48706
48707
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48700

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:pretax_price, :price], 'LocalItemAttributePricing')
  @pretax_price = (x = opts.delete(:pretax_price); x.is_a?(::Io::Flow::V0::Models::PriceWithBase) ? x : ::Io::Flow::V0::Models::PriceWithBase.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 = (x = opts.delete(:price); x.is_a?(::Io::Flow::V0::Models::LocalizedItemPrice) ? x : ::Io::Flow::V0::Models::LocalizedItemPrice.new(x))
end

Instance Attribute Details

#dutyObject (readonly)

Returns the value of attribute duty.



48698
48699
48700
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48698

def duty
  @duty
end

#pretax_priceObject (readonly)

Returns the value of attribute pretax_price.



48698
48699
48700
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48698

def pretax_price
  @pretax_price
end

#priceObject (readonly)

Returns the value of attribute price.



48698
48699
48700
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48698

def price
  @price
end

#vatObject (readonly)

Returns the value of attribute vat.



48698
48699
48700
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48698

def vat
  @vat
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



48713
48714
48715
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48713

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

#to_hashObject



48717
48718
48719
48720
48721
48722
48723
48724
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48717

def to_hash
  {
    :pretax_price => pretax_price.to_hash,
    :vat => vat.nil? ? nil : vat.to_hash,
    :duty => duty.nil? ? nil : duty.to_hash,
    :price => price.to_hash
  }
end

#to_jsonObject



48709
48710
48711
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48709

def to_json
  JSON.dump(to_hash)
end