shopify_transporter 2.5.0 → 2.5.1
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4d00e959d012ed055eda454c043cf1b07575fe40acaf7c8f16610e9cad461597
|
4
|
+
data.tar.gz: 8d7325220f9c1823846535512572f97c095dd6cfa8abd539e730cc257f43980b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a820cae8aabbb4ba0a875fbc1658fc89b1dfcd934f7f9597e76404be6703980d443913793b2789c8ad8cb854ea614be826b7161cde5c9b1dd7b6aef491231832
|
7
|
+
data.tar.gz: d6e94eb60260aac40acd7fab52c94730d1b0fa411d582744e08f566fccac88af713925c3053099cd7c94a2f009f80f8d965851c88e3baf86dd0422cf99af6e83
|
@@ -26,13 +26,25 @@ module ShopifyTransporter
|
|
26
26
|
line_items.group_by { |line_item| line_item['sku'] }.map do |_, associated_items|
|
27
27
|
case associated_items.size
|
28
28
|
when 1
|
29
|
-
associated_items.first
|
29
|
+
associated_items.first.except('product_type')
|
30
30
|
when 2
|
31
31
|
parent = associated_items.find { |x| x['product_type'] == 'configurable' }
|
32
32
|
child = associated_items.find { |x| x['product_type'] == 'simple' }
|
33
|
-
parent
|
34
|
-
|
35
|
-
|
33
|
+
next line_items_without_type(associated_items) unless should_merge_child_into_parent?(parent, child)
|
34
|
+
|
35
|
+
next parent.merge(child.slice('name')).except('product_type')
|
36
|
+
else
|
37
|
+
next line_items_without_type(associated_items)
|
38
|
+
end
|
39
|
+
end.flatten
|
40
|
+
end
|
41
|
+
|
42
|
+
def should_merge_child_into_parent?(parent, child)
|
43
|
+
parent.present? && child.present? && child['price'].present? && child['price'].to_f == 0
|
44
|
+
end
|
45
|
+
|
46
|
+
def line_items_without_type(line_items)
|
47
|
+
line_items.map { |item| item.except('product_type') }
|
36
48
|
end
|
37
49
|
|
38
50
|
def line_items_array(input)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shopify_transporter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.5.
|
4
|
+
version: 2.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shopify
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-12-
|
11
|
+
date: 2018-12-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|