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

Constructor Details

#initializeVariant

Returns a new instance of Variant.


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

def initialize(*)
  super
  unless allow_inventory_params?
    attributes.except!('inventory_quantity_adjustment', 'inventory_quantity', 'old_inventory_quantity')
  end
end

Instance Method Details

#inventory_quantity=(new_value) ⇒ Object


20
21
22
23
# File 'lib/shopify_api/resources/variant.rb', line 20

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

#inventory_quantity_adjustment=(new_value) ⇒ Object


15
16
17
18
# File 'lib/shopify_api/resources/variant.rb', line 15

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


25
26
27
28
# File 'lib/shopify_api/resources/variant.rb', line 25

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