Class: MyApiClient::Params::Request
- Inherits:
-
Object
- Object
- MyApiClient::Params::Request
- Defined in:
- lib/my_api_client/params/request.rb
Overview
Description of Params
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#method ⇒ Object
readonly
Returns the value of attribute method.
-
#uri ⇒ Object
readonly
Returns the value of attribute uri.
Instance Method Summary collapse
-
#initialize(method, uri, headers, body) ⇒ Request
constructor
Description of #initialize.
-
#inspect ⇒ String
Returns contents as string for to be readable for human.
-
#metadata ⇒ Hash
(also: #to_bugsnag)
Generate metadata for bugsnag.
-
#to_sawyer_args ⇒ Array<Object>
Description of #to_sawyer_args.
Constructor Details
#initialize(method, uri, headers, body) ⇒ Request
Description of #initialize
15 16 17 18 19 20 |
# File 'lib/my_api_client/params/request.rb', line 15 def initialize(method, uri, headers, body) @method = method @uri = uri @headers = headers @body = body end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
7 8 9 |
# File 'lib/my_api_client/params/request.rb', line 7 def body @body end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
7 8 9 |
# File 'lib/my_api_client/params/request.rb', line 7 def headers @headers end |
#method ⇒ Object (readonly)
Returns the value of attribute method.
7 8 9 |
# File 'lib/my_api_client/params/request.rb', line 7 def method @method end |
#uri ⇒ Object (readonly)
Returns the value of attribute uri.
7 8 9 |
# File 'lib/my_api_client/params/request.rb', line 7 def uri @uri end |
Instance Method Details
#inspect ⇒ String
Returns contents as string for to be readable for human
45 46 47 |
# File 'lib/my_api_client/params/request.rb', line 45 def inspect { method: method, uri: uri.to_s, headers: headers, body: body }.inspect end |
#metadata ⇒ Hash Also known as: to_bugsnag
Generate metadata for bugsnag. Blank parameter will be omitted.
33 34 35 36 37 38 39 |
# File 'lib/my_api_client/params/request.rb', line 33 def { line: "#{method.upcase} #{uri}", headers: headers, body: body, }.compact end |
#to_sawyer_args ⇒ Array<Object>
Description of #to_sawyer_args
25 26 27 |
# File 'lib/my_api_client/params/request.rb', line 25 def to_sawyer_args [method, uri.to_s, body, { headers: headers }] end |