Pact Coffee ASAP Button

I'm a long time subscriber to Pact Coffee (referral link), it's awesome and very reasonably priced.

It has a great feature where you estimate the number of coffees you drink per week so that they can send you your next bag just in time before your previous bag runs out.

Though, some weeks can be tougher than others and you suddenly find yourself quickly running out! 😵

No problem, you can just login to their website and click a button that says "Ship today", but by the time you have made you coffee, ate a biscuit, read an email and got back to your desk, you forget 😰 At least, this is what happens to me.

This week has been all about writing proposals, so I thought I'd take a break and write a simple one button iOS app that would change my order to "Ship today".

Pact do not have an API so I figured I'd have to just scrape their site. I threw together a small Rails app that would act as the API for the client. At first, I tried to use Mechanize though I then realised the Pact site is written in React (at least I think). Mechanize doesn't work with Javascript. To get around this I ended up using Capybara and PhantomJS. I built two endpoints: "auth" and "ship today".

The iOS app is super simple. It just implements the two API endpoints, stores the email and password in the keychain and I threw 1Password in there because every app should have 1Password integration.

Since I've built this hacked together API, it would be great to connect some sort of IOT button to it.