Class: RequestHandler::JsonApiDocumentParser
- Inherits:
-
SchemaParser
- Object
- SchemaParser
- RequestHandler::JsonApiDocumentParser
- Defined in:
- lib/request_handler/json_api_document_parser.rb
Constant Summary collapse
- NON_ATTRIBUTE_MEMBERS =
i[id type links].freeze
- VALID_DATA_MEMBERS =
%w[id type attributes relationships links meta].freeze
Instance Method Summary collapse
-
#initialize(document:, schema:, schema_options: {}) ⇒ JsonApiDocumentParser
constructor
A new instance of JsonApiDocumentParser.
- #run ⇒ Object
Constructor Details
#initialize(document:, schema:, schema_options: {}) ⇒ JsonApiDocumentParser
Returns a new instance of JsonApiDocumentParser.
11 12 13 14 15 16 |
# File 'lib/request_handler/json_api_document_parser.rb', line 11 def initialize(document:, schema:, schema_options: {}) raise MissingArgumentError.new(data: "is missing") if document.nil? super(schema: schema, schema_options: ) @document = document end |
Instance Method Details
#run ⇒ Object
18 19 20 21 |
# File 'lib/request_handler/json_api_document_parser.rb', line 18 def run resource = flattened_document validate_schema(resource) end |