Sha256: 5f056bafe9aca5b05dd74888cf6d09fa59a6612534d4395af3d0b6238266a2e4

Contents?: true

Size: 1.22 KB

Versions: 25

Compression:

Stored size: 1.22 KB

Contents

# coding: utf-8
require 'libis-tools'

require 'libis/services/rest_client'

module Libis
  module Services
    module Primo

      class Limo
        include ::Libis::Services::RestClient

        def initialize(url = 'http://limo.libis.be')
          configure(url)
        end

        def get_marc(alma_id)
          result = get "primo_library/libweb/jqp/record/#{alma_id}.xml"
          return result if result.is_a?(Libis::Tools::XmlDocument)

          raise Libis::Services::ServiceError, "#{result[:error_type]} - #{result[:error_name]}" if result[:error_type]
          raise Libis::Services::ServiceError, "Unexpected reply: '#{result.to_s}' (#{result.class})"
        end

        def get_pnx(alma_id)
          result = get "primo_library/libweb/jqp/record/#{alma_id}.pnx"
          return result if result.is_a?(Libis::Tools::XmlDocument)

          raise Libis::Services::ServiceError, "#{result[:error_type]} - #{result[:error_name]}" if result[:error_type]
          raise Libis::Services::ServiceError, "Unexpected reply: '#{result.to_s}' (#{result.class})"
        end

        protected

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

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
libis-services-1.1.0 lib/libis/services/primo/limo.rb
libis-services-1.0.13 lib/libis/services/primo/limo.rb
libis-services-1.0.12 lib/libis/services/primo/limo.rb
libis-services-1.0.11 lib/libis/services/primo/limo.rb
libis-services-1.0.10 lib/libis/services/primo/limo.rb
libis-services-1.0.7 lib/libis/services/primo/limo.rb
libis-services-1.0.6 lib/libis/services/primo/limo.rb
libis-services-1.0.5 lib/libis/services/primo/limo.rb
libis-services-1.0.2 lib/libis/services/primo/limo.rb
libis-services-1.0.1 lib/libis/services/primo/limo.rb
libis-services-1.0.0 lib/libis/services/primo/limo.rb
libis-services-0.2.1 lib/libis/services/primo/limo.rb
libis-services-0.2.0 lib/libis/services/primo/limo.rb
libis-services-0.1.18 lib/libis/services/primo/limo.rb
libis-services-0.1.17 lib/libis/services/primo/limo.rb
libis-services-0.1.16 lib/libis/services/primo/limo.rb
libis-services-0.1.15 lib/libis/services/primo/limo.rb
libis-services-0.1.14 lib/libis/services/primo/limo.rb
libis-services-0.1.13 lib/libis/services/primo/limo.rb
libis-services-0.1.12 lib/libis/services/primo/limo.rb