proposing a refactor, better error handling, and initialisation changes

Hi

Building on your fine work so far, I've done a refactor of the API objects, changed the way initialisation is performed to be a touch more deployment-friendly, added helper methods for Pin.js users, and added an exception that's thrown when the API returns errors.

This is working well in my own app right now. Let me know what you think! (The next thing on my mind is some tests.)

All the best
Josh