Closed katylava closed 8 years ago
@katylava yeah, I'm kind of torn on the idea. On the one hand, shipit
should be as light-weight and transparent as possible, and if there's an activity that doesn't have an associated location, so be it, and shipit
should display it as-is. But on the other hand, we can think of a missing location as an error case and filter out such activities. I think I'm leaning towards incorporating your suggestion, and remove the location restriction (but obviously keep the timestamp and details restrictions). I'll open a pull request soon.
@sailrish Thanks! Personally I wouldn't consider it an error if location is missing, but if your users expect the key location
to be defined, you might consider setting it to null
or "Unknown"
. I've found "Arrived at FedEx location" is at times missing a location, but it's an important activity type because it gives you the time that FedEx actually scans the package. Until then the package is just a theory.
Btw, would you be able to provide me with an example tracking number that has a "Arrived at FedEx location" without a location, so I can setup a test for it?
Sure, here's one: https://www.fedex.com/apps/fedextrack/?tracknumbers=61299998245239562042
fixed in this pull request, and released as v0.8.0 here.
See output here:
{
"eta": "2015-12-12T23:59:59.000Z",
"service": "FedEx SmartPost",
"weight": "1.4 LB",
"destination": "Greenacres, WA",
"activities": [
{
"timestamp": "2015-12-09T02:00:46.000Z",
"location": "Kent, WA 98032",
"details": "Arrived at FedEx location"
},
{
"timestamp": "2015-12-08T22:06:47.000Z",
"location": "Troutdale, OR 97060",
"details": "Departed FedEx location"
},
{
"timestamp": "2015-12-08T17:33:00.000Z",
"location": "Troutdale, OR 97060",
"details": "Arrived at FedEx location"
},
{
"timestamp": "2015-12-04T15:03:00.000Z",
"details": "Arrived at FedEx location"
},
{
"timestamp": "2015-12-02T22:32:30.000Z",
"location": "US 75006",
"details": "Shipment information sent to FedEx"
}
],
"status": 2,
"request": {
"trackingNumber": "61299998245239562042"
}
}
Thanks so much! This will clear up some confusion at my workplace :)
I have a tracking number which I know has an activity for "Arrived at FedEx location", but I get this from my result's
activities
property:If I alter https://github.com/sailrish/shipit/blob/master/src/fedex.coffee#L107 to not check for location, I get what I expect: