Class: HttpStub::Server::Stub::Match::Rule::JsonSchemaBody
- Inherits:
-
Object
- Object
- HttpStub::Server::Stub::Match::Rule::JsonSchemaBody
- Defined in:
- lib/http_stub/server/stub/match/rule/json_schema_body.rb
Instance Method Summary collapse
-
#initialize(schema_definition) ⇒ JsonSchemaBody
constructor
A new instance of JsonSchemaBody.
- #matches?(request, logger) ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(schema_definition) ⇒ JsonSchemaBody
Returns a new instance of JsonSchemaBody.
9 10 11 |
# File 'lib/http_stub/server/stub/match/rule/json_schema_body.rb', line 9 def initialize(schema_definition) @schema_definition = schema_definition end |
Instance Method Details
#matches?(request, logger) ⇒ Boolean
13 14 15 16 17 |
# File 'lib/http_stub/server/stub/match/rule/json_schema_body.rb', line 13 def matches?(request, logger) validate_against_schema(request).tap do |errors| errors.each { |error| logger.info(error) } end.empty? end |
#to_s ⇒ Object
19 20 21 |
# File 'lib/http_stub/server/stub/match/rule/json_schema_body.rb', line 19 def to_s @schema_definition.to_json end |