class Graphiti::Deserializer

Responsible for parsing incoming write payloads

Given a PUT payload like:

{
  data: {
    id: '1',
    type: 'posts',
    attributes: { title: 'My Title' },
    relationships: {
      author: {
        data: {
          id: '1',
          type: 'authors'
        }
      }
    }
  },
  included: [
    {
      id: '1'
      type: 'authors',
      attributes: { name: 'Joe Author' }
    }
  ]
}

You can now easily deal with this payload:

deserializer.attributes
# => { id: '1', title: 'My Title' }
deserializer.meta
# => { type: 'posts', method: :update }
deserializer.relationships
# {
#   author: {
#     meta: { ... },
#     attributes: { ... },
#     relationships: { ... }
#   }
# }

When creating objects, we accept a temp-id so that the client can track the object it just created. Expect this in meta:

{ type: 'authors', method: :create, temp_id: 'abc123' }