Class: Io::Flow::V0::Models::ShopifyVariantPriceMetafield
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::ShopifyVariantPriceMetafield
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
The shopify variant metafield defines the individual metafield values we write into Shopify for each variant. This model was introduced to enable server side rendering of content (e.g. the price on the product detail page). Each field in this model is available as its own metafield within a namespace named ‘price_abc’ where abc is a unique, short identifier for an experience.
Instance Attribute Summary collapse
-
#compare_at ⇒ Object
readonly
Returns the value of attribute compare_at.
-
#duty ⇒ Object
readonly
Returns the value of attribute duty.
-
#includes ⇒ Object
readonly
Returns the value of attribute includes.
-
#item ⇒ Object
readonly
Returns the value of attribute item.
-
#vat ⇒ Object
readonly
Returns the value of attribute vat.
-
#vat_name ⇒ Object
readonly
Returns the value of attribute vat_name.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ ShopifyVariantPriceMetafield
constructor
A new instance of ShopifyVariantPriceMetafield.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ ShopifyVariantPriceMetafield
Returns a new instance of ShopifyVariantPriceMetafield.
35902 35903 35904 35905 35906 35907 35908 35909 35910 35911 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35902 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:item], 'ShopifyVariantPriceMetafield') @item = HttpClient::Preconditions.assert_class('item', opts.delete(:item), String) @includes = (x = opts.delete(:includes); x.nil? ? nil : HttpClient::Preconditions.assert_class('includes', x, String)) @vat = (x = opts.delete(:vat); x.nil? ? nil : HttpClient::Preconditions.assert_class('vat', x, String)) @vat_name = (x = opts.delete(:vat_name); x.nil? ? nil : HttpClient::Preconditions.assert_class('vat_name', x, String)) @duty = (x = opts.delete(:duty); x.nil? ? nil : HttpClient::Preconditions.assert_class('duty', x, String)) @compare_at = (x = opts.delete(:compare_at); x.nil? ? nil : HttpClient::Preconditions.assert_class('compare_at', x, String)) end |
Instance Attribute Details
#compare_at ⇒ Object (readonly)
Returns the value of attribute compare_at.
35900 35901 35902 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35900 def compare_at @compare_at end |
#duty ⇒ Object (readonly)
Returns the value of attribute duty.
35900 35901 35902 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35900 def duty @duty end |
#includes ⇒ Object (readonly)
Returns the value of attribute includes.
35900 35901 35902 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35900 def includes @includes end |
#item ⇒ Object (readonly)
Returns the value of attribute item.
35900 35901 35902 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35900 def item @item end |
#vat ⇒ Object (readonly)
Returns the value of attribute vat.
35900 35901 35902 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35900 def vat @vat end |
#vat_name ⇒ Object (readonly)
Returns the value of attribute vat_name.
35900 35901 35902 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35900 def vat_name @vat_name end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
35917 35918 35919 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35917 def copy(incoming={}) ShopifyVariantPriceMetafield.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
35921 35922 35923 35924 35925 35926 35927 35928 35929 35930 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35921 def to_hash { :item => item, :includes => includes, :vat => vat, :vat_name => vat_name, :duty => duty, :compare_at => compare_at } end |
#to_json ⇒ Object
35913 35914 35915 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35913 def to_json JSON.dump(to_hash) end |