bigcommerce/bigcommerce-api-ruby — pull request #70 by mastfish (2013-12-23 04:56:23+00:00)
Title: Version 2.0 concept: Don't merge this, Request for comments only

For my feed-genie project, I've been working quite heavily with the API, and I needed it to be more powerful. I'm way too lazy to write out the code to do what I want by hand, so this one generates everything by discovering API capability. Hat tip to whoever added support for OPTIONS queries; it's absolutely crazy how easy you made it for me.

This is intended to spark discussion on the discovery approach - all code was extracted from my work on feed-genie. It's pretty barebones (only supporting 'all', and no custom headers), and I expect the extraction has broken it, but I thought it'd be good to get some feedback as early as possible, while it's still relatively malleable.

The killer functionality is that the resource classes now know what properties and filters they support, including type information. Should be possible to validate requests before sending them, expose nice finder methods, and so forth.

Additionally, it's built on EventMachine::HttpRequest, so asynchronous requests are trivial to add. Although that might be a bad thing, from the point of view of keeping our servers from melting.