Class: Useless::Doc::Core::Request::Parameter
- Inherits:
-
Object
- Object
- Useless::Doc::Core::Request::Parameter
- 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
-
#default ⇒ String, Numeric
readonly
The value used if the parameter is omitted and is not required.
-
#description ⇒ String
readonly
A description of the parameter.
-
#key ⇒ String
readonly
The key of the parameter.
-
#required ⇒ Boolean
readonly
Whether or not the parameter is required.
-
#type ⇒ String
readonly
Either “path” if it’s part of the URL path, or “query” if it’s part of the query string.
Instance Method Summary collapse
-
#initialize(attrs = {}) ⇒ Parameter
constructor
A new instance of Parameter.
Constructor Details
#initialize(attrs = {}) ⇒ Parameter
Returns a new instance of Parameter.
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
#default ⇒ String, Numeric (readonly)
Returns 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 |
#description ⇒ String (readonly)
Returns 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 |
#key ⇒ String (readonly)
Returns 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 |
#required ⇒ Boolean (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.
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 |
#type ⇒ String (readonly)
Returns 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 |