ismasan/oat — pull request #48 by l8nite (2014-09-21 15:42:30+00:00)
Title: Feature/individual entity

I'm sure there is a nicer way to do this, but hopefully this gets oat moving in the right direction.
Adds support for individual resources at the top-level in JsonAPI without breaking existing behaviors.

The spec says:
> An individual resource SHOULD be represented as a single "resource object" (described below) or a string value containing its ID (also described below).

This change works by setting a flag in the serializer ('individual') that indicates you want a singular resource.

I originally modified the inflection rules as well (so if you specify 'individual' we don't try to pluralize the names), but then I decided against it and went back to pluralizing everywhere for consistency. You can see that moment of self-doubt in the commit history.

Note: it might be useful to _also_ include a flag to turn off pluralization for those few cases where a plural name makes no sense (like in this case, where I was writing /api/status)

Usage:
```
class Status < Oat::Serializer
adapter Oat::Adapters::JsonAPI
schema do
individual
type 'status'
map_properties *%i(at status)
end
end
```

Output:
```
{
"statuses": {
"at": "2014-09-21T08:24:12.807-07:00",
"status": "unknown"
}
}
```