Class: AlmaApi::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/alma_api/configuration.rb

Constant Summary collapse

GATEWAYS =
{
  na: "https://api-na.hosted.exlibrisgroup.com/almaws/v1", # North America
  eu: "https://api-eu.hosted.exlibrisgroup.com/almaws/v1", # Europe
  ap: "https://api-ap.hosted.exlibrisgroup.com/almaws/v1", # Asia-Pacific
  ca: "https://api-ca.hosted.exlibrisgroup.com/almaws/v1", # Canada
  cn: "https://api-cn.hosted.exlibrisgroup.cn/almaws/v1"   # China
}.freeze
DEFAULT_GATEWAY =
GATEWAYS[:eu].freeze
DEFAULT_FORMAT =
"json".freeze
DEFAULT_LANGUAGE =
"en".freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_key: nil) {|_self| ... } ⇒ Configuration

Returns a new instance of Configuration.

Yields:

  • (_self)

Yield Parameters:



22
23
24
25
26
27
28
29
30
31
32
# File 'lib/alma_api/configuration.rb', line 22

def initialize(api_key: nil)
  # Set defaults. Passing nil to the setters will set the default value.
  self.api_key = api_key
  self.base_url = nil
  self.default_format = nil
  self.language = nil
  self.timeout = nil

  # Yield self to allow block-style configuration.
  yield(self) if block_given?
end

Instance Attribute Details

#api_keyObject

Returns the value of attribute api_key.



16
17
18
# File 'lib/alma_api/configuration.rb', line 16

def api_key
  @api_key
end

#base_urlObject

Returns the value of attribute base_url.



16
17
18
# File 'lib/alma_api/configuration.rb', line 16

def base_url
  @base_url
end

#default_formatObject

Returns the value of attribute default_format.



16
17
18
# File 'lib/alma_api/configuration.rb', line 16

def default_format
  @default_format
end

#languageObject

Returns the value of attribute language.



16
17
18
# File 'lib/alma_api/configuration.rb', line 16

def language
  @language
end

#timeoutObject

Returns the value of attribute timeout.



16
17
18
# File 'lib/alma_api/configuration.rb', line 16

def timeout
  @timeout
end