Class: OasRails::Spec::Responses
- Inherits:
-
Object
- Object
- OasRails::Spec::Responses
- Includes:
- Specable
- Defined in:
- lib/oas_rails/spec/responses.rb
Instance Attribute Summary collapse
-
#responses ⇒ Object
Returns the value of attribute responses.
Instance Method Summary collapse
- #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.
7 8 9 10 |
# File 'lib/oas_rails/spec/responses.rb', line 7 def initialize(specification) @specification = specification @responses = {} end |
Instance Attribute Details
#responses ⇒ Object
Returns the value of attribute responses.
5 6 7 |
# File 'lib/oas_rails/spec/responses.rb', line 5 def responses @responses end |
Instance Method Details
#add_response(response) ⇒ Object
12 13 14 |
# File 'lib/oas_rails/spec/responses.rb', line 12 def add_response(response) @responses[response.code] = @specification.components.add_response(response) end |
#to_spec ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/oas_rails/spec/responses.rb', line 16 def to_spec spec = {} @responses.each do |key, value| spec[key] = value.to_spec end spec end |