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 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, exclude_from_json, #formatted_id, #headers, #include_root_in_json, inherited, #initialize, initialize_singleton!, #mapped?, #native_keys, platform_specific_class?, prefix=, #read_only?

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

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



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

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
49
# File 'lib/e_plat/resource/platform_specific/shopify/product/variant.rb', line 12

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

Instance Method Details

#graphql_inputObject



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

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