Sha256: f4089c4ba92c479fc0bf727c93d24ac1bf0df97c7cc4db47742372b9ad420d04

Contents?: true

Size: 890 Bytes

Versions: 4

Compression:

Stored size: 890 Bytes

Contents

# coding: utf-8
require 'libis-tools'
require 'libis/services/service_error'
require 'libis/services/rest_client'

module Libis
  module Services
    module Alma

      class WebService
        include ::Libis::Services::RestClient

        def initialize(url = 'https://api-eu.hosted.exlibrisgroup.com/almaws/v1/bibs')
          configure(url)
        end

        def get_marc(alma_id, apikey = nil)
          apikey ||= case alma_id
                      when /1480$/
                        'l7xx8879c82a7d7b453a887a6e6dca8300fd'
                      else
                        raise Libis::Services::ServiceError, "No Alma API key available for '#{alma_id}'"
                    end
          get alma_id, apikey: apikey
        end

        protected

        def result_parser(response)
          Libis::Tools::XmlDocument.parse(response)
        end

      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
libis-services-0.1.2 lib/libis/services/alma/web_service.rb
libis-services-0.1.1 lib/libis/services/alma/web_service.rb
libis-services-0.1.0-java lib/libis/services/alma/web_service.rb
libis-services-0.0.3 lib/libis/services/alma/web_service.rb