Sha256: 603ff179098328be86c04925eace50fc82b6cb8055a2859a030ac151de956217
Contents?: true
Size: 1.78 KB
Versions: 4
Compression:
Stored size: 1.78 KB
Contents
module Useless module Doc # 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<Body::Attribute>] 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
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
useless-doc-0.1.3 | lib/useless/doc/body.rb |
useless-doc-0.1.2 | lib/useless/doc/body.rb |
useless-doc-0.1.1 | lib/useless/doc/body.rb |
useless-doc-0.1.0 | lib/useless/doc/body.rb |