Class: Useless::Doc::Core::Request
- Inherits:
-
Object
- Object
- Useless::Doc::Core::Request
- Defined in:
- lib/useless/doc/core/request.rb
Overview
Documentation for an HTTP request.
Defined Under Namespace
Modules: Method Classes: Parameter
Instance Attribute Summary collapse
-
#authentication_required ⇒ Boolean
Whether or not the user needs to authenticate in order to perform this request.
-
#body ⇒ Body
The body of the request.
-
#description ⇒ String
A description of the request.
-
#headers ⇒ Array<Header>
Possible headers for the request.
-
#method ⇒ String
The request’s HTTP method.
-
#parameters ⇒ Array<Request::Parameter>
Possible parameters for the request.
-
#responses ⇒ Array<Response>
Possible responses to the request.
Instance Method Summary collapse
-
#initialize(attrs = {}) ⇒ Request
constructor
A new instance of Request.
Constructor Details
#initialize(attrs = {}) ⇒ Request
Returns a new instance of Request.
53 54 55 56 57 58 59 60 61 |
# File 'lib/useless/doc/core/request.rb', line 53 def initialize(attrs = {}) @method = attrs[:method] @description = attrs[:description] @authentication_required = attrs[:authentication_required] @parameters = attrs[:parameters] || [] @headers = attrs[:headers] || [] @body = attrs[:body] @responses = attrs[:responses] || [] end |
Instance Attribute Details
#authentication_required ⇒ Boolean
Returns whether or not the user needs to authenticate in order to perform this request.
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/useless/doc/core/request.rb', line 35 class Request module Method GET = 'GET' HEAD = 'HEAD' POST = 'POST' PUT = 'PUT' PATCH = 'PATCH' DELETE = 'DELETE' TRACE = 'TRACE' CONNECT = 'CONNECT' end attr_accessor :method, :description, :authentication_required, :parameters, :headers, :body, :responses # @param [Hash] attrs corresponds to the class's instance attributes. # def initialize(attrs = {}) @method = attrs[:method] @description = attrs[:description] @authentication_required = attrs[:authentication_required] @parameters = attrs[:parameters] || [] @headers = attrs[:headers] || [] @body = attrs[:body] @responses = attrs[:responses] || [] end # 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 |
#body ⇒ Body
Returns the body of the request.
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/useless/doc/core/request.rb', line 35 class Request module Method GET = 'GET' HEAD = 'HEAD' POST = 'POST' PUT = 'PUT' PATCH = 'PATCH' DELETE = 'DELETE' TRACE = 'TRACE' CONNECT = 'CONNECT' end attr_accessor :method, :description, :authentication_required, :parameters, :headers, :body, :responses # @param [Hash] attrs corresponds to the class's instance attributes. # def initialize(attrs = {}) @method = attrs[:method] @description = attrs[:description] @authentication_required = attrs[:authentication_required] @parameters = attrs[:parameters] || [] @headers = attrs[:headers] || [] @body = attrs[:body] @responses = attrs[:responses] || [] end # 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 |
#description ⇒ String
Returns a description of the request.
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/useless/doc/core/request.rb', line 35 class Request module Method GET = 'GET' HEAD = 'HEAD' POST = 'POST' PUT = 'PUT' PATCH = 'PATCH' DELETE = 'DELETE' TRACE = 'TRACE' CONNECT = 'CONNECT' end attr_accessor :method, :description, :authentication_required, :parameters, :headers, :body, :responses # @param [Hash] attrs corresponds to the class's instance attributes. # def initialize(attrs = {}) @method = attrs[:method] @description = attrs[:description] @authentication_required = attrs[:authentication_required] @parameters = attrs[:parameters] || [] @headers = attrs[:headers] || [] @body = attrs[:body] @responses = attrs[:responses] || [] end # 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 |
#headers ⇒ Array<Header>
Returns possible headers for the request.
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/useless/doc/core/request.rb', line 35 class Request module Method GET = 'GET' HEAD = 'HEAD' POST = 'POST' PUT = 'PUT' PATCH = 'PATCH' DELETE = 'DELETE' TRACE = 'TRACE' CONNECT = 'CONNECT' end attr_accessor :method, :description, :authentication_required, :parameters, :headers, :body, :responses # @param [Hash] attrs corresponds to the class's instance attributes. # def initialize(attrs = {}) @method = attrs[:method] @description = attrs[:description] @authentication_required = attrs[:authentication_required] @parameters = attrs[:parameters] || [] @headers = attrs[:headers] || [] @body = attrs[:body] @responses = attrs[:responses] || [] end # 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 |
#method ⇒ String
Returns the request’s HTTP method.
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/useless/doc/core/request.rb', line 35 class Request module Method GET = 'GET' HEAD = 'HEAD' POST = 'POST' PUT = 'PUT' PATCH = 'PATCH' DELETE = 'DELETE' TRACE = 'TRACE' CONNECT = 'CONNECT' end attr_accessor :method, :description, :authentication_required, :parameters, :headers, :body, :responses # @param [Hash] attrs corresponds to the class's instance attributes. # def initialize(attrs = {}) @method = attrs[:method] @description = attrs[:description] @authentication_required = attrs[:authentication_required] @parameters = attrs[:parameters] || [] @headers = attrs[:headers] || [] @body = attrs[:body] @responses = attrs[:responses] || [] end # 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 |
#parameters ⇒ Array<Request::Parameter>
Returns possible parameters for the request.
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/useless/doc/core/request.rb', line 35 class Request module Method GET = 'GET' HEAD = 'HEAD' POST = 'POST' PUT = 'PUT' PATCH = 'PATCH' DELETE = 'DELETE' TRACE = 'TRACE' CONNECT = 'CONNECT' end attr_accessor :method, :description, :authentication_required, :parameters, :headers, :body, :responses # @param [Hash] attrs corresponds to the class's instance attributes. # def initialize(attrs = {}) @method = attrs[:method] @description = attrs[:description] @authentication_required = attrs[:authentication_required] @parameters = attrs[:parameters] || [] @headers = attrs[:headers] || [] @body = attrs[:body] @responses = attrs[:responses] || [] end # 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 |
#responses ⇒ Array<Response>
Returns possible responses to the request.
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/useless/doc/core/request.rb', line 35 class Request module Method GET = 'GET' HEAD = 'HEAD' POST = 'POST' PUT = 'PUT' PATCH = 'PATCH' DELETE = 'DELETE' TRACE = 'TRACE' CONNECT = 'CONNECT' end attr_accessor :method, :description, :authentication_required, :parameters, :headers, :body, :responses # @param [Hash] attrs corresponds to the class's instance attributes. # def initialize(attrs = {}) @method = attrs[:method] @description = attrs[:description] @authentication_required = attrs[:authentication_required] @parameters = attrs[:parameters] || [] @headers = attrs[:headers] || [] @body = attrs[:body] @responses = attrs[:responses] || [] end # 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 |