Class: RequestHandler::JsonApiDocumentParser

Inherits:
SchemaParser show all
Defined in:
lib/request_handler/json_api_document_parser.rb

Constant Summary collapse

NON_ATTRIBUTE_MEMBERS =
%i[id type meta links].freeze

Instance Method Summary collapse

Constructor Details

#initialize(document:, schema:, schema_options: {}) ⇒ JsonApiDocumentParser

Returns a new instance of JsonApiDocumentParser.



9
10
11
12
13
# File 'lib/request_handler/json_api_document_parser.rb', line 9

def initialize(document:, schema:, schema_options: {})
  raise MissingArgumentError, "data": 'is missing' if document.nil?
  super(schema: schema, schema_options: schema_options)
  @document = document
end

Instance Method Details

#runObject



15
16
17
18
# File 'lib/request_handler/json_api_document_parser.rb', line 15

def run
  resource = flattened_document
  validate_schema(resource)
end