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
Returns a new instance of ExportLocalizedItemPricesDetail.
25041 25042 25043 25044 25045 25046 25047 25048 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25041 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.
25039 25040 25041 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25039 def duty @duty end |
#item ⇒ Object (readonly)
Returns the value of attribute item.
25039 25040 25041 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25039 def item @item end |
#price_attributes ⇒ Object (readonly)
Returns the value of attribute price_attributes.
25039 25040 25041 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25039 def price_attributes @price_attributes end |
#vat ⇒ Object (readonly)
Returns the value of attribute vat.
25039 25040 25041 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25039 def vat @vat end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
25054 25055 25056 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25054 def copy(incoming={}) ExportLocalizedItemPricesDetail.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
25058 25059 25060 25061 25062 25063 25064 25065 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25058 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
25050 25051 25052 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25050 def to_json JSON.dump(to_hash) end |