huginn_acumen_product_agent 2.3.1 → 2.4.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 +4 -4
- data/lib/huginn_acumen_product_agent/acumen_client.rb +3 -0
- data/lib/huginn_acumen_product_agent/acumen_product_agent.rb +0 -18
- data/lib/huginn_acumen_product_agent/concerns/inv_product_query_concern.rb +34 -19
- data/lib/huginn_acumen_product_agent/concerns/prod_mkt_query_concern.rb +2 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7760602494bcd8f8605dd5f33b0635dea56bc781845f107cca0c254c9c8dd8ea
|
4
|
+
data.tar.gz: e9184274d23734ad701c37df55e906e2d0d4a325f69befee93cf8283d4d91e2d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 14a8335fde4527a3702aea87ce202e51bc73909faf81661a19adcf053b78b3a69d537a6cc6ac8660c1e0a48103f97198a987df49af5a741a1df64c90259a2472
|
7
|
+
data.tar.gz: 2caa53fead19661517904effa602bfbd3c4a46ad548979d80f080fc767e44b9d4380770974d0f5f363e7a9ed6ccfff09f84cf5acf9212f0af6df59ae641becc9
|
@@ -107,6 +107,8 @@ class AcumenClient
|
|
107
107
|
<column_name>Inv_Product.No_Backorder_Fill</column_name>
|
108
108
|
<column_name>Inv_Product.Non_Inventory</column_name>
|
109
109
|
<column_name>Inv_Product.Assembly</column_name>
|
110
|
+
<column_name>Inv_Product.Consignment</column_name>
|
111
|
+
<column_name>Inv_Product.SpecialLink</column_name>
|
110
112
|
</requested_output>
|
111
113
|
</acusoapRequest>
|
112
114
|
XML
|
@@ -156,6 +158,7 @@ class AcumenClient
|
|
156
158
|
<column_name>ProdMkt.Info_Text_02</column_name>
|
157
159
|
<column_name>ProdMkt.Religious_Text_Identifier</column_name>
|
158
160
|
<column_name>ProdMkt.Info_Alpha_07</column_name>
|
161
|
+
<column_name>ProdMkt.Info_Alpha_08</column_name>
|
159
162
|
</requested_output>
|
160
163
|
</acusoapRequest>
|
161
164
|
XML
|
@@ -190,7 +190,6 @@ module Agents
|
|
190
190
|
|
191
191
|
products.each do |product|
|
192
192
|
map_attributes(product)
|
193
|
-
update_availability(product)
|
194
193
|
end
|
195
194
|
|
196
195
|
return products
|
@@ -255,22 +254,5 @@ module Agents
|
|
255
254
|
end
|
256
255
|
end
|
257
256
|
|
258
|
-
def update_availability(product)
|
259
|
-
stock_quantity = product['acumenAttributes']['stock_quantity']
|
260
|
-
publication_date = product['datePublished']
|
261
|
-
no_backorder_fill = product['noBackorderFill']
|
262
|
-
stock_quantity = stock_quantity.present? ? stock_quantity.to_i : 0
|
263
|
-
|
264
|
-
if (!product['isDigital'] && product['productAvailability'] == 'available' && product['trackInventory'])
|
265
|
-
if ((publication_date && publication_date.to_datetime > DateTime.current().end_of_day) || (!no_backorder_fill && stock_quantity < 1))
|
266
|
-
product['productAvailability'] = 'preorder'
|
267
|
-
end
|
268
|
-
|
269
|
-
if (no_backorder_fill && stock_quantity < 1)
|
270
|
-
product['productAvailability'] = 'not available'
|
271
|
-
end
|
272
|
-
end
|
273
|
-
end
|
274
|
-
|
275
257
|
end
|
276
258
|
end
|
@@ -16,7 +16,7 @@ module InvProductQueryConcern
|
|
16
16
|
# This function returns an array of Acumen products mapped to Schema.org/Product
|
17
17
|
# objects. We've added additional fields of:
|
18
18
|
#
|
19
|
-
# * `
|
19
|
+
# * `isOnWebsite` -- used to control product deletion in external systems
|
20
20
|
# * `acumenAttributes` -- Additional acumen data that doesn't have a direct 1:1 field
|
21
21
|
# on the Product, but may be useful in other platforms
|
22
22
|
def process_inv_product_response(raw_data, digital_format_list)
|
@@ -44,9 +44,12 @@ module InvProductQueryConcern
|
|
44
44
|
|
45
45
|
product['@type'] = 'Product'
|
46
46
|
product['isTaxable'] = get_field_value(p, 'Inv_Product.Taxable') == '1'
|
47
|
-
product['
|
47
|
+
product['isOnWebsite'] = get_field_value(p, 'Inv_Product.Not_On_Website') == '0'
|
48
48
|
product['noBackorderFill'] = get_field_value(p, 'Inv_Product.No_Backorder_Fill') == '1'
|
49
|
-
product['
|
49
|
+
product['specialLink'] = get_field_value(p, 'Inv_Product.SpecialLink') == '1'
|
50
|
+
product['trackInventory'] = !(get_field_value(p, 'Inv_Product.Non_Inventory') == '1' ||
|
51
|
+
get_field_value(p, 'Inv_Product.Assembly') == '1' ||
|
52
|
+
get_field_value(p, 'Inv_Product.Consignment') == '1')
|
50
53
|
product['acumenAttributes'] = {
|
51
54
|
'info_alpha_1' => get_field_value(p, 'Inv_Product.Info_Alpha_1'),
|
52
55
|
'info_boolean_1' => get_field_value(p, 'Inv_Product.Info_Boolean_1'), # is_available_on_formed
|
@@ -57,12 +60,37 @@ module InvProductQueryConcern
|
|
57
60
|
'propertyID' => 'is_master',
|
58
61
|
'value' => get_field_value(p, 'Inv_Product.OnWeb_LinkOnly') == '0',
|
59
62
|
},
|
63
|
+
# Product availability within Acumen is not always a "line in the sand"
|
64
|
+
# situation in some cases, the requirements can become rather complex.
|
65
|
+
# As a result, this agent does not strictly set availability, but rather
|
66
|
+
# outputs the properties associated with setting it so that client-specific
|
67
|
+
# logic can be implemented in subsequent agents which may require external
|
68
|
+
# data (such as stock quantities for consignment products).
|
60
69
|
{
|
61
|
-
# NOTE: This is different than isAvailableForPurchase. This
|
62
70
|
'@type' => 'PropertyValue',
|
63
71
|
'propertyID' => 'disable_web_purchase',
|
64
|
-
'value' => get_field_value(p, 'Inv_Product.Disable_Web_Purchase'),
|
65
|
-
}
|
72
|
+
'value' => get_field_value(p, 'Inv_Product.Disable_Web_Purchase') == '1',
|
73
|
+
},
|
74
|
+
{
|
75
|
+
'@type' => 'PropertyValue',
|
76
|
+
'propertyID' => 'no_backorder_fill',
|
77
|
+
'value' => get_field_value(p, 'Inv_Product.No_Backorder_Fill') == '1',
|
78
|
+
},
|
79
|
+
{
|
80
|
+
'@type' => 'PropertyValue',
|
81
|
+
'propertyID' => 'not_on_website',
|
82
|
+
'value' => get_field_value(p, 'Inv_Product.Not_On_Website') == '1',
|
83
|
+
},
|
84
|
+
{
|
85
|
+
'@type' => 'PropertyValue',
|
86
|
+
'propertyID' => 'non_inventory',
|
87
|
+
'value' => get_field_value(p, 'Inv_Product.Non_Inventory') == '1',
|
88
|
+
},
|
89
|
+
{
|
90
|
+
'@type' => 'PropertyValue',
|
91
|
+
'propertyID' => 'is_consignment',
|
92
|
+
'value' => get_field_value(p, 'Inv_Product.Consignment') == '1',
|
93
|
+
},
|
66
94
|
]
|
67
95
|
|
68
96
|
product['offers'] = [{
|
@@ -82,19 +110,6 @@ module InvProductQueryConcern
|
|
82
110
|
not_on_website = get_field_value(p, 'Inv_Product.Not_On_Website')
|
83
111
|
disable_web_purchase = get_field_value(p, 'Inv_Product.Disable_Web_Purchase')
|
84
112
|
|
85
|
-
product_availability = 'available'
|
86
|
-
|
87
|
-
|
88
|
-
if (disable_web_purchase == '1')
|
89
|
-
product_availability = 'disabled'
|
90
|
-
end
|
91
|
-
|
92
|
-
if (not_on_website == '1')
|
93
|
-
product_availability = 'not available'
|
94
|
-
end
|
95
|
-
|
96
|
-
product['productAvailability'] = product_availability
|
97
|
-
|
98
113
|
weight = get_field_value(p, 'Inv_Product.Weight')
|
99
114
|
product['weight'] = get_quantitative_value(weight, 'oz.')
|
100
115
|
|
@@ -54,6 +54,7 @@ module ProdMktQueryConcern
|
|
54
54
|
'ProdMkt.Info_Text_02' => 'info_text_02',
|
55
55
|
'ProdMkt.Religious_Text_Identifier' => 'religious_text_identifier',
|
56
56
|
'ProdMkt.Info_Alpha_07' => 'info_alpha_07',
|
57
|
+
'ProdMkt.Info_Alpha_08' => 'info_alpha_08',
|
57
58
|
})
|
58
59
|
|
59
60
|
results[mapped['product_id']] = mapped
|
@@ -123,6 +124,7 @@ module ProdMktQueryConcern
|
|
123
124
|
product['acumenAttributes']['info_text_01'] = marketing['info_text_01'] # editorial_reviews
|
124
125
|
product['acumenAttributes']['info_text_02'] = marketing['info_text_02'] # product_samples
|
125
126
|
product['acumenAttributes']['info_alpha_07'] = marketing['info_alpha_07'] # video_urls
|
127
|
+
product['acumenAttributes']['info_alpha_08'] = marketing['info_alpha_08'] # flipbook_url
|
126
128
|
product['acumenAttributes']['meta_description'] = marketing['meta_description']
|
127
129
|
product['acumenAttributes']['religious_text_identifier'] = marketing['religious_text_identifier']
|
128
130
|
product['acumenAttributes']['status'] = marketing['status']
|
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: 2.
|
4
|
+
version: 2.4.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:
|
11
|
+
date: 2025-03-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -93,7 +93,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
93
93
|
- !ruby/object:Gem::Version
|
94
94
|
version: '0'
|
95
95
|
requirements: []
|
96
|
-
rubygems_version: 3.0.3
|
96
|
+
rubygems_version: 3.0.3.1
|
97
97
|
signing_key:
|
98
98
|
specification_version: 4
|
99
99
|
summary: Huginn agent for sane ACUMEN product data.
|