Class: OasCore::Builders::ResponseBuilder
- Inherits:
-
Object
- Object
- OasCore::Builders::ResponseBuilder
- Defined in:
- lib/oas_core/builders/response_builder.rb
Instance Method Summary collapse
- #build ⇒ Object
- #from_tag(tag) ⇒ Object
-
#initialize(specification) ⇒ ResponseBuilder
constructor
A new instance of ResponseBuilder.
- #with_code(code) ⇒ Object
- #with_content(content) ⇒ Object
- #with_description(description) ⇒ Object
Constructor Details
#initialize(specification) ⇒ ResponseBuilder
Returns a new instance of ResponseBuilder.
6 7 8 9 |
# File 'lib/oas_core/builders/response_builder.rb', line 6 def initialize(specification) @specification = specification @response = Spec::Response.new(specification) end |
Instance Method Details
#build ⇒ Object
37 38 39 |
# File 'lib/oas_core/builders/response_builder.rb', line 37 def build @response end |
#from_tag(tag) ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/oas_core/builders/response_builder.rb', line 29 def from_tag(tag) @response.code = tag.code.to_i @response.description = tag.text @response.content = ContentBuilder.new(@specification).with_schema(tag.content).build self end |
#with_code(code) ⇒ Object
23 24 25 26 27 |
# File 'lib/oas_core/builders/response_builder.rb', line 23 def with_code(code) @response.code = code self end |
#with_content(content) ⇒ Object
17 18 19 20 21 |
# File 'lib/oas_core/builders/response_builder.rb', line 17 def with_content(content) @response.content = content self end |
#with_description(description) ⇒ Object
11 12 13 14 15 |
# File 'lib/oas_core/builders/response_builder.rb', line 11 def with_description(description) @response.description = description self end |