Class: Dor::Services::Client::Workspace
- Inherits:
-
VersionedService
- Object
- VersionedService
- Dor::Services::Client::Workspace
- Defined in:
- lib/dor/services/client/workspace.rb
Overview
API calls that are about the DOR workspace
Instance Method Summary collapse
-
#cleanup ⇒ Object
Cleans up a workspace.
-
#create(source:) ⇒ Object
Initializes a new workspace.
-
#initialize(connection:, version:, object_identifier:) ⇒ Workspace
constructor
A new instance of Workspace.
-
#reset ⇒ Object
After an object has been copied to preservation the workspace can be reset.
Constructor Details
#initialize(connection:, version:, object_identifier:) ⇒ Workspace
Returns a new instance of Workspace.
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
#cleanup ⇒ Object
Cleans up a workspace
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
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 |
#reset ⇒ Object
After an object has been copied to preservation the workspace can be reset. This is called by the reset-workspace step of the accessionWF
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 |