huginn_bigcommerce_product_agent 1.4.1 → 1.4.2

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: 80abf4633b57aeb958ec7f79f516f860fb099c20e6962de6e4cd0d8d0e1f3f5c
4
- data.tar.gz: df57c8f677d590947fc4fce038740adc6d2aba7618acf60eca3c4a9bcaa5700a
3
+ metadata.gz: 4212c209c32fafb12fc7746a038bcb4c20af8cde053cb2adc44cff87e8112433
4
+ data.tar.gz: 4dd2faafdf9ab8422eacd7c407ccf35549a69ace3df0a9a748c09bc91a038ffc
5
5
  SHA512:
6
- metadata.gz: 817b6c0d76780bfab457aaf7a6b67693caf97d6d7c581361270adb1ff874cef268a63adf74b52846d7278c4ad02c9d095c230e7af7ffc77ac3572b73a121b505
7
- data.tar.gz: a87ce903ed0c6c9c9e47fdb68acefcf1de788f8f6f754d02aa149793bed703846087a324b9c4004a99b5d3d9bf4de83de6dc223a5c59cf451093f4961dad5f22
6
+ metadata.gz: c871f927452151ecd880b7b68731d8629100262911c9fc7d4566cf7f31a29c626bedba74f5dcb83dbd135413a95a781042d1e6408b060c00e0bf4106c408d2af
7
+ data.tar.gz: a275f1a162b1a7ed5633b5e0868766eb9e41b9b1ce0e8a024c5bc241183bf286ddc582f53df9b580e2ea3cb52b7ad6de51bdc1274b13857ecb153a206e924ce3
@@ -28,7 +28,8 @@ module Agents
28
28
  'custom_fields_map' => {},
29
29
  'meta_fields_map' => {},
30
30
  'meta_fields_namespace' => '',
31
- 'mode' => modes[0]
31
+ 'mode' => modes[0],
32
+ 'not_purchasable_format_list' => []
32
33
  }
33
34
  end
34
35
 
@@ -62,6 +63,10 @@ module Agents
62
63
  unless options['mode'].present? && modes.include?(options['mode'])
63
64
  errors.add(:base, "mode is a required field and must be one of: #{modes.join(', ')}")
64
65
  end
66
+
67
+ unless options['not_purchasable_format_list'].present? && !options['not_purchasable_format_list'].is_a?(Array)
68
+ errors.add(:base, 'not_purchasable_format_list must be an Array')
69
+ end
65
70
  end
66
71
 
67
72
  def working?
@@ -183,6 +188,8 @@ module Agents
183
188
  [option_value],
184
189
  product_id,
185
190
  bc_variant.nil? ? nil : bc_variant['id'],
191
+ interpolated['not_purchasable_format_list'],
192
+ bc_option_value
186
193
  )
187
194
  end
188
195
 
@@ -28,7 +28,7 @@ module BigcommerceProductAgent
28
28
  sku: product ? product['sku'] : default_sku,
29
29
  is_default: product['isDefault'],
30
30
  type: product['isDigital'] == true || is_digital ? 'digital' : 'physical',
31
- description: product['description'],
31
+ description: product['description'] || '',
32
32
  price: product['offers'] && product['offers'][0] ? product['offers'][0]['price'] : '0',
33
33
  categories: self.get_categories(product),
34
34
  available: 'available',
@@ -37,7 +37,7 @@ module BigcommerceProductAgent
37
37
  depth: product['depth'] ? product['depth']['value'] : '0',
38
38
  height: product['height'] ? product['height']['value'] : '0',
39
39
  meta_keywords: self.meta_keywords(product),
40
- meta_description: self.meta_description(product),
40
+ meta_description: self.meta_description(product) || '',
41
41
  search_keywords: self.meta_keywords(product).join(','),
42
42
  is_visible: variant ? false : true,
43
43
  }
@@ -2,7 +2,7 @@ module BigcommerceProductAgent
2
2
  module Mapper
3
3
  class VariantMapper
4
4
 
5
- def self.map(variant, option_values, product_id, variant_id=nil)
5
+ def self.map(variant, option_values, product_id, variant_id=nil, not_purchasable_format_list, bc_option_value)
6
6
  mapped = {
7
7
  product_id: product_id,
8
8
  sku: variant['sku'],
@@ -29,6 +29,14 @@ module BigcommerceProductAgent
29
29
  mapped[:id] = variant_id
30
30
  end
31
31
 
32
+ unless not_purchasable_format_list.nil?
33
+ not_purchasable_format_list.each do |format|
34
+ if format == bc_option_value['label']
35
+ mapped[:purchasing_disabled] = true
36
+ end
37
+ end
38
+ end
39
+
32
40
  return mapped
33
41
  end
34
42
 
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.1
4
+ version: 1.4.2
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-05-26 00:00:00.000000000 Z
11
+ date: 2020-06-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler