class Io::Flow::V0::Models::ShopifyVariantFlowMetafield

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.

Attributes

inventory_status[R]
prices_compare_at[R]
prices_currency[R]
prices_duty[R]
prices_includes[R]
prices_item[R]
prices_status[R]
prices_vat[R]
prices_vat_name[R]

Public Class Methods

new(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 68421
def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:prices_item, :prices_currency, :prices_status], 'ShopifyVariantFlowMetafield')
  @prices_item = HttpClient::Preconditions.assert_class('prices_item', opts.delete(:prices_item), String)
  @prices_currency = HttpClient::Preconditions.assert_class('prices_currency', opts.delete(:prices_currency), String)
  @prices_includes = (x = opts.delete(:prices_includes); x.nil? ? nil : HttpClient::Preconditions.assert_class('prices_includes', x, String))
  @prices_vat = (x = opts.delete(:prices_vat); x.nil? ? nil : HttpClient::Preconditions.assert_class('prices_vat', x, String))
  @prices_vat_name = (x = opts.delete(:prices_vat_name); x.nil? ? nil : HttpClient::Preconditions.assert_class('prices_vat_name', x, String))
  @prices_duty = (x = opts.delete(:prices_duty); x.nil? ? nil : HttpClient::Preconditions.assert_class('prices_duty', x, String))
  @prices_compare_at = (x = opts.delete(:prices_compare_at); x.nil? ? nil : HttpClient::Preconditions.assert_class('prices_compare_at', x, String))
  @prices_status = (x = opts.delete(:prices_status); x.is_a?(::Io::Flow::V0::Models::SubcatalogItemStatus) ? x : ::Io::Flow::V0::Models::SubcatalogItemStatus.apply(x))
  @inventory_status = (x = opts.delete(:inventory_status); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::ItemAvailabilityStatus) ? x : ::Io::Flow::V0::Models::ItemAvailabilityStatus.apply(x)))
end

Public Instance Methods

copy(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 68439
def copy(incoming={})
  ShopifyVariantFlowMetafield.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end
to_hash() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 68443
def to_hash
  {
    :prices_item => prices_item,
    :prices_currency => prices_currency,
    :prices_includes => prices_includes,
    :prices_vat => prices_vat,
    :prices_vat_name => prices_vat_name,
    :prices_duty => prices_duty,
    :prices_compare_at => prices_compare_at,
    :prices_status => prices_status.value,
    :inventory_status => inventory_status.nil? ? nil : inventory_status.value
  }
end
to_json() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 68435
def to_json
  JSON.dump(to_hash)
end