Class: Dor::Services::Client::SDR

Inherits:
VersionedService show all
Defined in:
lib/dor/services/client/sdr.rb

Overview

API calls that are about preserved objects

Instance Method Summary collapse

Methods inherited from VersionedService

#initialize

Constructor Details

This class inherits a constructor from Dor::Services::Client::VersionedService

Instance Method Details

#current_version(object:) ⇒ Integer

Gets the current version number for the object

Parameters:

  • object (String)

    the pid for the object

Returns:

  • (Integer)

    the current version

Raises:



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/dor/services/client/sdr.rb', line 13

def current_version(object:)
  xml = current_version_response(object: object)
  begin
    doc = Nokogiri::XML xml
    raise if doc.root.name != 'currentVersion'

    return Integer(doc.text)
  rescue StandardError
    raise MalformedResponse, "Unable to parse XML from current_version API call: #{xml}"
  end
end