Class: OasRails::Builders::ResponseBuilder
- Inherits:
-
Object
- Object
- OasRails::Builders::ResponseBuilder
- Defined in:
- lib/oas_rails/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.
4 5 6 7 |
# File 'lib/oas_rails/builders/response_builder.rb', line 4 def initialize(specification) @specification = specification @response = Spec::Response.new(specification) end |
Instance Method Details
#build ⇒ Object
35 36 37 |
# File 'lib/oas_rails/builders/response_builder.rb', line 35 def build @response end |
#from_tag(tag) ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/oas_rails/builders/response_builder.rb', line 27 def from_tag(tag) @response.code = tag.name.to_i @response.description = tag.text @response.content = ContentBuilder.new(@specification, :outgoing).with_schema(tag.schema).build self end |
#with_code(code) ⇒ Object
21 22 23 24 25 |
# File 'lib/oas_rails/builders/response_builder.rb', line 21 def with_code(code) @response.code = code self end |
#with_content(content) ⇒ Object
15 16 17 18 19 |
# File 'lib/oas_rails/builders/response_builder.rb', line 15 def with_content(content) @response.content = content self end |
#with_description(description) ⇒ Object
9 10 11 12 13 |
# File 'lib/oas_rails/builders/response_builder.rb', line 9 def with_description(description) @response.description = description self end |