Class: Io::Flow::V0::Models::ExportLocalizedItemPricesDetail
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::ExportLocalizedItemPricesDetail
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#duty ⇒ Object
readonly
Returns the value of attribute duty.
-
#item ⇒ Object
readonly
Returns the value of attribute item.
-
#price_attributes ⇒ Object
readonly
Returns the value of attribute price_attributes.
-
#vat ⇒ Object
readonly
Returns the value of attribute vat.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ ExportLocalizedItemPricesDetail
constructor
A new instance of ExportLocalizedItemPricesDetail.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ ExportLocalizedItemPricesDetail
28429 28430 28431 28432 28433 28434 28435 28436 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28429 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
#duty ⇒ Object (readonly)
Returns the value of attribute duty.
28427 28428 28429 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28427 def duty @duty end |
#item ⇒ Object (readonly)
Returns the value of attribute item.
28427 28428 28429 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28427 def item @item end |
#price_attributes ⇒ Object (readonly)
Returns the value of attribute price_attributes.
28427 28428 28429 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28427 def price_attributes @price_attributes end |
#vat ⇒ Object (readonly)
Returns the value of attribute vat.
28427 28428 28429 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28427 def vat @vat end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
28442 28443 28444 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28442 def copy(incoming={}) ExportLocalizedItemPricesDetail.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
28446 28447 28448 28449 28450 28451 28452 28453 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28446 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_json ⇒ Object
28438 28439 28440 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28438 def to_json JSON.dump(to_hash) end |