after_ship 0.0.2 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/README.md +69 -32
- data/after_ship.gemspec +4 -4
- data/lib/after_ship/checkpoint.rb +35 -28
- data/lib/after_ship/core/attributes.rb +14 -0
- data/lib/after_ship/core/date_utils.rb +76 -0
- data/lib/after_ship/core/error.rb +29 -0
- data/lib/after_ship/core/error_handler.rb +67 -0
- data/lib/after_ship/core/request.rb +131 -0
- data/lib/after_ship/core/version.rb +4 -0
- data/lib/after_ship/courier.rb +45 -0
- data/lib/after_ship/tracking.rb +78 -6
- data/lib/after_ship.rb +158 -214
- data/spec/integration/after_ship_spec.rb +40 -0
- data/spec/request_stubs.rb +30 -97
- data/spec/requests/couriers.json +50 -0
- data/spec/requests/tracking/created.json +53 -0
- data/spec/requests/tracking/{delivered_ok.json → delivered.json} +79 -65
- data/spec/requests/trackings.json +654 -0
- data/spec/units/after_ship_spec.rb +104 -0
- data/spec/units/checkpoint_spec.rb +135 -0
- data/spec/units/courier_spec.rb +41 -0
- data/spec/{lib → units}/date_utils_spec.rb +17 -9
- data/spec/units/error_handler_spec.rb +168 -0
- data/spec/units/request_spec.rb +190 -0
- data/spec/units/tracking_spec.rb +276 -0
- metadata +39 -25
- data/lib/after_ship/version.rb +0 -3
- data/lib/attributes.rb +0 -12
- data/lib/date_utils.rb +0 -61
- data/spec/lib/after_ship_spec.rb +0 -137
- data/spec/lib/checkpoint_spec.rb +0 -139
- data/spec/lib/tracking_spec.rb +0 -89
- data/spec/requests/tracking/delivered_wild.json +0 -653
- data/spec/requests/tracking/in_transit.json +0 -443
@@ -1,443 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"meta": {
|
3
|
-
"code": 200
|
4
|
-
},
|
5
|
-
"data": {
|
6
|
-
"tracking": {
|
7
|
-
"created_at": "2014-07-22T05:11:40+00:00",
|
8
|
-
"updated_at": "2014-07-31T06:33:05+00:00",
|
9
|
-
"tracking_number": "9405903699300211343566",
|
10
|
-
"slug": "usps",
|
11
|
-
"active": true,
|
12
|
-
"custom_fields": {
|
13
|
-
},
|
14
|
-
"customer_name": null,
|
15
|
-
"destination_country_iso3": null,
|
16
|
-
"emails": [
|
17
|
-
|
18
|
-
],
|
19
|
-
"expected_delivery": "2014-07-02T00:00:00",
|
20
|
-
"order_id": null,
|
21
|
-
"order_id_path": null,
|
22
|
-
"origin_country_iso3": null,
|
23
|
-
"shipment_package_count": 1,
|
24
|
-
"shipment_type": "Priority Mail 2-Day™",
|
25
|
-
"signed_by": "",
|
26
|
-
"smses": [
|
27
|
-
|
28
|
-
],
|
29
|
-
"source": "web",
|
30
|
-
"tag": "InTransit",
|
31
|
-
"title": "9405903699300211343566",
|
32
|
-
"tracked_count": 97,
|
33
|
-
"unique_token": "-kqZ9ebYl",
|
34
|
-
"checkpoints": [
|
35
|
-
{
|
36
|
-
"slug": "usps",
|
37
|
-
"city": "",
|
38
|
-
"created_at": "2014-07-22T05:11:46+00:00",
|
39
|
-
"country_name": "",
|
40
|
-
"message": "Electronic Shipping Info Received",
|
41
|
-
"country_iso3": null,
|
42
|
-
"tag": "InfoReceived",
|
43
|
-
"checkpoint_time": "2014-06-29T00:00:01",
|
44
|
-
"coordinates": [
|
45
|
-
|
46
|
-
],
|
47
|
-
"state": "",
|
48
|
-
"zip": ""
|
49
|
-
},
|
50
|
-
{
|
51
|
-
"slug": "usps",
|
52
|
-
"city": "",
|
53
|
-
"created_at": "2014-07-28T09:52:59+00:00",
|
54
|
-
"country_name": "",
|
55
|
-
"message": "Pre-Shipment Info Sent to USPS",
|
56
|
-
"country_iso3": null,
|
57
|
-
"tag": "InTransit",
|
58
|
-
"checkpoint_time": "2014-06-29T00:00:01",
|
59
|
-
"coordinates": [
|
60
|
-
|
61
|
-
],
|
62
|
-
"state": "",
|
63
|
-
"zip": ""
|
64
|
-
},
|
65
|
-
{
|
66
|
-
"slug": "usps",
|
67
|
-
"city": "NORTH BRANCH",
|
68
|
-
"created_at": "2014-07-22T05:11:46+00:00",
|
69
|
-
"country_name": "",
|
70
|
-
"message": "Acceptance",
|
71
|
-
"country_iso3": null,
|
72
|
-
"tag": "InTransit",
|
73
|
-
"checkpoint_time": "2014-06-30T14:03:00",
|
74
|
-
"coordinates": [
|
75
|
-
|
76
|
-
],
|
77
|
-
"state": "MN",
|
78
|
-
"zip": "55056"
|
79
|
-
},
|
80
|
-
{
|
81
|
-
"slug": "usps",
|
82
|
-
"city": "NORTH BRANCH",
|
83
|
-
"created_at": "2014-07-28T09:52:59+00:00",
|
84
|
-
"country_name": "",
|
85
|
-
"message": "Departed Post Office",
|
86
|
-
"country_iso3": null,
|
87
|
-
"tag": "InTransit",
|
88
|
-
"checkpoint_time": "2014-06-30T16:35:00",
|
89
|
-
"coordinates": [
|
90
|
-
|
91
|
-
],
|
92
|
-
"state": "MN",
|
93
|
-
"zip": "55056"
|
94
|
-
},
|
95
|
-
{
|
96
|
-
"slug": "usps",
|
97
|
-
"city": "NORTH BRANCH",
|
98
|
-
"created_at": "2014-07-22T05:11:46+00:00",
|
99
|
-
"country_name": "",
|
100
|
-
"message": "Depart Post Office",
|
101
|
-
"country_iso3": null,
|
102
|
-
"tag": "InTransit",
|
103
|
-
"checkpoint_time": "2014-06-30T16:35:00",
|
104
|
-
"coordinates": [
|
105
|
-
|
106
|
-
],
|
107
|
-
"state": "MN",
|
108
|
-
"zip": "55056"
|
109
|
-
},
|
110
|
-
{
|
111
|
-
"slug": "usps",
|
112
|
-
"city": "SAINT PAUL",
|
113
|
-
"created_at": "2014-07-22T05:11:46+00:00",
|
114
|
-
"country_name": "",
|
115
|
-
"message": "Processed at USPS Origin Sort Facility",
|
116
|
-
"country_iso3": null,
|
117
|
-
"tag": "InTransit",
|
118
|
-
"checkpoint_time": "2014-06-30T20:20:00",
|
119
|
-
"coordinates": [
|
120
|
-
|
121
|
-
],
|
122
|
-
"state": "MN",
|
123
|
-
"zip": "55121"
|
124
|
-
},
|
125
|
-
{
|
126
|
-
"slug": "usps",
|
127
|
-
"city": "SAINT PAUL",
|
128
|
-
"created_at": "2014-07-28T09:52:59+00:00",
|
129
|
-
"country_name": "",
|
130
|
-
"message": "Arrived at USPS Origin Facility",
|
131
|
-
"country_iso3": null,
|
132
|
-
"tag": "InTransit",
|
133
|
-
"checkpoint_time": "2014-06-30T20:20:00",
|
134
|
-
"coordinates": [
|
135
|
-
|
136
|
-
],
|
137
|
-
"state": "MN",
|
138
|
-
"zip": "55121"
|
139
|
-
},
|
140
|
-
{
|
141
|
-
"slug": "usps",
|
142
|
-
"city": "SAINT PAUL",
|
143
|
-
"created_at": "2014-07-22T05:11:46+00:00",
|
144
|
-
"country_name": "",
|
145
|
-
"message": "Depart USPS Sort Facility",
|
146
|
-
"country_iso3": null,
|
147
|
-
"tag": "InTransit",
|
148
|
-
"checkpoint_time": "2014-07-01T01:25:00",
|
149
|
-
"coordinates": [
|
150
|
-
|
151
|
-
],
|
152
|
-
"state": "MN",
|
153
|
-
"zip": "55121"
|
154
|
-
},
|
155
|
-
{
|
156
|
-
"slug": "usps",
|
157
|
-
"city": "SAINT PAUL",
|
158
|
-
"created_at": "2014-07-28T09:52:59+00:00",
|
159
|
-
"country_name": "",
|
160
|
-
"message": "Departed USPS Facility",
|
161
|
-
"country_iso3": null,
|
162
|
-
"tag": "InTransit",
|
163
|
-
"checkpoint_time": "2014-07-01T01:25:00",
|
164
|
-
"coordinates": [
|
165
|
-
|
166
|
-
],
|
167
|
-
"state": "MN",
|
168
|
-
"zip": "55121"
|
169
|
-
},
|
170
|
-
{
|
171
|
-
"slug": "usps",
|
172
|
-
"city": "BETHPAGE",
|
173
|
-
"created_at": "2014-07-22T05:11:46+00:00",
|
174
|
-
"country_name": "",
|
175
|
-
"message": "Processed through USPS Sort Facility",
|
176
|
-
"country_iso3": null,
|
177
|
-
"tag": "InTransit",
|
178
|
-
"checkpoint_time": "2014-07-02T02:04:00",
|
179
|
-
"coordinates": [
|
180
|
-
|
181
|
-
],
|
182
|
-
"state": "NY",
|
183
|
-
"zip": "11714"
|
184
|
-
},
|
185
|
-
{
|
186
|
-
"slug": "usps",
|
187
|
-
"city": "BETHPAGE",
|
188
|
-
"created_at": "2014-07-28T09:52:59+00:00",
|
189
|
-
"country_name": "",
|
190
|
-
"message": "Arrived at USPS Facility",
|
191
|
-
"country_iso3": null,
|
192
|
-
"tag": "InTransit",
|
193
|
-
"checkpoint_time": "2014-07-02T02:04:00",
|
194
|
-
"coordinates": [
|
195
|
-
|
196
|
-
],
|
197
|
-
"state": "NY",
|
198
|
-
"zip": "11714"
|
199
|
-
},
|
200
|
-
{
|
201
|
-
"slug": "usps",
|
202
|
-
"city": "BETHPAGE",
|
203
|
-
"created_at": "2014-07-22T05:11:46+00:00",
|
204
|
-
"country_name": "",
|
205
|
-
"message": "Depart USPS Sort Facility",
|
206
|
-
"country_iso3": null,
|
207
|
-
"tag": "InTransit",
|
208
|
-
"checkpoint_time": "2014-07-02T04:03:00",
|
209
|
-
"coordinates": [
|
210
|
-
|
211
|
-
],
|
212
|
-
"state": "NY",
|
213
|
-
"zip": "11714"
|
214
|
-
},
|
215
|
-
{
|
216
|
-
"slug": "usps",
|
217
|
-
"city": "BETHPAGE",
|
218
|
-
"created_at": "2014-07-28T09:52:59+00:00",
|
219
|
-
"country_name": "",
|
220
|
-
"message": "Departed USPS Facility",
|
221
|
-
"country_iso3": null,
|
222
|
-
"tag": "InTransit",
|
223
|
-
"checkpoint_time": "2014-07-02T04:03:00",
|
224
|
-
"coordinates": [
|
225
|
-
|
226
|
-
],
|
227
|
-
"state": "NY",
|
228
|
-
"zip": "11714"
|
229
|
-
},
|
230
|
-
{
|
231
|
-
"slug": "usps",
|
232
|
-
"city": "BRONX",
|
233
|
-
"created_at": "2014-07-28T09:52:59+00:00",
|
234
|
-
"country_name": "",
|
235
|
-
"message": "Arrived at Post Office",
|
236
|
-
"country_iso3": null,
|
237
|
-
"tag": "InTransit",
|
238
|
-
"checkpoint_time": "2014-07-02T07:28:00",
|
239
|
-
"coordinates": [
|
240
|
-
|
241
|
-
],
|
242
|
-
"state": "NY",
|
243
|
-
"zip": "10461"
|
244
|
-
},
|
245
|
-
{
|
246
|
-
"slug": "usps",
|
247
|
-
"city": "BRONX",
|
248
|
-
"created_at": "2014-07-22T05:11:46+00:00",
|
249
|
-
"country_name": "",
|
250
|
-
"message": "Arrival at Post Office",
|
251
|
-
"country_iso3": null,
|
252
|
-
"tag": "InTransit",
|
253
|
-
"checkpoint_time": "2014-07-02T07:28:00",
|
254
|
-
"coordinates": [
|
255
|
-
|
256
|
-
],
|
257
|
-
"state": "NY",
|
258
|
-
"zip": "10461"
|
259
|
-
},
|
260
|
-
{
|
261
|
-
"slug": "usps",
|
262
|
-
"city": "BRONX",
|
263
|
-
"created_at": "2014-07-22T05:11:46+00:00",
|
264
|
-
"country_name": "",
|
265
|
-
"message": "Sorting Complete",
|
266
|
-
"country_iso3": null,
|
267
|
-
"tag": "InTransit",
|
268
|
-
"checkpoint_time": "2014-07-02T07:53:00",
|
269
|
-
"coordinates": [
|
270
|
-
|
271
|
-
],
|
272
|
-
"state": "NY",
|
273
|
-
"zip": "10461"
|
274
|
-
},
|
275
|
-
{
|
276
|
-
"slug": "usps",
|
277
|
-
"city": "BRONX",
|
278
|
-
"created_at": "2014-07-22T05:11:46+00:00",
|
279
|
-
"country_name": "",
|
280
|
-
"message": "Out for Delivery",
|
281
|
-
"country_iso3": null,
|
282
|
-
"tag": "OutForDelivery",
|
283
|
-
"checkpoint_time": "2014-07-02T08:03:00",
|
284
|
-
"coordinates": [
|
285
|
-
|
286
|
-
],
|
287
|
-
"state": "NY",
|
288
|
-
"zip": "10461"
|
289
|
-
},
|
290
|
-
{
|
291
|
-
"slug": "usps",
|
292
|
-
"city": "BRONX",
|
293
|
-
"created_at": "2014-07-22T05:11:46+00:00",
|
294
|
-
"country_name": "",
|
295
|
-
"message": "Notice Left (No Authorized Recipient Available)",
|
296
|
-
"country_iso3": null,
|
297
|
-
"tag": "AttemptFail",
|
298
|
-
"checkpoint_time": "2014-07-02T16:21:00",
|
299
|
-
"coordinates": [
|
300
|
-
|
301
|
-
],
|
302
|
-
"state": "NY",
|
303
|
-
"zip": "10461"
|
304
|
-
},
|
305
|
-
{
|
306
|
-
"slug": "usps",
|
307
|
-
"city": "BRONX",
|
308
|
-
"created_at": "2014-07-22T05:11:46+00:00",
|
309
|
-
"country_name": "",
|
310
|
-
"message": "Available for Pickup",
|
311
|
-
"country_iso3": null,
|
312
|
-
"tag": "InTransit",
|
313
|
-
"checkpoint_time": "2014-07-02T18:31:00",
|
314
|
-
"coordinates": [
|
315
|
-
|
316
|
-
],
|
317
|
-
"state": "NY",
|
318
|
-
"zip": "10461"
|
319
|
-
},
|
320
|
-
{
|
321
|
-
"slug": "usps",
|
322
|
-
"city": "BRONX",
|
323
|
-
"created_at": "2014-07-22T05:11:46+00:00",
|
324
|
-
"country_name": "",
|
325
|
-
"message": "Unclaimed",
|
326
|
-
"country_iso3": null,
|
327
|
-
"tag": "Exception",
|
328
|
-
"checkpoint_time": "2014-07-19T09:26:00",
|
329
|
-
"coordinates": [
|
330
|
-
|
331
|
-
],
|
332
|
-
"state": "NY",
|
333
|
-
"zip": "10461"
|
334
|
-
},
|
335
|
-
{
|
336
|
-
"slug": "usps",
|
337
|
-
"city": "KEARNY",
|
338
|
-
"created_at": "2014-07-28T09:52:59+00:00",
|
339
|
-
"country_name": "",
|
340
|
-
"message": "Arrived at USPS Facility",
|
341
|
-
"country_iso3": null,
|
342
|
-
"tag": "InTransit",
|
343
|
-
"checkpoint_time": "2014-07-23T08:11:00",
|
344
|
-
"coordinates": [
|
345
|
-
|
346
|
-
],
|
347
|
-
"state": "NJ",
|
348
|
-
"zip": "07032"
|
349
|
-
},
|
350
|
-
{
|
351
|
-
"slug": "usps",
|
352
|
-
"city": "KEARNY",
|
353
|
-
"created_at": "2014-07-23T12:40:21+00:00",
|
354
|
-
"country_name": "",
|
355
|
-
"message": "Processed through USPS Sort Facility",
|
356
|
-
"country_iso3": null,
|
357
|
-
"tag": "InTransit",
|
358
|
-
"checkpoint_time": "2014-07-23T08:16:00",
|
359
|
-
"coordinates": [
|
360
|
-
|
361
|
-
],
|
362
|
-
"state": "NJ",
|
363
|
-
"zip": "07032"
|
364
|
-
},
|
365
|
-
{
|
366
|
-
"slug": "usps",
|
367
|
-
"city": "KEARNY",
|
368
|
-
"created_at": "2014-07-23T16:56:25+00:00",
|
369
|
-
"country_name": "",
|
370
|
-
"message": "Processed through USPS Sort Facility",
|
371
|
-
"country_iso3": null,
|
372
|
-
"tag": "InTransit",
|
373
|
-
"checkpoint_time": "2014-07-23T12:18:00",
|
374
|
-
"coordinates": [
|
375
|
-
|
376
|
-
],
|
377
|
-
"state": "NJ",
|
378
|
-
"zip": "07032"
|
379
|
-
},
|
380
|
-
{
|
381
|
-
"slug": "usps",
|
382
|
-
"city": "KEARNY",
|
383
|
-
"created_at": "2014-07-28T09:52:59+00:00",
|
384
|
-
"country_name": "",
|
385
|
-
"message": "Departed USPS Facility",
|
386
|
-
"country_iso3": null,
|
387
|
-
"tag": "InTransit",
|
388
|
-
"checkpoint_time": "2014-07-23T12:18:00",
|
389
|
-
"coordinates": [
|
390
|
-
|
391
|
-
],
|
392
|
-
"state": "NJ",
|
393
|
-
"zip": "07032"
|
394
|
-
},
|
395
|
-
{
|
396
|
-
"slug": "usps",
|
397
|
-
"city": "BETHPAGE",
|
398
|
-
"created_at": "2014-07-28T09:52:59+00:00",
|
399
|
-
"country_name": "",
|
400
|
-
"message": "Arrived at USPS Facility",
|
401
|
-
"country_iso3": null,
|
402
|
-
"tag": "InTransit",
|
403
|
-
"checkpoint_time": "2014-07-23T17:29:00",
|
404
|
-
"coordinates": [
|
405
|
-
|
406
|
-
],
|
407
|
-
"state": "NY",
|
408
|
-
"zip": "11714"
|
409
|
-
},
|
410
|
-
{
|
411
|
-
"slug": "usps",
|
412
|
-
"city": "BETHPAGE",
|
413
|
-
"created_at": "2014-07-23T21:40:24+00:00",
|
414
|
-
"country_name": "",
|
415
|
-
"message": "Processed through USPS Sort Facility",
|
416
|
-
"country_iso3": null,
|
417
|
-
"tag": "InTransit",
|
418
|
-
"checkpoint_time": "2014-07-23T17:30:00",
|
419
|
-
"coordinates": [
|
420
|
-
|
421
|
-
],
|
422
|
-
"state": "NY",
|
423
|
-
"zip": "11714"
|
424
|
-
},
|
425
|
-
{
|
426
|
-
"slug": "usps",
|
427
|
-
"city": "BETHPAGE",
|
428
|
-
"created_at": "2014-07-28T09:52:59+00:00",
|
429
|
-
"country_name": "",
|
430
|
-
"message": "Departed USPS Facility",
|
431
|
-
"country_iso3": null,
|
432
|
-
"tag": "InTransit",
|
433
|
-
"checkpoint_time": "2014-07-23T17:30:00",
|
434
|
-
"coordinates": [
|
435
|
-
|
436
|
-
],
|
437
|
-
"state": "NY",
|
438
|
-
"zip": "11714"
|
439
|
-
}
|
440
|
-
]
|
441
|
-
}
|
442
|
-
}
|
443
|
-
}
|