class MyApiClient::Params::Request

Description of Params

Attributes

body[R]
headers[R]
method[R]
uri[R]

Public Class Methods

new(method, uri, headers, body) click to toggle source

Description of initialize

@param method [Symbol] describe_method_here @param uri [URI] describe_uri_here @param headers [Hash, nil] describe_headers_here @param body [Hash, nil] describe_body_here

# 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

Public Instance Methods

inspect() click to toggle source

Returns contents as string for to be readable for human

@return [String] Contents as string

# 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() click to toggle source

Generate metadata for bugsnag. Blank parameter will be omitted.

@return [Hash] Metadata for bugsnag

# File lib/my_api_client/params/request.rb, line 33
def metadata
  {
    line: "#{method.upcase} #{uri}",
    headers: headers,
    body: body,
  }.compact
end
Also aliased as: to_bugsnag
to_bugsnag()
Alias for: metadata
to_sawyer_args() click to toggle source

Description of to_sawyer_args

@return [Array<Object>] Arguments for Sawyer::Agent#call

# File lib/my_api_client/params/request.rb, line 25
def to_sawyer_args
  [method, uri.to_s, body, { headers: headers }]
end