Class: OasCore::Spec::Responses
- Inherits:
-
Object
- Object
- OasCore::Spec::Responses
- Includes:
- Specable
- Defined in:
- lib/oas_core/spec/responses.rb
Instance Attribute Summary collapse
-
#responses ⇒ Object
Returns the value of attribute responses.
Instance Method Summary collapse
- #add_reference_response(code, reference) ⇒ Object
- #add_response(response) ⇒ Object
-
#initialize(specification) ⇒ Responses
constructor
A new instance of Responses.
- #to_spec ⇒ Object
Methods included from Specable
Constructor Details
#initialize(specification) ⇒ Responses
Returns a new instance of Responses.
9 10 11 12 |
# File 'lib/oas_core/spec/responses.rb', line 9 def initialize(specification) @specification = specification @responses = {} end |
Instance Attribute Details
#responses ⇒ Object
Returns the value of attribute responses.
7 8 9 |
# File 'lib/oas_core/spec/responses.rb', line 7 def responses @responses end |
Instance Method Details
#add_reference_response(code, reference) ⇒ Object
18 19 20 |
# File 'lib/oas_core/spec/responses.rb', line 18 def add_reference_response(code, reference) @responses[code] = reference end |
#add_response(response) ⇒ Object
14 15 16 |
# File 'lib/oas_core/spec/responses.rb', line 14 def add_response(response) @responses[response.code] = @specification.components.add_response(response) end |
#to_spec ⇒ Object
22 23 24 |
# File 'lib/oas_core/spec/responses.rb', line 22 def to_spec @responses.transform_values(&:to_spec) end |