openstax/accounts — pull request #13 by jpslav (2014-03-01 02:38:30+00:00)
Title: API docs, infrastructure, an endpoint with tests, lots of supporting updates

* Updates openstax_utilities (new code) and lev (patch)
* Upgrades to Bootstrap 3 and pulls in a bunch of CSS changes to accommodate that
* Adds developer and admin console (dialog boxes accessible through links in the upper left hand corner, dev console link available in development mode, admin console link available when logged in as administrator), not that most of the functionality in the consoles is not yet active -- next PR.
* Adds API infrastructure, including Roar and Representable infrastructure so that we can write simple JSON I/O representations of our resources
* Adds API documentation via Apipie, along with code to convert Representers into formatted JSON schemas. API documentation is available from the links tab in the dev console (or just go to `/api`).
* Improves API exception handling, logging the exception, and sending emails about serious ones (500 type), though NOTE THAT some configuration might be missing (of the ExceptionNotification gem)
* More or less deprecates the `KeyBasedApiController` in favor of doing all authentication via the `OauthBasedApiController`. OAuth can do something akin to simple API key transactions via the "client credentials flow", and I think it'll be easier to just have one category of API authentication.
* To this end, API code now gets an `ApiUser` in response to calls to `current_user`. `ApiUser` contains a human user (a `User`) and a `Doorkeeper::Application`, the former of which may be nil in the case of app-to-app communication.
* Added our first API call, which is a GET of a User object. Also added tests for it :-). Uses a UserRepresenter.
* Added an `api_request` support method for specs (along with convenience methods like `api_get`) that given a Doorkeeper token (for which there is factory) will handle all the OAuth business as well handling selection of the API version in the request header (see the API documentation for this). This latter version selection is based on `:version => :v1` metadata in the spec `describe` call.
* Added `full_name` to the Users table.
* Added "access policies". See the README in `app/access_policies`.