Sha256: c9b5166932cc7cbd3806d580739e42f382c448438cabefa27fad98ceb5dcc952

Contents?: true

Size: 774 Bytes

Versions: 5

Compression:

Stored size: 774 Bytes

Contents

require 'swagger/swagger_object'
require 'swagger/v2/example'
require 'swagger/v2/header'

module Swagger
  module V2
    # Class representing a Swagger "Response Object".
    # @see https://github.com/wordnik/swagger-spec/blob/master/versions/2.0.md#responseObject Response Object
    class Response < SwaggerObject
      field :description, String
      field :schema, Swagger::Schema
      field :headers, Hash[String => Header] # TODO: Headers
      field :examples, Hash[Swagger::MimeType => Example]

      def status_code
        # FIXME: swagger-spec needs a defined way to define codes
        code = parent.responses.key self
        code = '200' if code == 'default'
        code.to_i
      rescue
        # TODO: Warning?
        200
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
swagger-parser-0.2.6 lib/swagger/v2/response.rb
swagger-parser-0.2.5 lib/swagger/v2/response.rb
swagger-core-0.3.0 lib/swagger/v2/response.rb
swagger-core-0.2.3 lib/swagger/v2/response.rb
swagger-core-0.2.2 lib/swagger/v2/response.rb