huginn_acumen_product_agent 1.6.1 → 1.7.0
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f611c6b9e7567e84ec03753277031b227c70fee3afe17cfbf35be0c185932b4f
|
4
|
+
data.tar.gz: ecfc5e4acee56876eee9b4c3de78db3f6e40ff1cce60d5a6e834c75dae97523f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ccf91cb1986314c492cbe9b0b189503504705bc6521a8f7861bbef9338bdb2e27ebb2036b5b595c55c33c52f1cb81e4534ca9686b3d2a67cd1fa6dfa2389e6b
|
7
|
+
data.tar.gz: 63b33acb6744b016c1f08ddf409d6580c2e78e57b46c93ccfe91326b7233b2dc54db09cd5fb52ee6eb49f6178f0439ee0b9518d87633baefcd0e52a5a7af9e10
|
@@ -96,6 +96,7 @@ class AcumenClient
|
|
96
96
|
<column_name>Inv_Product.Next_Release</column_name>
|
97
97
|
<column_name>Inv_Product.BO_Reason</column_name>
|
98
98
|
<column_name>Inv_Product.Not_On_Website</column_name>
|
99
|
+
<column_name>Inv_Product.Not_Active</column_name>
|
99
100
|
</requested_output>
|
100
101
|
</acusoapRequest>
|
101
102
|
XML
|
@@ -11,7 +11,28 @@ module Agents
|
|
11
11
|
default_schedule 'never'
|
12
12
|
|
13
13
|
description <<-MD
|
14
|
-
Huginn agent for sane ACUMEN product data.
|
14
|
+
Huginn agent for retrieving sane ACUMEN product data.
|
15
|
+
|
16
|
+
## Agent Options
|
17
|
+
The following outlines the available options in this agent
|
18
|
+
|
19
|
+
### Acumen Connection
|
20
|
+
* endpoint: The root URL for the Acumen API
|
21
|
+
* site_code: The site code from Acumen
|
22
|
+
* password: The Acumen API password
|
23
|
+
|
24
|
+
### Variant Settings
|
25
|
+
* physical_formats: A list of the formats associated with a physical product
|
26
|
+
* digital_formats: A list of the formats associated with a digital product
|
27
|
+
|
28
|
+
### Product Attributes
|
29
|
+
* attribute_to_property: An optional map linking Acumen attributes to Schema.org
|
30
|
+
product properties.
|
31
|
+
|
32
|
+
### Other Options
|
33
|
+
* ignore_skus: An optional array of Acumen product skus that will be intentionally
|
34
|
+
excluded from any output.
|
35
|
+
|
15
36
|
MD
|
16
37
|
|
17
38
|
def default_options
|
@@ -22,7 +43,6 @@ module Agents
|
|
22
43
|
'physical_formats' => [],
|
23
44
|
'digital_formats' => [],
|
24
45
|
'attribute_to_property' => {},
|
25
|
-
'contributor_types_map' => {},
|
26
46
|
}
|
27
47
|
end
|
28
48
|
|
@@ -51,10 +71,6 @@ module Agents
|
|
51
71
|
errors.add(:base, "if provided, attribute_to_property must be a hash")
|
52
72
|
end
|
53
73
|
|
54
|
-
unless options['contributor_types_map'].is_a?(Hash)
|
55
|
-
errors.add(:base, "if provided, contributor_types_map must be a hash")
|
56
|
-
end
|
57
|
-
|
58
74
|
if options['ignore_skus']
|
59
75
|
unless options['ignore_skus'].is_a?(Array)
|
60
76
|
errors.add(:base, "if provided, ignore_skus must be an array")
|
@@ -12,10 +12,7 @@ module AcumenProductQueryConcern
|
|
12
12
|
response = acumen_client.get_products(ids)
|
13
13
|
products = []
|
14
14
|
|
15
|
-
|
16
|
-
unless response[0]['Inv_Product.Not_On_Website']['__content__'] === '1'
|
17
|
-
products = parse_product_request(response)
|
18
|
-
end
|
15
|
+
products = parse_product_request(response)
|
19
16
|
|
20
17
|
response = acumen_client.get_products_marketing(ids)
|
21
18
|
marketing = parse_product_marketing_request(response)
|
@@ -129,6 +126,7 @@ module AcumenProductQueryConcern
|
|
129
126
|
variant['@type'] = 'ProductModel'
|
130
127
|
variant['isDefault'] = false
|
131
128
|
variant['isTaxable'] = field_value(p, 'Inv_Product.Taxable') == '1'
|
129
|
+
variant['isAvailableForPurchase'] = field_value(p, 'Inv_Product.Not_On_Website') == '0'
|
132
130
|
variant['acumenAttributes'] = {
|
133
131
|
'is_master' => field_value(p, 'Inv_Product.OnWeb_LinkOnly') == '0'
|
134
132
|
}
|
@@ -163,6 +161,7 @@ module AcumenProductQueryConcern
|
|
163
161
|
'info_alpha_1' => field_value(p, 'Inv_Product.Info_Alpha_1'),
|
164
162
|
'info_boolean_1' => field_value(p, 'Inv_Product.Info_Boolean_1'),
|
165
163
|
},
|
164
|
+
'isAvailableForPurchase' => field_value(p, variant['isAvailableForPurchase']),
|
166
165
|
}
|
167
166
|
|
168
167
|
category = field_value(p, 'Inv_Product.Category')
|
@@ -426,6 +425,17 @@ module AcumenProductQueryConcern
|
|
426
425
|
end
|
427
426
|
end
|
428
427
|
end
|
428
|
+
|
429
|
+
model_ids = product['model'].map { |m| m['identifier'] }
|
430
|
+
primary_variant = product['model'].select { |m| m['identifier'] == model_ids.min }.first
|
431
|
+
|
432
|
+
# Set the base SKU to the SKU of the oldest record.
|
433
|
+
# The base_sku property is designed to be a system value specific to the inegration using this agent.
|
434
|
+
# As a result, we don't particularly care what that value is so long as we can retrieve it consistently
|
435
|
+
# across executions. If a paperback product is created first, this will always return that product's SKU
|
436
|
+
# as the base. This gives us a consistent way to link Acumen products to an external system where database
|
437
|
+
# IDs may not match.
|
438
|
+
set_base_sku(product, primary_variant ? primary_variant['sku'] : product['model'][0]['sku'])
|
429
439
|
end
|
430
440
|
result
|
431
441
|
end
|
@@ -445,6 +455,18 @@ module AcumenProductQueryConcern
|
|
445
455
|
field[key]['__content__'] if field[key]
|
446
456
|
end
|
447
457
|
|
458
|
+
def set_base_sku(product, sku)
|
459
|
+
|
460
|
+
product['additionalProperty'].push({
|
461
|
+
'@type' => 'PropertyValue',
|
462
|
+
'propertyID' => 'baseSku',
|
463
|
+
'name' => 'Base SKU',
|
464
|
+
'value' => sku,
|
465
|
+
})
|
466
|
+
|
467
|
+
product
|
468
|
+
end
|
469
|
+
|
448
470
|
def quantitative_value(value, unit)
|
449
471
|
{
|
450
472
|
'@type' => 'QuantitativeValue',
|
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.
|
4
|
+
version: 1.7.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-11-
|
11
|
+
date: 2020-11-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|