Class: OpenapiFirst::ValidatedResponse
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- OpenapiFirst::ValidatedResponse
- Extended by:
- Forwardable
- Defined in:
- lib/openapi_first/validated_response.rb
Overview
A validated response. It can be valid or not.
Instance Attribute Summary collapse
-
#error ⇒ Object
readonly
Returns the value of attribute error.
-
#parsed_values ⇒ Object
readonly
Returns the value of attribute parsed_values.
-
#response_definition ⇒ Object
readonly
Returns the value of attribute response_definition.
Instance Method Summary collapse
-
#initialize(original_response, error:, parsed_values: nil, response_definition: nil) ⇒ ValidatedResponse
constructor
A new instance of ValidatedResponse.
- #invalid? ⇒ Boolean
-
#valid? ⇒ Boolean
Checks if the response is valid.
Constructor Details
#initialize(original_response, error:, parsed_values: nil, response_definition: nil) ⇒ ValidatedResponse
Returns a new instance of ValidatedResponse.
11 12 13 14 15 16 |
# File 'lib/openapi_first/validated_response.rb', line 11 def initialize(original_response, error:, parsed_values: nil, response_definition: nil) super(original_response) @error = error @parsed_values = parsed_values @response_definition = response_definition end |
Instance Attribute Details
#error ⇒ Object (readonly)
Returns the value of attribute error.
18 19 20 |
# File 'lib/openapi_first/validated_response.rb', line 18 def error @error end |
#parsed_values ⇒ Object (readonly)
Returns the value of attribute parsed_values.
18 19 20 |
# File 'lib/openapi_first/validated_response.rb', line 18 def parsed_values @parsed_values end |
#response_definition ⇒ Object (readonly)
Returns the value of attribute response_definition.
18 19 20 |
# File 'lib/openapi_first/validated_response.rb', line 18 def response_definition @response_definition end |
Instance Method Details
#invalid? ⇒ Boolean
29 30 31 |
# File 'lib/openapi_first/validated_response.rb', line 29 def invalid? !valid? end |
#valid? ⇒ Boolean
Checks if the response is valid.
25 26 27 |
# File 'lib/openapi_first/validated_response.rb', line 25 def valid? error.nil? end |