Sha256: ef52d5e061a9f2af8ee93bd9d3984ca234872f7be06f44d2f2191bd325a6a0c9

Contents?: true

Size: 1.36 KB

Versions: 4

Compression:

Stored size: 1.36 KB

Contents

module Useless
  module Doc
    class Request

      # Documentation for a request parameter for an API action.
      #
      # @!attribute [r] type
      #   @return [String] either "path" if it's part of the URL path, or
      #     "query" if it's part of the query string.
      #
      # @!attribute [r] key
      #   @return [String] the key of the parameter.
      #
      # @!attribute [r] required
      #   @return [Boolean] whether or not the parameter is required. If it is
      #     required, and the attribute is omitted, the response should have a
      #     4xx code.
      #
      # @!attribute [r] default
      #   @return [String, Numeric] the value used if the parameter is omitted
      #     and is not required.
      #
      # @!attribute [r] description
      #   @return [String] a description of the parameter.
      #
      class Parameter

        module Type
          PATH = 'path'
          QUERY = 'query'
        end

        attr_reader :type, :key, :required, :default, :description

        # @param [Hash] attrs corresponds to the class's instance attributes.
        #
        def initialize(attrs = {})
          @type         = attrs[:type]
          @key          = attrs[:key]
          @required     = attrs[:required]
          @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/request/parameter.rb
useless-doc-0.1.2 lib/useless/doc/request/parameter.rb
useless-doc-0.1.1 lib/useless/doc/request/parameter.rb
useless-doc-0.1.0 lib/useless/doc/request/parameter.rb