Sha256: cd884a304fea1635547c51f9c52b93fff5a5d206905487a2376e380283fee223

Contents?: true

Size: 694 Bytes

Versions: 1

Compression:

Stored size: 694 Bytes

Contents

require "faraday"
require "timeout"
require_relative "../soap_api"

class Skala::PrimoAdapter::SoapApi::SearchBrief
  attr_accessor :adapter

  def initialize(adapter)
    self.adapter = adapter
  end

  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
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
skala-1.1.0 lib/skala/primo_adapter/soap_api/search_brief.rb