Exception: BerkeleyLibrary::TIND::API::APIKeyNotSet

Inherits:
APIException
  • Object
show all
Defined in:
lib/berkeley_library/tind/api/api_exception.rb

Overview

Exception raised when the API key is nil or blank.

NOTE: TIND incorrectly returns 403 Forbidden in this case, but we don't even bother to ask, we just simulate a 401.

Instance Attribute Summary

Attributes inherited from APIException

#params, #response, #status_code, #status_message, #url

Instance Method Summary collapse

Methods inherited from APIException

#body, wrap

Constructor Details

#initialize(endpoint_uri, params) ⇒ APIKeyNotSet

Returns a new instance of APIKeyNotSet.

Parameters:

  • endpoint_uri (URI)

    the endpoint URI

  • params (Hash, nil)

    the query parameters



103
104
105
106
# File 'lib/berkeley_library/tind/api/api_exception.rb', line 103

def initialize(endpoint_uri, params)
  request_str = API.format_request(endpoint_uri, params)
  super("#{request_str} failed; API key not set", status_code: 401)
end