Class: Io::Flow::V0::Models::ShopifyOrderPriceAttributesMetafield
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::ShopifyOrderPriceAttributesMetafield
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Model to represent item’s price attributes metafield
Instance Attribute Summary collapse
-
#item_number ⇒ Object
readonly
Returns the value of attribute item_number.
-
#price_attributes ⇒ Object
readonly
Returns the value of attribute price_attributes.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ ShopifyOrderPriceAttributesMetafield
constructor
A new instance of ShopifyOrderPriceAttributesMetafield.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ ShopifyOrderPriceAttributesMetafield
Returns a new instance of ShopifyOrderPriceAttributesMetafield.
51307 51308 51309 51310 51311 51312 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51307 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:item_number, :price_attributes], 'ShopifyOrderPriceAttributesMetafield') @item_number = HttpClient::Preconditions.assert_class('item_number', opts.delete(:item_number), String) @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
#item_number ⇒ Object (readonly)
Returns the value of attribute item_number.
51305 51306 51307 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51305 def item_number @item_number end |
#price_attributes ⇒ Object (readonly)
Returns the value of attribute price_attributes.
51305 51306 51307 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51305 def price_attributes @price_attributes end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
51318 51319 51320 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51318 def copy(incoming={}) ShopifyOrderPriceAttributesMetafield.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
51322 51323 51324 51325 51326 51327 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51322 def to_hash { :item_number => item_number, :price_attributes => price_attributes.inject({}) { |hash, o| hash[o[0]] = o[1].nil? ? nil : o[1].to_hash; hash } } end |
#to_json ⇒ Object
51314 51315 51316 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51314 def to_json JSON.dump(to_hash) end |