Class: Dor::Services::Client::Workspace

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

Overview

API calls that are about the DOR workspace

Instance Method Summary collapse

Constructor Details

#initialize(connection:, version:, object_identifier:) ⇒ Workspace

Returns a new instance of Workspace.

Parameters:

  • object_identifier (String)

    the pid for the object



9
10
11
12
# File 'lib/dor/services/client/workspace.rb', line 9

def initialize(connection:, version:, object_identifier:)
  super(connection: connection, version: version)
  @object_identifier = object_identifier
end

Instance Method Details

#cleanupObject

Cleans up a workspace

Returns:

  • nil

Raises:



29
30
31
32
33
34
# File 'lib/dor/services/client/workspace.rb', line 29

def cleanup
  resp = connection.delete do |req|
    req.url workspace_path
  end
  raise UnexpectedResponse, ResponseErrorFormatter.format(response: resp) unless resp.success?
end

#create(source:) ⇒ Object

Initializes a new workspace

Parameters:

  • source (String)

    the path to the object

Returns:

  • nil

Raises:



18
19
20
21
22
23
24
# File 'lib/dor/services/client/workspace.rb', line 18

def create(source:)
  resp = connection.post do |req|
    req.url workspace_path
    req.params['source'] = source
  end
  raise UnexpectedResponse, ResponseErrorFormatter.format(response: resp) unless resp.success?
end

#resetObject

After an object has been copied to preservation the workspace can be reset. This is called by the reset-workspace step of the accessionWF

Returns:

  • nil

Raises:



40
41
42
43
44
45
# File 'lib/dor/services/client/workspace.rb', line 40

def reset
  resp = connection.post do |req|
    req.url "#{workspace_path}/reset"
  end
  raise UnexpectedResponse, ResponseErrorFormatter.format(response: resp) unless resp.success?
end