class Digicert::Debugger

Attributes

request[R]
response[R]

Public Class Methods

new(request:, response:) click to toggle source
# File lib/digicert/debugger.rb, line 3
def initialize(request:, response:)
  @request = request
  @response = response
end

Public Instance Methods

debug() click to toggle source
# File lib/digicert/debugger.rb, line 8
def debug
  puts "[API Reqeust Begin]".center(50, "=")
  puts api_request_details
  puts api_response_details
  puts "[API Reqeust End]".center(50, "=")
end

Private Instance Methods

api_request_details() click to toggle source
# File lib/digicert/debugger.rb, line 19
def api_request_details
  uri = ["[URI]", request.method, request.uri].join(" ")
  headers = "[Headers] " + request.to_hash.to_s
  body = "[Request Body] " + request.body.to_json if request.body

  [uri, headers, body].join("\n")
end
api_response_details() click to toggle source
# File lib/digicert/debugger.rb, line 27
def api_response_details
  response_object = "[Response] " + response.inspect
  body = "[Response Body] " + response.body if response.body

  [response_object, body].join("\n")
end