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.



45281
45282
45283
45284
45285
45286
45287
45288
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45281

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.



45279
45280
45281
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45279

def duty
  @duty
end

#pretax_priceObject (readonly)

Returns the value of attribute pretax_price.



45279
45280
45281
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45279

def pretax_price
  @pretax_price
end

#priceObject (readonly)

Returns the value of attribute price.



45279
45280
45281
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45279

def price
  @price
end

#vatObject (readonly)

Returns the value of attribute vat.



45279
45280
45281
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45279

def vat
  @vat
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



45294
45295
45296
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45294

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

#to_hashObject



45298
45299
45300
45301
45302
45303
45304
45305
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45298

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



45290
45291
45292
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45290

def to_json
  JSON.dump(to_hash)
end