zanders 5.0.4 → 5.0.5

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: 9934aa161818a97363dfa7e998e089c2fb0b9b0142fadfba8bcf88205511cc5e
4
- data.tar.gz: bde80e0294a1585486162e4042f41fdf7dc882d8b3fc24a3cecda2067ce2e812
3
+ metadata.gz: 52880c26700658916eeca8313e9b38cc85dba6234049a921a7bd6b053b1b36a8
4
+ data.tar.gz: 1dc7740edcac024a7c58123947412a5edf377bee4b8a32a31c903b12345a23db
5
5
  SHA512:
6
- metadata.gz: be742bc1e6663a435d4195f253a5f63b896bdabd4cd89f18b34fae5143644f91f8583307de5786cac49ff830e9657421ef99b99d3435884d658f727be4c59777
7
- data.tar.gz: 984a6d1595756445efb38ac8a391e620036b50695fab7d4400ca9b4794aa983681ff5df06b3df0cc5f61a4c1adcdb3eddd0da67f1af7b033571723911c0d8250
6
+ metadata.gz: 5021674e822a990653da4d9e540941a7de1cbe495e2abd502744d384f50d24013120f86f8ae9c38bcce721572fe69d3551889735a52f3f0e675b4d7f92a65f93
7
+ data.tar.gz: 332fd8df0f24016d13c972e664bde5c2d27b77775b1b5465a0f2434262a6676fb19c9ce46d74a01b018a655e83df455dd66a580c454dbfa7ce03e4b039118896
@@ -39,13 +39,14 @@ module Zanders
39
39
 
40
40
  def map_hash(node)
41
41
  features = map_features(node)
42
+ sale_dates = [content_for(node, 'ITEMSALESTART'), content_for(node, 'ITEMSALEEND')]
42
43
 
43
44
  {
44
45
  name: content_for(node, 'ITEMDESCRIPTION'),
45
46
  upc: content_for(node, 'ITEMUPC'),
46
47
  item_identifier: content_for(node, 'ITEMNO'),
47
48
  quantity: content_for(node, 'ITEMQTYAVAIL'),
48
- price: content_for(node, 'ITEMPRICE'),
49
+ price: active_sale?(sale_dates) ? content_for(node, 'ITEMSALEPRICE') : content_for(node, 'ITEMPRICE'),
49
50
  short_description: content_for(node, 'ITEMDESCRIPTION'),
50
51
  category: content_for(node, 'ITEMCATEGORYNAME'),
51
52
  mfg_number: content_for(node, 'ITEMMPN'),
@@ -70,5 +71,10 @@ module Zanders
70
71
  features.symbolize_keys!
71
72
  end
72
73
 
74
+ def active_sale?(sale_dates)
75
+ return false if !sale_dates.all?(&:present?)
76
+
77
+ Date.today.between?(Date.parse(sale_dates.first), Date.parse(sale_dates.second))
78
+ end
73
79
  end
74
80
  end
@@ -1,3 +1,3 @@
1
1
  module Zanders
2
- VERSION = '5.0.4'.freeze
2
+ VERSION = '5.0.5'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zanders
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.4
4
+ version: 5.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Knight
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2023-05-16 00:00:00.000000000 Z
12
+ date: 2023-08-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri