Class: Useless::Doc::Core::Request::Parameter

Inherits:
Object
  • Object
show all
Defined in:
lib/useless/doc/core/request.rb

Overview

Documentation for a request parameter for an API action.

Defined Under Namespace

Modules: Type

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attrs = {}) ⇒ Parameter

Returns a new instance of Parameter.

Parameters:

  • attrs (Hash) (defaults to: {})

    corresponds to the class’s instance attributes.



95
96
97
98
99
100
101
# File 'lib/useless/doc/core/request.rb', line 95

def initialize(attrs = {})
  @type         = attrs[:type]
  @key          = attrs[:key]
  @required     = attrs[:required]
  @default      = attrs[:default]
  @description  = attrs[:description]
end

Instance Attribute Details

#defaultString, Numeric (readonly)

Returns the value used if the parameter is omitted and is not required.

Returns:

  • (String, Numeric)

    the value used if the parameter is omitted and is not required.



84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/useless/doc/core/request.rb', line 84

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

#descriptionString (readonly)

Returns a description of the parameter.

Returns:

  • (String)

    a description of the parameter.



84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/useless/doc/core/request.rb', line 84

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

#keyString (readonly)

Returns the key of the parameter.

Returns:

  • (String)

    the key of the parameter.



84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/useless/doc/core/request.rb', line 84

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

#requiredBoolean (readonly)

Returns whether or not the parameter is required. If it is required, and the attribute is omitted, the response should have a 4xx code.

Returns:

  • (Boolean)

    whether or not the parameter is required. If it is required, and the attribute is omitted, the response should have a 4xx code.



84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/useless/doc/core/request.rb', line 84

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

#typeString (readonly)

Returns either “path” if it’s part of the URL path, or “query” if it’s part of the query string.

Returns:

  • (String)

    either “path” if it’s part of the URL path, or “query” if it’s part of the query string.



84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/useless/doc/core/request.rb', line 84

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