module Useless module Doc module Core # Documentation for an HTTP body, belonging either to the request or the # response. # # @!attribute [r] content_type # @return [String] the MIME type of the body. # # @!attribute [r] attributes # @return [Array] documentation for each of the body # attributes. # class Body attr_reader :content_type, :attributes # @param [Hash] attrs corresponds to the class's instance attributes. # def initialize(attrs) @content_type = attrs[:content_type] @attributes = attrs[:attributes] || [] end # Documentation for an attribute on an HTTP body. # # @!attribute [r] key # @return [String] the key of this attribute in the body. # # @!attribute [r] value_type # @return [String] one of "string", "number", "object", # "array", or "boolean". "string" is the default value. # # @!attribute [r] required # @return [Boolean] whether or not the attribute is required. If it # is required, and the attribute is omitted, the response should have # a 4xx code. +true+ is the default value. # # @!attribute [r] description # @return [String] a description of the attribute. # class Attribute attr_reader :key, :type, :required, :default, :description # @param [Hash] attrs corresponds to the class's instance attributes. # def initialize(attrs) @key = attrs[:key] @type = attrs[:type] || 'string' @required = attrs.key?(:required) ? attrs[:required] : true @default = attrs[:default] @description = attrs[:description] end end end end end end