Class: RequestHandler::JsonParser

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of JsonParser.



7
8
9
10
11
# File 'lib/request_handler/json_parser.rb', line 7

def initialize(document:, schema:, schema_options: {})
  raise MissingArgumentError, "json": 'no content sent in document' if document.nil?
  super(schema: schema, schema_options: schema_options)
  @document = document
end

Instance Attribute Details

#documentObject (readonly)

Returns the value of attribute document.



17
18
19
# File 'lib/request_handler/json_parser.rb', line 17

def document
  @document
end

Instance Method Details

#runObject



13
14
15
# File 'lib/request_handler/json_parser.rb', line 13

def run
  validate_schema(document)
end