Sha256: 6d891345f43f1f17adcee42e08257356b29f6f01a9887ffe56975f5994b08cf8

Contents?: true

Size: 597 Bytes

Versions: 2

Compression:

Stored size: 597 Bytes

Contents

module Sdr

  module Client
    class << self

      # @param [String] druid id of the object you want the version of
      # @return [Integer] the current version from SDR
      def current_version druid
        sdr_client = Dor::Config.sdr.rest_client
        xml = sdr_client["objects/#{druid}/current_version"].get

        begin
          doc = Nokogiri::XML xml
          raise if doc.root.name != 'currentVersion'
          return Integer(doc.text)
        rescue => e
          raise "Unable to parse XML from SDR current_version API call: #{xml}"
        end
      end

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dor-services-5.2.0 lib/dor/utils/sdr_client.rb
dor-services-5.1.1 lib/dor/utils/sdr_client.rb