zanders 5.0.4 → 5.0.6

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: c226b165a425dac8ee88fc6a8f6abc4670e405628c5c4f43f488cde7374daffc
4
+ data.tar.gz: 319c0d000c94dd32e5949b2c922d955a2b6dfda17fb9d614a42c9d219142d03e
5
5
  SHA512:
6
- metadata.gz: be742bc1e6663a435d4195f253a5f63b896bdabd4cd89f18b34fae5143644f91f8583307de5786cac49ff830e9657421ef99b99d3435884d658f727be4c59777
7
- data.tar.gz: 984a6d1595756445efb38ac8a391e620036b50695fab7d4400ca9b4794aa983681ff5df06b3df0cc5f61a4c1adcdb3eddd0da67f1af7b033571723911c0d8250
6
+ metadata.gz: 03ffd7dfc8ebaad8a0eac879a66a94e06d6c7b17957caaa536323c9049a6eb9b038e283d95ead2529f0aba7f82c41063e11323218e96c684abf4f8e0df5a6c45
7
+ data.tar.gz: a6482867c79930bd286c245ac0b786b2f723d95593bf63b2db2883e2552076be1691fbbf9a248f24b569f47c38bf9e8d0b6ca50a69e1bef45b116906f781d946
@@ -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
data/lib/zanders/order.rb CHANGED
@@ -64,7 +64,14 @@ module Zanders
64
64
  ])
65
65
  end
66
66
 
67
- shipping_code = (@options[:account] == :accessory ? 'UM' : 'UG')
67
+ shipping_code = case @options[:account]
68
+ when :accessory
69
+ 'UM'
70
+ when :firearm
71
+ 'UG'
72
+ when :default
73
+ 'BW'
74
+ end
68
75
 
69
76
  shipping_information.push(*[
70
77
  { key: 'shipDate', value: Time.now.strftime("%Y-%m-%d") },
@@ -1,3 +1,3 @@
1
1
  module Zanders
2
- VERSION = '5.0.4'.freeze
2
+ VERSION = '5.0.6'.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.6
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-09-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri