rsr_group 1.5.2 → 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
  SHA1:
3
- metadata.gz: 3eb7dadd20e33a1620a26d64529fd62e1b0366e0
4
- data.tar.gz: 628845bd5832b8a3862cb7eeab81b9108f5986fb
3
+ metadata.gz: 4a318109711d26c97e8e5343d4e283f1f4f1c1ca
4
+ data.tar.gz: d5f49895b71acf5953dd2195bfdcfb99deac0adf
5
5
  SHA512:
6
- metadata.gz: a42567b1c71acc9838c908f877388957a29e70b4209d204fd069f00f8cea5840bf1ba780cffe8d70f67f9085aed0e5bbcd6532d30c4aa578b2ae822887b180f7
7
- data.tar.gz: 447c9b7d78ffb6546ef65571f429c06d2be700de96ecce67a1bf403ad92f53abc73e3fbb693e76235609929cd4f9c29ccceffbf38425fe70cca7d29227e85c5d
6
+ metadata.gz: 6f3262e9ba5946c4211a7e993eab625d46b5dd96977a1c4928c675fb7bf81c16b3d7986629142b525fcd5f973beebbf281fee485dc978334c70f0ff15dff8619
7
+ data.tar.gz: 2c3cd5bcb6d053a0efc19ae41ae6e6c61db4a220d750e7a047e82454aa8f8da4f1df95f1395ed15250a815882fa59c5448df95e7e28f970d44ee2ca0230e20e3
@@ -6,6 +6,7 @@ module RsrGroup
6
6
  INVENTORY_FILENAME = 'rsrinventory-new.txt'.freeze
7
7
  KEYDEALER_FILENAME = 'rsrinventory-keydlr-new.txt'.freeze
8
8
  QTY_FILENAME = 'IM-QTY-CSV.csv'.freeze
9
+ MAP_FILENAME = 'retail-map.csv'.freeze
9
10
 
10
11
  def initialize(options = {})
11
12
  requires!(options, :username, :password)
@@ -17,6 +18,11 @@ module RsrGroup
17
18
  new(options).all
18
19
  end
19
20
 
21
+ def self.map_prices(options = {})
22
+ requires!(options, :username, :password)
23
+ new(options).map_prices
24
+ end
25
+
20
26
  def self.quantities(options = {})
21
27
  requires!(options, :username, :password)
22
28
  new(options).quantities
@@ -123,6 +129,31 @@ module RsrGroup
123
129
  items
124
130
  end
125
131
 
132
+ def map_prices
133
+ rows = []
134
+
135
+ connect(@options) do |ftp|
136
+ if ftp.nlst.include?(KEYDEALER_DIR)
137
+ ftp.chdir(KEYDEALER_DIR)
138
+ else
139
+ ftp.chdir(INVENTORY_DIR)
140
+ end
141
+
142
+ csv = ftp.gettextfile(MAP_FILENAME, nil)
143
+
144
+ CSV.parse(csv) do |row|
145
+ rows << {
146
+ stock_number: row[0],
147
+ map_price: row[1],
148
+ }
149
+ end
150
+
151
+ ftp.close
152
+ end
153
+
154
+ rows
155
+ end
156
+
126
157
  def quantities
127
158
  rows = []
128
159
 
@@ -1,3 +1,3 @@
1
1
  module RsrGroup
2
- VERSION = '1.5.2'
2
+ VERSION = '1.6.0'
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: 1.5.2
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dale Campbell