class Ecertic::Error

Error is the base error from which all other more specific Ecertic errors derive.

Attributes

http_body[R]
http_headers[R]
http_status[R]
message[R]
response[R]

Public Class Methods

new(message = nil, http_status: nil, http_headers: nil, http_body: nil, response: nil) click to toggle source
# File lib/ecertic/errors.rb, line 12
def initialize(message = nil, http_status: nil, http_headers: nil, http_body: nil, response: nil)
  @message = message
  @http_status = http_status || response&.status
  @http_headers = http_headers || response&.headers
  @http_body = http_body || response&.body
  @response = response
end

Public Instance Methods

to_s() click to toggle source
# File lib/ecertic/errors.rb, line 20
def to_s
  status_string = @http_status.nil? ? "" : "(Status #{@http_status}) "
  "#{status_string}#{@message}"
end