Sha256: de444e1f20acc5db40205ac1aba2d4dd4a25d81eeac8fa3a9a840a3af52cd935

Contents?: true

Size: 842 Bytes

Versions: 5

Compression:

Stored size: 842 Bytes

Contents

require "celsius/primo/adapter"
require "celsius/primo/adapter/operation"

class Celsius::Primo::Adapter::Search < Celsius::Primo::Adapter::Operation
  def call(search_request, options = {})
    unless search_request.is_a?(Hash)
      raise ArgumentError, "The search request has to be a hash!"
    end

    options = deep_stringify(options)

    if(options["languages"] ||= adapter.languages).nil?
      raise ArgumentError, "languages is missing!"
    end

    if(options["locations"] ||= adapter.locations).nil?
      raise ArgumentError, "locations is missing!"
    end

    if(options["institution"] ||= adapter.institution).nil?
      raise ArgumentError, "institution is missing!"
    end

    @adapter.soap_api.searcher.searchBrief search_request, options.merge({
      timeout: options["timeout"] || adapter.timeout
    })
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
celsius-primo-0.1.4 lib/celsius/primo/adapter/search.rb
celsius-primo-0.1.3 lib/celsius/primo/adapter/search.rb
celsius-primo-0.1.2 lib/celsius/primo/adapter/search.rb
celsius-primo-0.1.1 lib/celsius/primo/adapter/search.rb
celsius-primo-0.1.0 lib/celsius/primo/adapter/search.rb