peddler 0.7.5 → 0.7.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -5
- data/lib/mws/fulfillment_inbound_shipment.rb +84 -0
- data/lib/mws/fulfillment_inventory.rb +20 -0
- data/lib/mws/fulfillment_outbound_shipment.rb +53 -0
- data/lib/mws/off_amazon_payments.rb +1 -1
- data/lib/peddler/client.rb +3 -1
- data/lib/peddler/flat_file_parser.rb +53 -0
- data/lib/peddler/parser.rb +15 -11
- data/lib/peddler/version.rb +1 -1
- data/test/integration/test_fulfillment_inbound_shipment.rb +11 -0
- data/test/integration/test_fulfillment_inventory.rb +11 -0
- data/test/integration/test_fulfillment_outbound_shipment.rb +11 -0
- data/test/unit/peddler/test_client.rb +1 -1
- data/test/unit/peddler/{test_csv_parser.rb → test_flat_file_parser.rb} +21 -3
- data/test/unit/peddler/test_xml_parser.rb +2 -2
- data/test/vcr_cassettes/FulfillmentInboundShipment.yml +369 -0
- data/test/vcr_cassettes/FulfillmentInventory.yml +369 -0
- data/test/vcr_cassettes/FulfillmentOutboundShipment.yml +370 -0
- data/test/vcr_cassettes/Reports.yml +6563 -0
- metadata +17 -5
- data/lib/peddler/csv_parser.rb +0 -42
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: peddler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hakan Ensari
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-04-
|
11
|
+
date: 2014-04-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jeff
|
@@ -160,7 +160,7 @@ files:
|
|
160
160
|
- lib/mws/subscriptions.rb
|
161
161
|
- lib/peddler.rb
|
162
162
|
- lib/peddler/client.rb
|
163
|
-
- lib/peddler/
|
163
|
+
- lib/peddler/flat_file_parser.rb
|
164
164
|
- lib/peddler/operation.rb
|
165
165
|
- lib/peddler/parser.rb
|
166
166
|
- lib/peddler/structured_list.rb
|
@@ -170,6 +170,9 @@ files:
|
|
170
170
|
- test/integration/test_cart_information.rb
|
171
171
|
- test/integration/test_customer_information.rb
|
172
172
|
- test/integration/test_feeds.rb
|
173
|
+
- test/integration/test_fulfillment_inbound_shipment.rb
|
174
|
+
- test/integration/test_fulfillment_inventory.rb
|
175
|
+
- test/integration/test_fulfillment_outbound_shipment.rb
|
173
176
|
- test/integration/test_off_amazon_payments.rb
|
174
177
|
- test/integration/test_orders.rb
|
175
178
|
- test/integration/test_products.rb
|
@@ -181,7 +184,7 @@ files:
|
|
181
184
|
- test/mws.yml
|
182
185
|
- test/mws.yml.example
|
183
186
|
- test/unit/peddler/test_client.rb
|
184
|
-
- test/unit/peddler/
|
187
|
+
- test/unit/peddler/test_flat_file_parser.rb
|
185
188
|
- test/unit/peddler/test_operation.rb
|
186
189
|
- test/unit/peddler/test_structured_list.rb
|
187
190
|
- test/unit/peddler/test_xml_parser.rb
|
@@ -189,6 +192,9 @@ files:
|
|
189
192
|
- test/vcr_cassettes/CartInformation.yml
|
190
193
|
- test/vcr_cassettes/CustomerInformation.yml
|
191
194
|
- test/vcr_cassettes/Feeds.yml
|
195
|
+
- test/vcr_cassettes/FulfillmentInboundShipment.yml
|
196
|
+
- test/vcr_cassettes/FulfillmentInventory.yml
|
197
|
+
- test/vcr_cassettes/FulfillmentOutboundShipment.yml
|
192
198
|
- test/vcr_cassettes/OffAmazonPayments.yml
|
193
199
|
- test/vcr_cassettes/Orders.yml
|
194
200
|
- test/vcr_cassettes/Products.yml
|
@@ -224,6 +230,9 @@ test_files:
|
|
224
230
|
- test/integration/test_cart_information.rb
|
225
231
|
- test/integration/test_customer_information.rb
|
226
232
|
- test/integration/test_feeds.rb
|
233
|
+
- test/integration/test_fulfillment_inbound_shipment.rb
|
234
|
+
- test/integration/test_fulfillment_inventory.rb
|
235
|
+
- test/integration/test_fulfillment_outbound_shipment.rb
|
227
236
|
- test/integration/test_off_amazon_payments.rb
|
228
237
|
- test/integration/test_orders.rb
|
229
238
|
- test/integration/test_products.rb
|
@@ -235,7 +244,7 @@ test_files:
|
|
235
244
|
- test/mws.yml
|
236
245
|
- test/mws.yml.example
|
237
246
|
- test/unit/peddler/test_client.rb
|
238
|
-
- test/unit/peddler/
|
247
|
+
- test/unit/peddler/test_flat_file_parser.rb
|
239
248
|
- test/unit/peddler/test_operation.rb
|
240
249
|
- test/unit/peddler/test_structured_list.rb
|
241
250
|
- test/unit/peddler/test_xml_parser.rb
|
@@ -243,6 +252,9 @@ test_files:
|
|
243
252
|
- test/vcr_cassettes/CartInformation.yml
|
244
253
|
- test/vcr_cassettes/CustomerInformation.yml
|
245
254
|
- test/vcr_cassettes/Feeds.yml
|
255
|
+
- test/vcr_cassettes/FulfillmentInboundShipment.yml
|
256
|
+
- test/vcr_cassettes/FulfillmentInventory.yml
|
257
|
+
- test/vcr_cassettes/FulfillmentOutboundShipment.yml
|
246
258
|
- test/vcr_cassettes/OffAmazonPayments.yml
|
247
259
|
- test/vcr_cassettes/Orders.yml
|
248
260
|
- test/vcr_cassettes/Products.yml
|
data/lib/peddler/csv_parser.rb
DELETED
@@ -1,42 +0,0 @@
|
|
1
|
-
require 'delegate'
|
2
|
-
require 'csv'
|
3
|
-
require 'digest/md5'
|
4
|
-
|
5
|
-
module Peddler
|
6
|
-
# @api private
|
7
|
-
class CSVParser < SimpleDelegator
|
8
|
-
attr :content, :summary
|
9
|
-
|
10
|
-
def initialize(res)
|
11
|
-
super(res)
|
12
|
-
split_body
|
13
|
-
end
|
14
|
-
|
15
|
-
def parse
|
16
|
-
# http://stackoverflow.com/questions/8073920/importing-csv-quoting-error-is-driving-me-nuts
|
17
|
-
CSV.parse(content, col_sep: "\t", quote_char: "\x00", headers: true) if content
|
18
|
-
end
|
19
|
-
|
20
|
-
def records_count
|
21
|
-
Hash[summary.split("\n\t")[1, 2].map { |line| line.split("\t\t") }]
|
22
|
-
end
|
23
|
-
|
24
|
-
def valid?
|
25
|
-
headers['Content-MD5'] == Digest::MD5.base64digest(body)
|
26
|
-
end
|
27
|
-
|
28
|
-
private
|
29
|
-
|
30
|
-
def split_body
|
31
|
-
@summary, @content = body.split("\n\n")
|
32
|
-
end
|
33
|
-
|
34
|
-
def scrub_content
|
35
|
-
content.force_encoding(encoding).encode('UTF-8')
|
36
|
-
end
|
37
|
-
|
38
|
-
def encoding
|
39
|
-
'ISO-8859-1'
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|