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.



38270
38271
38272
38273
38274
38275
38276
38277
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38270

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.



38268
38269
38270
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38268

def duty
  @duty
end

#pretax_priceObject (readonly)

Returns the value of attribute pretax_price.



38268
38269
38270
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38268

def pretax_price
  @pretax_price
end

#priceObject (readonly)

Returns the value of attribute price.



38268
38269
38270
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38268

def price
  @price
end

#vatObject (readonly)

Returns the value of attribute vat.



38268
38269
38270
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38268

def vat
  @vat
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



38283
38284
38285
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38283

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

#to_hashObject



38287
38288
38289
38290
38291
38292
38293
38294
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38287

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



38279
38280
38281
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38279

def to_json
  JSON.dump(to_hash)
end