Class: Celsius::Primo::SoapApi::Searcher::SearchBrief

Inherits:
Object
  • Object
show all
Defined in:
lib/celsius/primo/soap_api/searcher/search_brief.rb

Defined Under Namespace

Classes: SearchRequestTransformation, SearchResultTransformation

Instance Method Summary collapse

Constructor Details

#initialize(searcher_url) ⇒ SearchBrief

Returns a new instance of SearchBrief.



10
11
12
# File 'lib/celsius/primo/soap_api/searcher/search_brief.rb', line 10

def initialize(searcher_url)
  @searcher_url = searcher_url
end

Instance Method Details

#call(search_request, options = {}) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/celsius/primo/soap_api/searcher/search_brief.rb', line 14

def call(search_request, options = {})
  options = deep_stringify(options)

  raw_response =
  begin
    Timeout::timeout(options["timeout"]) do
      HTTPI.post(httpi_request(search_request, options)).body
    end
  rescue Timeout::Error
    raise Timeout::Error, "Primo search request aborted! The server has not responded within #{options["timeout"]} seconds!"
  end

  SearchResultTransformation.new(
    search_request: search_request
  ).apply(to: raw_response)
end