Class: EPlat::Shopify::Product::Variant

Inherits:
Product::Variant show all
Defined in:
lib/e_plat/resource/platform_specific/shopify/product/variant.rb

Defined Under Namespace

Classes: OptionValue

Constant Summary

Constants inherited from Base

Base::PROTECTED_ATTRIBUTES

Constants included from Concerns::GraphQLable

Concerns::GraphQLable::FILTER_ARGS, Concerns::GraphQLable::QUERY_ARG_ARGS

Instance Attribute Summary

Attributes inherited from Base

#mapped_attributes, #mapping

Attributes included from Concerns::Aliases

#type_coercer

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Product::Variant

#image_src, #save

Methods inherited from Base

cached_shopify_webhook?, client, #client, element_name_plural?, exclude_from_json, #formatted_id, #headers, #include_root_in_json, inherited, #initialize, initialize_singleton!, #mapped?, #native_keys, platform_specific_class?, prefix=, #read_only?, #string_to_consistent_id

Methods included from Countable

#count

Methods included from Concerns::GraphQLable

#graphql_mutation_string, #mutate_graphql, #remove_mutation_root_from

Methods included from Concerns::Aliases

#add_aliases!

Methods included from Concerns::FullJson

#as_full_json, #to_full_json

Methods included from Concerns::OverwriteRequestMethods

#collection_path, #element_path, included, #initialize

Methods included from Concerns::OverwriteInstanceMethods

#as_eplat_json, #as_json, #create, #create_resource_for, #to_eplat_json, #to_json, #update

Constructor Details

This class inherits a constructor from EPlat::Base

Class Method Details

.delete(id, options = {}) ⇒ Object



54
55
56
57
58
59
60
61
# File 'lib/e_plat/resource/platform_specific/shopify/product/variant.rb', line 54

def self.delete(id, options = {})
    if client.api_version == "2024_01"
        super(id, options)
    else
        resource = new(id: formatted_id(id))
        resource.delete
    end
end

.graphql_fieldsObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/e_plat/resource/platform_specific/shopify/product/variant.rb', line 12

def self.graphql_fields
    @@graphql_fields ||= 
        "            id\n            title\n            price\n            sku\n            position\n            inventoryPolicy\n            compareAtPrice\n            selectedOptions {\n                \#{ OptionValue.graphql_fields }\n            }\n            createdAt\n            updatedAt\n            taxable\n            barcode\n            image {\n                \#{ EPlat::Shopify::Product::Image.graphql_fields }\n            }\n            inventoryItem {\n                id\n                measurement {\n                    weight{\n                        unit\n                        value\n                    }\n                }\n                tracked\n                requiresShipping\n            }\n            inventoryQuantity\n            legacyResourceId\n            price\n            compareAtPrice\n        GRAPHQL\nend\n".freeze

Instance Method Details

#graphql_inputObject



50
51
52
# File 'lib/e_plat/resource/platform_specific/shopify/product/variant.rb', line 50

def graphql_input
    "EPlat::Shopify::GraphQL::#{EPlat.shopify_graphql_version}::Input::Product::Variant".constantize
end