Class: EPlat::Shopify::Product

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

Defined Under Namespace

Classes: Image, Option, Variant

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

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



51
52
53
54
55
56
57
58
# File 'lib/e_plat/resource/platform_specific/shopify/product.rb', line 51

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

.graphql_fieldsObject



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.rb', line 19

def self.graphql_fields
	@@graphql_fields ||= 
		<<~GRAPHQL.freeze
			id
			legacyResourceId
			descriptionHtml
			createdAt
			updatedAt
			handle
			productType
			publishedAt
			status
			tags
			templateSuffix
			title
			vendor
			variants(first: #{EPlat::Product::INITIAL_SHOPIFY_VARIANT_LIMIT}) {
				nodes {
					#{Variant.graphql_fields}
				}
			}
			options {
				#{Option.graphql_fields}
			}
			images(first: #{EPlat::Product::INITIAL_SHOPIFY_IMAGE_LIMIT}) {
				nodes {
					#{Image.graphql_fields}
				}
			}
		GRAPHQL
end

Instance Method Details

#graphql_inputObject



60
61
62
# File 'lib/e_plat/resource/platform_specific/shopify/product.rb', line 60

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

#product_variants_bulk_inputObject



64
65
66
# File 'lib/e_plat/resource/platform_specific/shopify/product.rb', line 64

def product_variants_bulk_input
	"EPlat::Shopify::GraphQL::#{EPlat.shopify_graphql_version}::Input::Product::VariantsBulk".constantize
end

#variants_bulk_update_fragmentObject



68
69
70
71
72
# File 'lib/e_plat/resource/platform_specific/shopify/product.rb', line 68

def variants_bulk_update_fragment
	graphql_proc = eval "EPlat::Shopify::GraphQL::#{ EPlat.shopify_graphql_version }::Mutation.product_variants_bulk_update_fragment"

	graphql_proc.call product_variants_bulk_input.mutation_input(self, :update)
end