Sha256: e7a84a739ff9e46c1b8d4d30b68ca707f18c1d983c0801aef5f6f481af86b3af

Contents?: true

Size: 750 Bytes

Versions: 1

Compression:

Stored size: 750 Bytes

Contents

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

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, Array # [String => String] # 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

1 entries across 1 versions & 1 rubygems

Version Path
swagger-core-0.2.1 lib/swagger/v2/response.rb