Class: Io::Flow::V0::Models::ShopifyVariantPriceMetafield

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 = {}) ⇒ 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_atObject (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

#dutyObject (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

#includesObject (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

#itemObject (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

#vatObject (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_nameObject (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_hashObject



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_jsonObject



35913
35914
35915
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35913

def to_json
  JSON.dump(to_hash)
end