Class: ShopifyAPI::Variant

Inherits:
Base
  • Object
show all
Includes:
DisablePrefixCheck, Metafields
Defined in:
lib/shopify_api/resources/variant.rb

Instance Method Summary collapse

Methods included from Metafields

#add_metafield, #metafields

Methods inherited from Base

activate_session, api_version, api_version=, #as_json, clear_session, early_july_pagination?, #encode, headers, init_prefix, init_prefix_explicit, #persisted?, prefix, prefix=, prefix_source, resource_prefix, resource_prefix=, version_validation!

Methods included from Countable

#count

Instance Method Details

#inventory_quantity=(new_value) ⇒ Object


13
14
15
16
# File 'lib/shopify_api/resources/variant.rb', line 13

def inventory_quantity=(new_value)
  raise_deprecated_inventory_call('inventory_quantity') unless allow_inventory_params?
  super
end

#inventory_quantity_adjustment=(new_value) ⇒ Object


8
9
10
11
# File 'lib/shopify_api/resources/variant.rb', line 8

def inventory_quantity_adjustment=(new_value)
  raise_deprecated_inventory_call('inventory_quantity_adjustment') unless allow_inventory_params?
  super
end

#old_inventory_quantity=(new_value) ⇒ Object


18
19
20
21
# File 'lib/shopify_api/resources/variant.rb', line 18

def old_inventory_quantity=(new_value)
  raise_deprecated_inventory_call('old_inventory_quantity') unless allow_inventory_params?
  super
end

#serializable_hash(options = {}) ⇒ Object


23
24
25
26
27
28
29
30
31
# File 'lib/shopify_api/resources/variant.rb', line 23

def serializable_hash(options = {})
  if allow_inventory_params?
    super(options)
  else
    super(options).tap do |resource|
      (resource['variant'] || resource).except!('inventory_quantity', 'old_inventory_quantity')
    end
  end
end