class WeakSwaggerParameters::Definitions::Response
Public Class Methods
new(status_code, description, &block)
click to toggle source
# File lib/weak_swagger_parameters/definitions/response.rb, line 6 def initialize(status_code, description, &block) @status_code = status_code @description = description @content_schema = nil instance_eval(&block) if block.present? end
Public Instance Methods
apply_docs(parent_node)
click to toggle source
# File lib/weak_swagger_parameters/definitions/response.rb, line 26 def apply_docs(parent_node) status_code = @status_code response_options = { description: @description } content_schema = @content_schema parent_node.instance_eval do response status_code, response_options do response_node = self content_schema.apply_docs(response_node) if content_schema.present? end end end
collection(model_class)
click to toggle source
# File lib/weak_swagger_parameters/definitions/response.rb, line 22 def collection(model_class) @content_schema = WeakSwaggerParameters::Definitions::CollectionRef.new(model_class) end
hash(&block)
click to toggle source
# File lib/weak_swagger_parameters/definitions/response.rb, line 14 def hash(&block) @content_schema = WeakSwaggerParameters::Definitions::HashRef.new(&block) end
model(model_class)
click to toggle source
# File lib/weak_swagger_parameters/definitions/response.rb, line 18 def model(model_class) @content_schema = WeakSwaggerParameters::Definitions::ModelRef.new(model_class) end