Module: BerkeleyLibrary::Location::WorldCat::Config

Extended by:
Config
Includes:
Util::URIs
Included in:
Config
Defined in:
lib/berkeley_library/location/world_cat/config.rb

Constant Summary collapse

ENV_WORLDCAT_API_KEY =

The environment variable from which to read the WorldCat API key and secret.

'LIT_WORLDCAT_API_KEY'.freeze
ENV_WORLDCAT_API_SECRET =
'LIT_WORLDCAT_API_SECRET'.freeze
ENV_WORLDCAT_BASE_URL =

The environment variable from which to read the WorldCat base URL.

'LIT_WORLDCAT_BASE_URL'.freeze
ENV_OCLC_TOKEN_URL =

The environment variable from which to read the OCLC Token URL.

'LIT_OCLC_TOKEN_URL'.freeze
DEFAULT_WORLDCAT_BASE_URL =

The default WorldCat base URL, if ENV_WORLDCAT_BASE_URL is not set. DEFAULT_WORLDCAT_BASE_URL = ‘www.worldcat.org/webservices/’.freeze

'https://americas.discovery.api.oclc.org/worldcat/search/v2/'.freeze
DEFAULT_OCLC_TOKEN_URL =

The default OCLC Token URL, if ENV_OCLC_TOKEN_URL is not set.

'https://oauth.oclc.org/token'.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#api_keyString?

Gets the WorldCat API key.

Returns:

  • (String, nil)

    the WorldCat API key, or ‘nil` if not set.



36
37
38
# File 'lib/berkeley_library/location/world_cat/config.rb', line 36

def api_key
  @api_key ||= default_worldcat_api_key
end

#api_secretObject

Sets the WorldCat API secret.



41
42
43
# File 'lib/berkeley_library/location/world_cat/config.rb', line 41

def api_secret
  @api_secret ||= default_worldcat_api_secret
end

Instance Method Details

#base_uriObject



45
46
47
# File 'lib/berkeley_library/location/world_cat/config.rb', line 45

def base_uri
  @base_uri ||= default_worldcat_base_uri
end

#base_uri=(value) ⇒ Object



53
54
55
# File 'lib/berkeley_library/location/world_cat/config.rb', line 53

def base_uri=(value)
  @base_uri = uri_or_nil(value)
end

#token_uriObject



49
50
51
# File 'lib/berkeley_library/location/world_cat/config.rb', line 49

def token_uri
  @token_uri ||= default_oclc_token_uri
end

#token_uri=(value) ⇒ Object



57
58
59
# File 'lib/berkeley_library/location/world_cat/config.rb', line 57

def token_uri=(value)
  @token_uri = uri_or_nil(value)
end