rsr_group 0.1.1 → 0.1.2

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
  SHA1:
3
- metadata.gz: bdf930a3112895c24c9f80adc0930c57187272fd
4
- data.tar.gz: 0d470849ce240499bd21e53cb7d8853cf360db6c
3
+ metadata.gz: 584dca1a03f8e1b665235e7559b77e9cc5597a9c
4
+ data.tar.gz: 3181d672ea996649f4aaa8f512c825da3166ad4a
5
5
  SHA512:
6
- metadata.gz: 14d46a39f033643db9cceacad982ac141205239598f0b70bb0a941f61f24704c189adffa38294f34ad98600cfcc81b6264ca89345992a023ddb40574c2e1677e
7
- data.tar.gz: bf5ff47c89e973ee895321938e1131541b5ee1ff9ec6732a5927c815a0f4e0c17ddf5eb274152f888ae9af75b5007848f023835e00cafe0e9ef344990dcd0c95
6
+ metadata.gz: c14120e73232d32f18777b8a28b418be309799d83282efc5162f2831d772de407792e3813c933fe94478a4617e1473f13964b81c358a1f00ca8d2e4bdeba47a8
7
+ data.tar.gz: 3fdbabbdd5fad7e1c854b6a535afe1ffb209177190b9a06e6c8488df2e773f838d01f5b9870dbb4f14da1c6d570a6d6c66a01a168cbc1a98efe98a8179ff09c4
@@ -25,21 +25,21 @@ module RsrGroup
25
25
  # Use a zero-byte char as `quote_char` since the data has no quote character.
26
26
  CSV.parse(lines, col_sep: ';', quote_char: "\x00") do |row|
27
27
  items << {
28
- stock_number: row[0],
29
- upc: row[1],
30
- description: row[2],
28
+ stock_number: sanitize(row[0]),
29
+ upc: sanitize(row[1]),
30
+ description: sanitize(row[2]),
31
31
  department: row[3].nil? ? row[3] : RsrGroup::Department.new(row[3]),
32
- manufacturer_id: row[4],
33
- retail_price: row[5],
34
- regular_price: row[6],
35
- weight: row[7],
36
- quantity: row[8],
37
- model: row[9],
38
- manufacturer_name: row[10],
39
- manufacturer_part_number: row[11],
40
- allocated_closeout_deleted: row[12],
41
- description_full: row[13],
42
- image_name: row[14],
32
+ manufacturer_id: sanitize(row[4]),
33
+ retail_price: sanitize(row[5]),
34
+ regular_price: sanitize(row[6]),
35
+ weight: sanitize(row[7]),
36
+ quantity: sanitize(row[8]),
37
+ model: sanitize(row[9]),
38
+ manufacturer_name: sanitize(row[10]),
39
+ manufacturer_part_number: sanitize(row[11]),
40
+ allocated_closeout_deleted: sanitize(row[12]),
41
+ description_full: sanitize(row[13]),
42
+ image_name: sanitize(row[14]),
43
43
  restricted_states: {
44
44
  AK: row[15] == 'Y',
45
45
  AL: row[16] == 'Y',
@@ -97,11 +97,11 @@ module RsrGroup
97
97
  adult_signature_required: row[69] == 'Y',
98
98
  blocked_from_drop_ship: row[70] == 'Y',
99
99
  date_entered: row[71].nil? ? row[71] : Date.strptime(row[71], '%Y%m%d'),
100
- retail_map: row[72],
100
+ retail_map: sanitize(row[72]),
101
101
  image_disclaimer: row[73] == 'Y',
102
- shipping_length: row[74],
103
- shipping_width: row[75],
104
- shipping_height: row[76],
102
+ shipping_length: sanitize(row[74]),
103
+ shipping_width: sanitize(row[75]),
104
+ shipping_height: sanitize(row[76]),
105
105
  }
106
106
  end
107
107
  end
@@ -109,5 +109,12 @@ module RsrGroup
109
109
  items
110
110
  end
111
111
 
112
+ private
113
+
114
+ def sanitize(data)
115
+ return data unless data.is_a?(String)
116
+ data.strip
117
+ end
118
+
112
119
  end
113
120
  end
@@ -1,3 +1,3 @@
1
1
  module RsrGroup
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rsr_group
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dale Campbell