Sha256: 6dc0d9234ef19c504cca3377cffd43af546660703aff59cb5d35ae66a1754182
Contents?: true
Size: 1.09 KB
Versions: 2
Compression:
Stored size: 1.09 KB
Contents
# frozen_string_literal: true module WeakSwaggerParameters module Definitions class Response def initialize(status_code, description, &block) @status_code = status_code @description = description @content_schema = nil instance_eval(&block) if block.present? end def hash(&block) @content_schema = WeakSwaggerParameters::Definitions::HashRef.new(&block) end def model(model_class) @content_schema = WeakSwaggerParameters::Definitions::ModelRef.new(model_class) end def collection(model_class) @content_schema = WeakSwaggerParameters::Definitions::CollectionRef.new(model_class) end 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 end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
weak_swagger_parameters-0.4.0 | lib/weak_swagger_parameters/definitions/response.rb |
weak_swagger_parameters-0.3.0 | lib/weak_swagger_parameters/definitions/response.rb |