def access_check(data, http_status)
      if data.is_a?(Hash) && !data['message'].nil?
        case data['message']
        when /Access denied|Access Denied/
          raise SFRest::AccessDeniedError, data['message']
        when /Forbidden: /
          raise SFRest::ActionForbiddenError, data['message']
        when /Bad Request:/
          raise SFRest::BadRequestError, data['message']
        when /Unprocessible Entity: |Unprocessable Entity: /
          raise SFRest::UnprocessableEntity, data['message']
        end
        if http_status >= 400 && http_status <= 599
          sf_err_message = "Status: #{http_status}, Message: #{data['message']}"
          raise SFRest::SFError, sf_err_message
        end
      end
      data
    end
def access_check(data, http_status)
      if data.is_a?(Hash) && !data['message'].nil?
        case data['message']
        when /Access denied|Access Denied/
          raise SFRest::AccessDeniedError, data['message']
        when /Forbidden: /
          raise SFRest::ActionForbiddenError, data['message']
        when /Bad Request:/
          raise SFRest::BadRequestError, data['message']
        when /Unprocessible Entity: |Unprocessable Entity: /
          raise SFRest::UnprocessableEntity, data['message']
        end
        if http_status >= 400 && http_status <= 599
          sf_err_message = "Status: #{http_status}, Message: #{data['message']}"
          raise SFRest::SFError, sf_err_message
        end
      end
      data
    end
Throws an SFRest exception for requests that have problems
 @param [Object] data JSON parsed http reponse of the SFApi
 @param [int] http_status the request's HTTP status
 @return [Object] the data object if there are no issues
 @raise [SFRest::AccessDeniedError] if Authentication fails
 @raise [SFRest::ActionForbiddenError] if the users role cannot perform the request
 @raise [SFRest::BadRequestError]  if there is something malformed in the request
 @raise [SFRest::UnprocessableEntity] if there is an unprocessable entity in the request
 @raise [SFRest::SFError] if the response HTTP status indicates an error but without the above qualifiers

 The cyclomatic complexity check is being ignored here because we are
 collecting all the possible exception raising cases.
 rubocop: disable Metrics/CyclomaticComplexity