Class: JSONAPI::Parser::Relationship
- Inherits:
-
Object
- Object
- JSONAPI::Parser::Relationship
- Defined in:
- lib/jsonapi/parser/relationship.rb
Class Method Summary collapse
-
.parse!(document) ⇒ Object
Validate the structure of a relationship update payload.
Class Method Details
.parse!(document) ⇒ Object
Validate the structure of a relationship update payload.
10 11 12 13 14 15 16 17 18 |
# File 'lib/jsonapi/parser/relationship.rb', line 10 def self.parse!(document) Document.ensure!(document.is_a?(Hash), 'A JSON object MUST be at the root of every JSONAPI ' \ 'request and response containing data.') Document.ensure!(document.keys == ['data'].freeze, 'A relationship update payload must contain primary ' \ 'data.') Document.parse_relationship_data!(document['data']) end |