huginn_acumen_product_agent 1.6.0 → 1.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '039c056f31f39d29c6dd956c1eea702c9719ee62c1549d1ee5eba1f7154aabcc'
4
- data.tar.gz: 11cde731d4163bc95d8ea9b154171d8c1be4998812fdfa1c7bf9d3e78a77fd07
3
+ metadata.gz: 158ba4f844cb9b68a1e554d322c1cdde320fe46bb3740b22f97c490ef7a4f35f
4
+ data.tar.gz: c567ef95d19590b6df91f6b961f8f68fa8efc28151c3e446245165b084b273aa
5
5
  SHA512:
6
- metadata.gz: ffe42c8cb2135556c76c64ee241b59256632196ef38ce920c365f6e501eab321d300142d41ed04eff1da9a6a98af8498cf683488408db113f1322916774b9b1f
7
- data.tar.gz: 1ef83798e88e33c4a275dd298a0d6abb5cf48a920903ea7086838634d04226023e6be25f7c54b769d31b158c71326cf8d3ddc1aee5af8ba1b292dd1b7ffeb63a
6
+ metadata.gz: d4d0b0dd3eb5bc6e7490922d37bb7760f9590c0e6737ec377f84b9ff1e743ac388c3676ab15b7ff4e5a1a4898f5c20451b7ab346bbcc5202afecb0f40b576244
7
+ data.tar.gz: a2422b4b261212d2ae098c71da5ec0adb823704798bb852157019d293fc8ecf656437777ba17b8a4fb9bc5b89f4bbf138ee01c9d126768e5cb9e9faf0a96a03e
@@ -95,6 +95,7 @@ class AcumenClient
95
95
  <column_name>Inv_Product.Category</column_name>
96
96
  <column_name>Inv_Product.Next_Release</column_name>
97
97
  <column_name>Inv_Product.BO_Reason</column_name>
98
+ <column_name>Inv_Product.Not_On_Website</column_name>
98
99
  </requested_output>
99
100
  </acusoapRequest>
100
101
  XML
@@ -10,7 +10,12 @@ module AcumenProductQueryConcern
10
10
 
11
11
  def get_products_by_ids(acumen_client, ids)
12
12
  response = acumen_client.get_products(ids)
13
- products = parse_product_request(response)
13
+ products = []
14
+
15
+ # Filter out Not_On_Website === '1'
16
+ unless response[0]['Inv_Product.Not_On_Website']['__content__'] === '1'
17
+ products = parse_product_request(response)
18
+ end
14
19
 
15
20
  response = acumen_client.get_products_marketing(ids)
16
21
  marketing = parse_product_marketing_request(response)
@@ -86,20 +91,24 @@ module AcumenProductQueryConcern
86
91
 
87
92
  def get_product_categories(acumen_client, products)
88
93
  # fetch categories
89
- skus = products.map { |product| product['sku'] }
94
+
95
+ skus = products.map { |product| product['model'].map { |m| m['sku'] } }[0]
90
96
  response = acumen_client.get_product_categories(skus)
91
97
  categories = process_product_categories_query(response)
92
98
 
93
99
  # map categories to products
94
100
  products.each do |product|
95
- sku = product['sku']
96
- if categories[sku]
97
- active = categories[sku].select { |c| c['inactive'] == '0' }
98
- product['categories'] = active.map do |category|
99
- {
100
- '@type' => 'Thing',
101
- 'identifier' => category['category_id']
102
- }
101
+ product['model'].each do |variant|
102
+ variant['categories'] = []
103
+ sku = variant['sku']
104
+ if categories[sku]
105
+ active = categories[sku].select { |c| c['inactive'] == '0' }
106
+ active.map do |category|
107
+ variant['categories'].push({
108
+ '@type' => 'Thing',
109
+ 'identifier' => category['category_id']
110
+ })
111
+ end
103
112
  end
104
113
  end
105
114
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: huginn_acumen_product_agent
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.0
4
+ version: 1.6.1
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-10-12 00:00:00.000000000 Z
11
+ date: 2020-11-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler