module Creditsafe::Messages

Constants

ACCESS_LIMITS_NEARING
ACCESS_RESTRICTED
ALL

rubocop:enable Metrics/LineLength

CHANGE_NOTIFICATION
DATA_SERVICE_INVALID_RESPONSE
DATA_SERVICE_PROBLEMS
ENDPOINT_SHUTDOWN
INVALID_CREDENTIALS
INVALID_CUSTOM_DATA_SPECIFIED
INVALID_OPERATION_PARAMS
INVALID_REQUEST_XML
NO_RESULTS

rubocop:disable Metrics/LineLength

OPERATION_NOT_SUPPORTED
OTHER_ERROR
REPORTBOX_ALMOST_FULL
REPORTBOX_FULL
REPORT_UNAVAILABLE
REPORT_UNAVAILABLE_ONLINE
TEMPORARY_SYSTEM_PROBLEM
TOO_MANY_RESULTS
UNEXPECTED_INTERNAL_ERROR

Public Class Methods

for_code(code) click to toggle source

Creditsafe documentation shows a 6 digit error code, however their API strips the leading 0. To comply with the docs, we pad the API code here to ensure we find the right match

# File lib/creditsafe/messages.rb, line 87
def self.for_code(code)
  padded_code = code.rjust(6, "0")
  message = ALL.find { |msg| msg.code == padded_code }

  if message.nil?
    message = Message.new(code: code, message: "Unknown error", error: true)
  end

  message
end