Class: EPlat::Mapping::Shopify::V202407::Product

Inherits:
Base
  • Object
show all
Defined in:
lib/e_plat/mapping/shopify/v_2024_07/product.rb,
lib/e_plat/mapping/shopify/v_2024_07/product/image.rb,
lib/e_plat/mapping/shopify/v_2024_07/product/option.rb,
lib/e_plat/mapping/shopify/v_2024_07/product/variant.rb

Defined Under Namespace

Classes: Image, Option, Variant

Constant Summary

Constants inherited from Base

Base::DEFAULT_VALUES

Instance Attribute Summary

Attributes inherited from Base

#resource, #virtual_collection

Instance Method Summary collapse

Methods inherited from Base

#aliases, #e_plat_key_to, #initialize, #inspect, #keys_aliased_to_native_keys, #mappable_keys, #mappings, #native_key_to, #native_setter, #to_e_plat_keys, #to_native_keys, #via_native_attributes_where_possible, virtual_collection

Methods included from RequestBodyRoot

#include_root_in_request_body?

Constructor Details

This class inherits a constructor from EPlat::Mapping::Base

Instance Method Details

#native_attribute_aliasesObject



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/e_plat/mapping/shopify/v_2024_07/product.rb', line 29

def native_attribute_aliases
	super.concat([
		{
			alias_attribute: {native_key: "description_html", e_plat_key: "body_html"}
		},
		{
			existing_entry: {native_key: "created_at", e_plat_key: "created_at"}
		},
		{
			existing_entry: {native_key: "updated_at", e_plat_key: "updated_at"}
		},
		{
			existing_entry: {native_key: "handle", e_plat_key: "handle"}
		},
		{
			existing_entry: {native_key: "product_type", e_plat_key: "product_type"}
		},
		{
			existing_entry: {native_key: "published_at", e_plat_key: "published_at"}
		},
		{
			existing_entry: {native_key: "status", e_plat_key: "status",
				custom_e_plat_getter: '-> { _1&.downcase }',
				custom_native_setter: '-> { _1&.upcase }'
			}
		},
		{
			existing_entry: {native_key: "tags", e_plat_key: "tags",
				custom_e_plat_getter: "-> { _1&.join(',') }",
				custom_native_setter: "-> { _1&.split(',') }"
			}
		},
		{
			existing_entry: {native_key: "id", e_plat_key: "id",
				custom_e_plat_getter: '-> { (_1.is_a? Integer) ? _1 : _1&.split("/")&.last }',
				custom_native_setter: '-> { (_1.is_a? String)  ? _1 : "gid://shopify/Product/#{_1}" }'
			}
		},
		{
			existing_entry: {native_key: "template_suffix", e_plat_key: "template_suffix"}
		}, 
		{
			existing_entry: {native_key: "title", e_plat_key: "title"}
		},
		{
			existing_entry: {native_key: "vendor", e_plat_key: "vendor"}
		}
	])
end

#native_attributesObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/e_plat/mapping/shopify/v_2024_07/product.rb', line 11

def native_attributes
	super.concat([
		"id",
		"descriptionHtml",
		"createdAt",
		"updatedAt",
		"handle",
		"productType",
		"publishedAt",
		"publishedScope",
		"status",
		"tags",
		"templateSuffix",
		"title",
		"vendor"
	])
end

#native_top_keyObject



7
8
9
# File 'lib/e_plat/mapping/shopify/v_2024_07/product.rb', line 7

def native_top_key
	"product"
end