Class: Celsius::Primo::Adapter

Inherits:
Adapter
  • Object
show all
Defined in:
lib/celsius/primo/adapter.rb

Defined Under Namespace

Classes: Mget, Operation, Search

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Adapter

Returns a new instance of Adapter.

Raises:

  • (ArgumentError)


15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/celsius/primo/adapter.rb', line 15

def initialize(options = {})
  super # e.g. load super class locales

  # add adapter specific locales (see Celsius::I18n)
  self.class.load_locales_from_directory("#{File.dirname(__FILE__)}/locales")

  # ease options processing by eleminating all symbols
  options = deep_stringify(options)

  # check for required options
  raise ArgumentError, "soap_api_options are needed!" unless options["soap_api_options"]

  @institution = options["institution"]
  @languages = options["languages"]
  @locations = options["locations"]
  @soap_api_options = options["soap_api_options"]
  @timeout = options["timeout"]
end

Instance Attribute Details

#institutionObject

Returns the value of attribute institution.



10
11
12
# File 'lib/celsius/primo/adapter.rb', line 10

def institution
  @institution
end

#languagesObject

Returns the value of attribute languages.



11
12
13
# File 'lib/celsius/primo/adapter.rb', line 11

def languages
  @languages
end

#locationsObject

Returns the value of attribute locations.



12
13
14
# File 'lib/celsius/primo/adapter.rb', line 12

def locations
  @locations
end

#timeoutObject

Returns the value of attribute timeout.



13
14
15
# File 'lib/celsius/primo/adapter.rb', line 13

def timeout
  @timeout
end

Instance Method Details

#mget(*args) ⇒ Object



34
35
36
# File 'lib/celsius/primo/adapter.rb', line 34

def mget(*args)
  Mget.new(self).call(*args)
end

#search(*args) ⇒ Object



38
39
40
# File 'lib/celsius/primo/adapter.rb', line 38

def search(*args)
  Search.new(self).call(*args)
end

#soap_apiObject



42
43
44
# File 'lib/celsius/primo/adapter.rb', line 42

def soap_api
  Celsius::Primo::SoapApi.new(@soap_api_options)
end