Class: Treaty::Response::Validator
- Inherits:
-
Object
- Object
- Treaty::Response::Validator
- Defined in:
- lib/treaty/response/validator.rb
Overview
Validator for response data
Class Method Summary collapse
-
.validate!(version_factory:, response_data: {}) ⇒ Hash
Validates response data against the response definition.
Instance Method Summary collapse
-
#initialize(version_factory:, response_data: {}) ⇒ Validator
constructor
A new instance of Validator.
- #validate! ⇒ Object
Constructor Details
#initialize(version_factory:, response_data: {}) ⇒ Validator
Returns a new instance of Validator.
18 19 20 21 |
# File 'lib/treaty/response/validator.rb', line 18 def initialize(version_factory:, response_data: {}) @version_factory = version_factory @response_data = response_data end |
Class Method Details
.validate!(version_factory:, response_data: {}) ⇒ Hash
Validates response data against the response definition
13 14 15 |
# File 'lib/treaty/response/validator.rb', line 13 def validate!(version_factory:, response_data: {}) new(version_factory:, response_data:).validate! end |
Instance Method Details
#validate! ⇒ Object
23 24 25 |
# File 'lib/treaty/response/validator.rb', line 23 def validate! validate_response_attributes! end |