pseudocms/pseudocms-api — pull request #1 by pseudomuto (2014-06-08 23:48:10+00:00)
Title: Users API

Adding the initial version of the users api. This is mostly just basic CRUD stuff at this point.

# Routes

Method | URL | Description
----------|--------|------------
GET | `/user` | Gets the current user (token owner). This is only available to users and not applications
GET | `/users/:id` | Gets the specified user. Unless the token is owned by a blessed app, this will return a 403
GET | `/users` | Gets a list of users. Unless the token is owned by a blessed app, this will return a 403
POST | `/users` | Creates a new user. Unless the token is owned by a blessed app, this will return a 403
PATCH | `/users/:id` | Updates the specified user. Tokens owned by users can only update themselves
DELETE | `/users/:id` | Deletes the specified user. Unless the token is owned by a blessed app, this will return a 403

# Pagination

Pagination is done using [will_paginate](https://github.com/mislav/will_paginate) and first, prev, next and last links will be added to the `Link` header in the response as [outlined here](http://tools.ietf.org/html/rfc5988).

Of course you don't need to rely on knowing that, simply call `client.has_(first|prev|next|last)_page?` Assuming `has_first_page?` returns true, you can get it by calling `client.first_page.get` which will handle setting the pagination query parameters for you.

# VCR, WebMock and Pry

I've also set up VCR to handle remote testing. I fully intend to find a better way to load/use casettes, but for now each test names a cassette. WebMock was set up to avoid having any real calls being made by the test suite.

Pry...because reasons