Class: RailsAutodoc::DSL::ControllerExtensions::AnnotationBuilder
- Inherits:
-
Object
- Object
- RailsAutodoc::DSL::ControllerExtensions::AnnotationBuilder
- Defined in:
- lib/rails_autodoc/dsl/controller_extensions.rb
Instance Method Summary collapse
- #body_param(name, type, options = {}) ⇒ Object
- #deprecated(value = true) ⇒ Object
- #description(text) ⇒ Object
- #exclude(value = true) ⇒ Object
-
#initialize(annotation) ⇒ AnnotationBuilder
constructor
A new instance of AnnotationBuilder.
- #query_param(name, type, options = {}) ⇒ Object
- #request_body(schema) ⇒ Object
- #response(status, options = {}) ⇒ Object
- #security(scheme) ⇒ Object
- #summary(text) ⇒ Object
- #tag(*tags) ⇒ Object
Constructor Details
#initialize(annotation) ⇒ AnnotationBuilder
Returns a new instance of AnnotationBuilder.
15 16 17 |
# File 'lib/rails_autodoc/dsl/controller_extensions.rb', line 15 def initialize(annotation) @annotation = annotation end |
Instance Method Details
#body_param(name, type, options = {}) ⇒ Object
39 40 41 |
# File 'lib/rails_autodoc/dsl/controller_extensions.rb', line 39 def body_param(name, type, = {}) @annotation.body_params << { name: name.to_s, type: type.to_s }.merge() end |
#deprecated(value = true) ⇒ Object
31 32 33 |
# File 'lib/rails_autodoc/dsl/controller_extensions.rb', line 31 def deprecated(value = true) @annotation.deprecated = value end |
#description(text) ⇒ Object
23 24 25 |
# File 'lib/rails_autodoc/dsl/controller_extensions.rb', line 23 def description(text) @annotation.description = text end |
#exclude(value = true) ⇒ Object
35 36 37 |
# File 'lib/rails_autodoc/dsl/controller_extensions.rb', line 35 def exclude(value = true) @annotation.exclude = value end |
#query_param(name, type, options = {}) ⇒ Object
43 44 45 46 47 48 49 |
# File 'lib/rails_autodoc/dsl/controller_extensions.rb', line 43 def query_param(name, type, = {}) @annotation.query_params << { name: name.to_s, type: type.to_s, required: .fetch(:required, false) }.merge() end |
#request_body(schema) ⇒ Object
59 60 61 |
# File 'lib/rails_autodoc/dsl/controller_extensions.rb', line 59 def request_body(schema) @annotation.request_body_schema = schema end |
#response(status, options = {}) ⇒ Object
51 52 53 |
# File 'lib/rails_autodoc/dsl/controller_extensions.rb', line 51 def response(status, = {}) @annotation.responses[status.to_s] = end |
#security(scheme) ⇒ Object
55 56 57 |
# File 'lib/rails_autodoc/dsl/controller_extensions.rb', line 55 def security(scheme) @annotation.security = scheme end |
#summary(text) ⇒ Object
19 20 21 |
# File 'lib/rails_autodoc/dsl/controller_extensions.rb', line 19 def summary(text) @annotation.summary = text end |
#tag(*tags) ⇒ Object
27 28 29 |
# File 'lib/rails_autodoc/dsl/controller_extensions.rb', line 27 def tag(*) @annotation..concat(.map(&:to_s)) end |