e_plat 0.7.2 → 0.7.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -1
- data/lib/e_plat/resource/base.rb +2 -1
- data/lib/e_plat/resource/concerns/graph_q_lable.rb +1 -1
- data/lib/e_plat/resource/concerns/overwrite_instance_methods.rb +1 -1
- data/lib/e_plat/resource/platform_specific/shopify/product/variant.rb +1 -1
- data/lib/e_plat/resource/product/image.rb +1 -0
- data/lib/e_plat/resource/product/variant.rb +9 -0
- data/lib/e_plat/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5577cb6f825d656e170ae63d33c027e9b50080040347496bdf96d3c4f09920c3
|
4
|
+
data.tar.gz: 75cde1f016be6b06f07ba9201655496c7262e47d1611e320193c9d994549561a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 12484df951bb9fe2311ceb78e1b6ee3f990a82dcddc06702153da350b14e7b1e3c87180591536e80965eeff731c3a1d63f5012c8dceb8df7e86014c29d95479a
|
7
|
+
data.tar.gz: fe491070587b5284dc61d52db7bea1c2951e38bd6e0847b06d11b19077cf0468b7c35f8a7a19993bfac37632be6c9cabf863a30b76abcfab7c6929d064da26c3
|
data/README.md
CHANGED
@@ -267,6 +267,10 @@ EPlat is designed to let you mostly use it's universal interface, but then easil
|
|
267
267
|
| inventory_quantity | integer | getter only: node.inventoryQuantity | inventory_level | nil |
|
268
268
|
| tax_code | string | * | nil | nil |
|
269
269
|
| requires_shipping | boolean | InventoryItem[requiresShipping] | nil | nil |
|
270
|
+
|
271
|
+
helper methods: <br>
|
272
|
+
`image_src` => `String | nil`, platforms supported: Shopify, Bigcommerce
|
273
|
+
|
270
274
|
*Bigcommerce variant.title= setter is not supported
|
271
275
|
|
272
276
|
|
@@ -290,7 +294,6 @@ EPlat is designed to let you mostly use it's universal interface, but then easil
|
|
290
294
|
| width | integer | * | nil | nil |
|
291
295
|
| height | integer | * | nil | nil |
|
292
296
|
| src | string | * | url_standard | nil |
|
293
|
-
| variant_ids | array | * | nil | nil |
|
294
297
|
|
295
298
|
|
296
299
|
### EPlat::Product::Variant::OptionValue
|
@@ -835,6 +838,7 @@ EPlat::Product.find(my_id).destroy
|
|
835
838
|
product = EPlat::Product.new(title: 't-shirt')
|
836
839
|
product.save # true or false
|
837
840
|
product.errors # active record like errors if .save returned false
|
841
|
+
product.formatted_id #returns the resource ID in the platform's format. i.e. Shopify Product would be "gid://shopify/Product/xxx", Shopify Order would be 123, BC order: 123
|
838
842
|
|
839
843
|
product.full_response # <Net::HTTPOK>
|
840
844
|
product.headers # { "date"=>"Fri, 17 Nov 2023 14:25:53 GMT", ...}
|
data/lib/e_plat/resource/base.rb
CHANGED
@@ -8,6 +8,7 @@ module EPlat
|
|
8
8
|
|
9
9
|
self.connection_class = EPlat::Connection
|
10
10
|
self.collection_parser = EPlat::Collection
|
11
|
+
self.timeout = 10
|
11
12
|
self.site = "/" # this is overwritten below in initialize_singleton! when EPlat::Session is initialized
|
12
13
|
add_response_method :full_response #full response of the request
|
13
14
|
|
@@ -129,7 +130,7 @@ module EPlat
|
|
129
130
|
top_level_resource?
|
130
131
|
end
|
131
132
|
|
132
|
-
def formatted_id
|
133
|
+
def formatted_id
|
133
134
|
return id unless client.shopify? && client.api_version != "2024_01"
|
134
135
|
return if id.to_s.include?("gid://")
|
135
136
|
|
@@ -236,7 +236,7 @@ module EPlat
|
|
236
236
|
additional_graphql = self.class.before_graphql_callbacks[action.to_sym]&.call(self)
|
237
237
|
input =
|
238
238
|
if action == :delete
|
239
|
-
self.is_a?(EPlat::Product::Variant) ? graphql_input.new(id: formatted_id
|
239
|
+
self.is_a?(EPlat::Product::Variant) ? graphql_input.new(id: formatted_id) : graphql_input.new({id: formatted_id})
|
240
240
|
else
|
241
241
|
graphql_input.new mapping.via_native_attributes_where_possible(self.class.remove_root_from as_json)
|
242
242
|
end
|
@@ -90,7 +90,7 @@ module EPlat
|
|
90
90
|
def unrepresented_collection_ids(key, array_of_hashes)
|
91
91
|
return [] unless client.can_update_nested_resources?
|
92
92
|
|
93
|
-
all_instance_ids = send(key).map{|resource| resource.formatted_id
|
93
|
+
all_instance_ids = send(key).map{|resource| resource.formatted_id} || []
|
94
94
|
represented_instance_ids = array_of_hashes.map{|item| item["id"] }
|
95
95
|
|
96
96
|
all_instance_ids.compact - represented_instance_ids.compact
|
@@ -34,6 +34,15 @@ module EPlat
|
|
34
34
|
prefix_options[:product] ||= try(:product)&.id
|
35
35
|
super
|
36
36
|
end
|
37
|
+
|
38
|
+
def image_src
|
39
|
+
if client.bigcommerce?
|
40
|
+
image_url
|
41
|
+
elsif client.shopify? && client.uses_graphql_for_products?
|
42
|
+
image&.src
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
37
46
|
end
|
38
47
|
end
|
39
48
|
end
|
data/lib/e_plat/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: e_plat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- oliwoodsuk
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-05-
|
11
|
+
date: 2024-05-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|