Module: BerkeleyLibrary::Util::URIs::Requester

Extended by:
Logging
Defined in:
lib/berkeley_library/util/uris/requester.rb

Class Method Summary collapse

Class Method Details

.get(uri, params = {}, headers = {}) ⇒ String

Performs a GET request.

Parameters:

  • uri (URI, String)

    the URI to GET

  • params (Hash) (defaults to: {})

    the query parameters to add to the URI. (Note that the URI may already include query parameters.)

  • headers (Hash) (defaults to: {})

    the request headers.

Returns:

  • (String)

    the body as a string.

Raises:

  • (RestClient::Exception)

    in the event of an error.



20
21
22
23
24
# File 'lib/berkeley_library/util/uris/requester.rb', line 20

def get(uri, params = {}, headers = {})
  url_str = url_str_with_params(uri, params)
  resp = get_or_raise(url_str, headers)
  resp.body
end