Skip to content

[WIP] Add package tracking history from postur.is #348

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 8 commits into from

Conversation

koddsson
Copy link
Member

@koddsson koddsson commented Oct 30, 2016

New endpoint to track package coming to Iceland, using postur.is as a datasource.

Checklist

  • Write tests
  • Write documentation
  • Handle 404
  • Handle incorrect formatted tracking number.
  • Add package metadata

@koddsson
Copy link
Member Author

I'm not gonna add the package metadata or write documentation in this PR.

@MiniGod
Copy link
Member

MiniGod commented Nov 1, 2016

LGTM

@koddsson koddsson closed this Oct 12, 2017
@koddsson koddsson reopened this Oct 12, 2017
@koddsson
Copy link
Member Author

Need to merge #376 before this codeship test will pass.

@koddsson koddsson changed the title Add package tracking history from postur.is [WIP] Add package tracking history from postur.is Oct 13, 2017

describe('tracking', () => {
it('should return a 404 when the tracking number can\'t be found', (done) => {
request.get('http://localhost:3101/tracking/derp', (error, response) => {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: Mock the test

import assert from 'assert'

describe('tracking', () => {
it('should return a 404 when the tracking number can\'t be found', (done) => {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: Add a test for when tracking actually works

import cheerio from 'cheerio'
import app from '../../server'

app.get('/tracking/:trackingNumber', (req, res) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is /tracking maybe too general?

return res.status(404).json({})
}

return res.json({
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cache it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering how long tho. Presumably people would want to know the status of their package right now? Maybe a cache of a minute would help if we are getting bombarded with requests tho?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd say any caching is good. 1 minute sounds good. We can always tweak it later if we feel the need.

@koddsson
Copy link
Member Author

I had a bunch of issues running the tests for this. Waiting on #380 to land so I can run the test in isolation and have speedier debugging. There might be more PRs in the meantime to get this even better.

@koddsson koddsson force-pushed the add-postur-tracking branch from 4a5296b to ab4fed1 Compare October 29, 2017 18:29
@koddsson
Copy link
Member Author

This and basically any new endpoint needs a better way on how to mock the data sources and not mock the localhost. I'm working on it now and hopefully it won't take a bunch of time.

@koddsson
Copy link
Member Author

This and basically any new endpoint needs a better way on how to mock the data sources and not mock the localhost. I'm working on it now and hopefully it won't take a bunch of time.

I've started this in #403.

@koddsson koddsson force-pushed the add-postur-tracking branch from ab4fed1 to e519903 Compare November 7, 2017 11:23
@koddsson
Copy link
Member Author

koddsson commented Nov 7, 2017

It seeeeems like postur.is is now a client side thing and thus you can just get the data from this handy URL https://www.postur.is/Umbraco/Surface/PackageTrackerApi/Handle -d "number=TRACKING_NUMBER&lang=IS"

That kind of makes this endpoint hard to develop and useless! 😸

@koddsson koddsson closed this Nov 7, 2017
@koddsson koddsson deleted the add-postur-tracking branch November 7, 2017 11:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants