Sha256: 71b145bd1ef901abd18781fd6770845612b3aaf95d12904bc9ae011b555df488

Contents?: true

Size: 936 Bytes

Versions: 9

Compression:

Stored size: 936 Bytes

Contents

# frozen_string_literal: true

module Dor
  module Services
    class Client
      # API calls around MARCXML-based operations from dor-services-app
      class Marcxml < VersionedService
        # Get a catkey corresponding to a barcode
        # @param barcode [String] required string representing a barcode
        # @raise [NotFoundResponse] when the response is a 404 (object not found)
        # @raise [UnexpectedResponse] on an unsuccessful response from the server
        # @return [String] result of background job
        def catkey(barcode:)
          resp = connection.get do |req|
            req.url "#{api_version}/catalog/catkey"
            req.params['barcode'] = barcode
          end

          return resp.body if resp.success? && resp.body.present?
          raise NotFoundResponse if resp.success? && resp.body.blank?

          raise_exception_based_on_response!(resp)
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
dor-services-client-4.9.0 lib/dor/services/client/marcxml.rb
dor-services-client-4.8.0 lib/dor/services/client/marcxml.rb
dor-services-client-4.7.0 lib/dor/services/client/marcxml.rb
dor-services-client-4.6.0 lib/dor/services/client/marcxml.rb
dor-services-client-4.5.0 lib/dor/services/client/marcxml.rb
dor-services-client-4.4.0 lib/dor/services/client/marcxml.rb
dor-services-client-4.3.0 lib/dor/services/client/marcxml.rb
dor-services-client-4.2.0 lib/dor/services/client/marcxml.rb
dor-services-client-4.1.0 lib/dor/services/client/marcxml.rb