huginn_bigcommerce_product_agent 1.1.0 → 1.2.0
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: adaa89e639b5ab86d9a6d5a7115d600ced404287d7423a6bd916be655812f0e0
|
4
|
+
data.tar.gz: 33ccd02f821ec39473b22c459902e5f8f95d0f43abbf384187a621a1e2a9444d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 473d32273d6e23e5e1fdce6ae6f1cfe423d8d57261c1b6db18493f8b8a914ee687737f290be2632691b2cc2edd3d0a1639cdf2b0a2144cd9fd7361c9610d2baf
|
7
|
+
data.tar.gz: 95c85baae2de9bc618f1e4c39539e2cc1dd33830b5c6306fa5f6c6439e5228e7f76bb4d1ed77cf69e05349ec08f351347979c99303289a61db1ecd517ebc7801
|
@@ -97,12 +97,15 @@ module Agents
|
|
97
97
|
meta_fields_upsert += result[:meta_fields_upsert]
|
98
98
|
meta_fields_delete += result[:meta_fields_delete]
|
99
99
|
|
100
|
+
is_default_map = ::BigcommerceProductAgent::Mapper::ProductMapper.get_is_default(product)
|
101
|
+
|
100
102
|
# update modifier
|
101
103
|
sku_option_map = ::BigcommerceProductAgent::Mapper::ProductMapper.get_sku_option_label_map(product)
|
102
104
|
modifier_updates = ::BigcommerceProductAgent::Mapper::ModifierMapper.map(
|
103
105
|
bc_wrapper_product,
|
104
106
|
bc_children,
|
105
|
-
sku_option_map
|
107
|
+
sku_option_map,
|
108
|
+
is_default_map
|
106
109
|
)
|
107
110
|
@modifier.upsert(result[:product]['id'], modifier_updates[:upsert])
|
108
111
|
|
@@ -2,7 +2,7 @@ module BigcommerceProductAgent
|
|
2
2
|
module Mapper
|
3
3
|
class ModifierMapper
|
4
4
|
|
5
|
-
def self.map(bc_product, bc_children, sku_option_map)
|
5
|
+
def self.map(bc_product, bc_children, sku_option_map, is_default_map)
|
6
6
|
modifier = {
|
7
7
|
display_name: 'Option',
|
8
8
|
type: 'product_list',
|
@@ -42,7 +42,7 @@ module BigcommerceProductAgent
|
|
42
42
|
value_data: {
|
43
43
|
product_id: child['id']
|
44
44
|
},
|
45
|
-
is_default:
|
45
|
+
is_default: is_default_map[child['sku']],
|
46
46
|
adjusters: {
|
47
47
|
price: nil,
|
48
48
|
weight: nil,
|
@@ -6,6 +6,7 @@ module BigcommerceProductAgent
|
|
6
6
|
product = {
|
7
7
|
name: variant.nil? ? product['name'] : "#{product['name']} (#{self.get_option(variant)})",
|
8
8
|
sku: variant ? variant['sku'] : self.get_wrapper_sku(product),
|
9
|
+
is_default: variant && variant['isDefault'],
|
9
10
|
type: variant && variant['isDigital'] == true ? 'digital' : 'physical',
|
10
11
|
description: product['description'],
|
11
12
|
price: variant && variant['offers'] && variant['offers'][0] ? variant['offers'][0]['price'] : '0',
|
@@ -57,6 +58,16 @@ module BigcommerceProductAgent
|
|
57
58
|
return map
|
58
59
|
end
|
59
60
|
|
61
|
+
def self.get_is_default(product)
|
62
|
+
map = {}
|
63
|
+
|
64
|
+
product['model'].each do |model|
|
65
|
+
map[model['sku']] = model["isDefault"]
|
66
|
+
end
|
67
|
+
|
68
|
+
return map
|
69
|
+
end
|
70
|
+
|
60
71
|
private
|
61
72
|
|
62
73
|
def self.get_categories(product)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: huginn_bigcommerce_product_agent
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jacob Spizziri
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-03-
|
11
|
+
date: 2020-03-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|