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.
-
#currency ⇒ Object
readonly
Returns the value of attribute currency.
-
#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.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#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.
37586 37587 37588 37589 37590 37591 37592 37593 37594 37595 37596 37597 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37586 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:item, :currency, :status], 'ShopifyVariantPriceMetafield') @item = HttpClient::Preconditions.assert_class('item', opts.delete(:item), String) @currency = HttpClient::Preconditions.assert_class('currency', opts.delete(:currency), 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)) @status = (x = opts.delete(:status); x.is_a?(::Io::Flow::V0::Models::SubcatalogItemStatus) ? x : ::Io::Flow::V0::Models::SubcatalogItemStatus.apply(x)) end |
Instance Attribute Details
#compare_at ⇒ Object (readonly)
Returns the value of attribute compare_at.
37584 37585 37586 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37584 def compare_at @compare_at end |
#currency ⇒ Object (readonly)
Returns the value of attribute currency.
37584 37585 37586 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37584 def currency @currency end |
#duty ⇒ Object (readonly)
Returns the value of attribute duty.
37584 37585 37586 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37584 def duty @duty end |
#includes ⇒ Object (readonly)
Returns the value of attribute includes.
37584 37585 37586 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37584 def includes @includes end |
#item ⇒ Object (readonly)
Returns the value of attribute item.
37584 37585 37586 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37584 def item @item end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
37584 37585 37586 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37584 def status @status end |
#vat ⇒ Object (readonly)
Returns the value of attribute vat.
37584 37585 37586 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37584 def vat @vat end |
#vat_name ⇒ Object (readonly)
Returns the value of attribute vat_name.
37584 37585 37586 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37584 def vat_name @vat_name end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
37603 37604 37605 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37603 def copy(incoming={}) ShopifyVariantPriceMetafield.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
37607 37608 37609 37610 37611 37612 37613 37614 37615 37616 37617 37618 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37607 def to_hash { :item => item, :currency => currency, :includes => includes, :vat => vat, :vat_name => vat_name, :duty => duty, :compare_at => compare_at, :status => status.value } end |
#to_json ⇒ Object
37599 37600 37601 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37599 def to_json JSON.dump(to_hash) end |