Sha256: 233cfb3ea3fcdf060e09faf37ac3194ae61db71c89c3dfdc095e97484f532210

Contents?: true

Size: 592 Bytes

Versions: 8

Compression:

Stored size: 592 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
          raise "Unable to parse XML from SDR current_version API call: #{xml}"
        end
      end

    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
dor-services-5.4.2 lib/dor/utils/sdr_client.rb
dor-services-5.4.1 lib/dor/utils/sdr_client.rb
dor-services-5.4.0 lib/dor/utils/sdr_client.rb
dor-services-5.3.4 lib/dor/utils/sdr_client.rb
dor-services-5.3.3 lib/dor/utils/sdr_client.rb
dor-services-5.3.2 lib/dor/utils/sdr_client.rb
dor-services-5.3.1 lib/dor/utils/sdr_client.rb
dor-services-5.3.0 lib/dor/utils/sdr_client.rb