Class: Skala::PrimoAdapter::SoapApi::SearchBrief

Inherits:
Object
  • Object
show all
Defined in:
lib/skala/primo_adapter/soap_api/search_brief.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(adapter) ⇒ SearchBrief

Returns a new instance of SearchBrief.



8
9
10
# File 'lib/skala/primo_adapter/soap_api/search_brief.rb', line 8

def initialize(adapter)
  self.adapter = adapter
end

Instance Attribute Details

#adapterObject

Returns the value of attribute adapter.



6
7
8
# File 'lib/skala/primo_adapter/soap_api/search_brief.rb', line 6

def adapter
  @adapter
end

Instance Method Details

#call(request) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/skala/primo_adapter/soap_api/search_brief.rb', line 12

def call(request)
  begin
    Timeout::timeout(adapter.timeout) do
      Faraday.post(adapter.soap_api_url, request, {
        "Content-Type" => "application/xml", # necessary since new soap endpoint (else -> premature end of file error)
        "SOAPAction" => "searchBrief" 
      })
      .body
    end
  rescue Timeout::Error
    raise Timeout::Error, "Primo search request aborted! The server has not responded within #{adapter.timeout} seconds!"
  end
end