Class: Io::Flow::V0::Models::ShopifyVariantFlowMetafield

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ ShopifyVariantFlowMetafield

Returns a new instance of ShopifyVariantFlowMetafield.



37886
37887
37888
37889
37890
37891
37892
37893
37894
37895
37896
37897
37898
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37886

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:prices_item, :prices_currency, :inventory_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.nil? ? nil : HttpClient::Preconditions.assert_class('prices_status', x, String))
  @inventory_status = (x = opts.delete(:inventory_status); x.is_a?(::Io::Flow::V0::Models::SubcatalogItemStatus) ? x : ::Io::Flow::V0::Models::SubcatalogItemStatus.apply(x))
end

Instance Attribute Details

#inventory_statusObject (readonly)

Returns the value of attribute inventory_status.



37884
37885
37886
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37884

def inventory_status
  @inventory_status
end

#prices_compare_atObject (readonly)

Returns the value of attribute prices_compare_at.



37884
37885
37886
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37884

def prices_compare_at
  @prices_compare_at
end

#prices_currencyObject (readonly)

Returns the value of attribute prices_currency.



37884
37885
37886
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37884

def prices_currency
  @prices_currency
end

#prices_dutyObject (readonly)

Returns the value of attribute prices_duty.



37884
37885
37886
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37884

def prices_duty
  @prices_duty
end

#prices_includesObject (readonly)

Returns the value of attribute prices_includes.



37884
37885
37886
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37884

def prices_includes
  @prices_includes
end

#prices_itemObject (readonly)

Returns the value of attribute prices_item.



37884
37885
37886
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37884

def prices_item
  @prices_item
end

#prices_statusObject (readonly)

Returns the value of attribute prices_status.



37884
37885
37886
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37884

def prices_status
  @prices_status
end

#prices_vatObject (readonly)

Returns the value of attribute prices_vat.



37884
37885
37886
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37884

def prices_vat
  @prices_vat
end

#prices_vat_nameObject (readonly)

Returns the value of attribute prices_vat_name.



37884
37885
37886
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37884

def prices_vat_name
  @prices_vat_name
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



37904
37905
37906
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37904

def copy(incoming={})
  ShopifyVariantFlowMetafield.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end

#to_hashObject



37908
37909
37910
37911
37912
37913
37914
37915
37916
37917
37918
37919
37920
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37908

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,
    :inventory_status => inventory_status.value
  }
end

#to_jsonObject



37900
37901
37902
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37900

def to_json
  JSON.dump(to_hash)
end