huginn_acumen_product_agent 1.3.0 → 1.6.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: 66d5a4f9cc1e03ceb98d0ade524482571770bc455f303b35a10ae8d6f64611d5
4
- data.tar.gz: ece29b484441dacd6a51b891dfbb4ab25a9fde1a28b0b1864302563e9e084703
3
+ metadata.gz: '039c056f31f39d29c6dd956c1eea702c9719ee62c1549d1ee5eba1f7154aabcc'
4
+ data.tar.gz: 11cde731d4163bc95d8ea9b154171d8c1be4998812fdfa1c7bf9d3e78a77fd07
5
5
  SHA512:
6
- metadata.gz: fc8a70be138bf5ab4fe2be007ed2280bd2599784f2170b071d6933987dc348e323fc9c14529c96d5dc0f11bc3c66977c518e64576b15bf89c2f17bab730ddc82
7
- data.tar.gz: 707344746b37b2fe801d639a1489d29d56ea8bbf69f8ce50ee5b31545163864d9872045f191c99b158233de63715d3d4d35c19d5418581cb51f59a53afd4201f
6
+ metadata.gz: ffe42c8cb2135556c76c64ee241b59256632196ef38ce920c365f6e501eab321d300142d41ed04eff1da9a6a98af8498cf683488408db113f1322916774b9b1f
7
+ data.tar.gz: 1ef83798e88e33c4a275dd298a0d6abb5cf48a920903ea7086838634d04226023e6be25f7c54b769d31b158c71326cf8d3ddc1aee5af8ba1b292dd1b7ffeb63a
@@ -93,6 +93,8 @@ class AcumenClient
93
93
  <column_name>Inv_Product.Info_Alpha_1</column_name>
94
94
  <column_name>Inv_Product.Info_Boolean_1</column_name>>
95
95
  <column_name>Inv_Product.Category</column_name>
96
+ <column_name>Inv_Product.Next_Release</column_name>
97
+ <column_name>Inv_Product.BO_Reason</column_name>
96
98
  </requested_output>
97
99
  </acusoapRequest>
98
100
  XML
@@ -141,6 +143,7 @@ class AcumenClient
141
143
  <column_name>ProdMkt.Info_Text_01</column_name>
142
144
  <column_name>ProdMkt.Info_Text_02</column_name>
143
145
  <column_name>ProdMkt.Religious_Text_Identifier</column_name>
146
+ <column_name>ProdMkt.Info_Alpha_07</column_name>
144
147
  </requested_output>
145
148
  </acusoapRequest>
146
149
  XML
@@ -54,6 +54,12 @@ module Agents
54
54
  unless options['contributor_types_map'].is_a?(Hash)
55
55
  errors.add(:base, "if provided, contributor_types_map must be a hash")
56
56
  end
57
+
58
+ if options['ignore_skus']
59
+ unless options['ignore_skus'].is_a?(Array)
60
+ errors.add(:base, "if provided, ignore_skus must be an array")
61
+ end
62
+ end
57
63
  end
58
64
 
59
65
  def working?
@@ -78,6 +84,7 @@ module Agents
78
84
  password = interpolated['password']
79
85
  physical_formats = interpolated['physical_formats']
80
86
  digital_formats = interpolated['digital_formats']
87
+ ignore_skus = interpolated['ignore_skus'] ? interpolated['ignore_skus'] : []
81
88
 
82
89
  auth = {
83
90
  'site_code' => site_code,
@@ -104,7 +111,9 @@ module Agents
104
111
  end
105
112
 
106
113
  products.each do |product|
107
- create_event payload: product
114
+ unless ignore_skus.include?(product['sku'])
115
+ create_event payload: product
116
+ end
108
117
  end
109
118
  end
110
119
 
@@ -20,7 +20,16 @@ module AcumenProductQueryConcern
20
20
 
21
21
  def get_variants_for_ids(acumen_client, ids)
22
22
  result = get_linked_products_by_ids(acumen_client, ids)
23
- result.select { |link| link['alt_format'].to_s != 0.to_s }
23
+
24
+ # Filtering out duplicate links getting sent from acumen
25
+ filter = []
26
+ result.each do |link|
27
+ if (link['alt_format'].to_s != 0.to_s && !link.in?(filter))
28
+ filter.push(link)
29
+ end
30
+ end
31
+
32
+ return filter
24
33
  end
25
34
 
26
35
  def get_linked_products_by_ids(acumen_client, ids)
@@ -106,6 +115,7 @@ module AcumenProductQueryConcern
106
115
  'Inv_Product.SubTitle' => 'disambiguatingDescription',
107
116
  'Inv_Product.ISBN_UPC' => 'isbn',
108
117
  'Inv_Product.Pub_Date' => 'datePublished',
118
+ 'Inv_Product.Next_Release' => 'releaseDate',
109
119
  })
110
120
  variant['@type'] = 'ProductModel'
111
121
  variant['isDefault'] = false
@@ -117,11 +127,13 @@ module AcumenProductQueryConcern
117
127
  variant['offers'] = [{
118
128
  '@type' => 'Offer',
119
129
  'price' => field_value(p, 'Inv_Product.Price_1'),
130
+ 'availability' => field_value(p, 'Inv_Product.BO_Reason')
120
131
  }]
121
132
  if field_value(p, 'Inv_Product.Price_2')
122
133
  variant['offers'].push({
123
134
  '@type' => 'Offer',
124
135
  'price' => field_value(p, 'Inv_Product.Price_2'),
136
+ 'availability' => field_value(p, 'Inv_Product.BO_Reason')
125
137
  })
126
138
  end
127
139
 
@@ -223,6 +235,7 @@ module AcumenProductQueryConcern
223
235
  'ProdMkt.Info_Text_01' => 'info_text_01',
224
236
  'ProdMkt.Info_Text_02' => 'info_text_02',
225
237
  'ProdMkt.Religious_Text_Identifier' => 'religious_text_identifier',
238
+ 'ProdMkt.Info_Alpha_07' => 'info_alpha_07',
226
239
  })
227
240
 
228
241
  results[mapped['product_id']] = mapped
@@ -276,6 +289,7 @@ module AcumenProductQueryConcern
276
289
  product['acumenAttributes']['extent_value'] = marketing['extent_value']
277
290
  product['acumenAttributes']['info_text_01'] = marketing['info_text_01']
278
291
  product['acumenAttributes']['info_text_02'] = marketing['info_text_02']
292
+ product['acumenAttributes']['info_alpha_07'] = marketing['info_alpha_07']
279
293
  product['acumenAttributes']['meta_description'] = marketing['meta_description']
280
294
  product['acumenAttributes']['religious_text_identifier'] = marketing['religious_text_identifier']
281
295
  product['acumenAttributes']['status'] = marketing['status']
@@ -370,9 +384,11 @@ module AcumenProductQueryConcern
370
384
  links.each do |link|
371
385
  from_id = link['from_id']
372
386
  to_id = link['to_id']
373
- variant = variants_map[to_id]
374
- variant['isDefault'] = false
375
- products_map[from_id]['model'].push(*variant['model'])
387
+ if variants_map.key?(to_id)
388
+ variant = variants_map[to_id]
389
+ variant['isDefault'] = false
390
+ products_map[from_id]['model'].push(*variant['model'])
391
+ end
376
392
  end
377
393
 
378
394
  result = []
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.3.0
4
+ version: 1.6.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-05-27 00:00:00.000000000 Z
11
+ date: 2020-10-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler