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
Constant Summary
Constants inherited from VersionedService
VersionedService::EXCEPTION_CLASS, VersionedService::JSON_API_MIME_TYPE
Instance Method Summary collapse
-
#create(source: nil, content: false, metadata: false) ⇒ String
Initializes a new workspace rubocop:disable Metrics/AbcSize.
-
#initialize(connection:, version:, object_identifier:) ⇒ Workspace
constructor
A new instance of Workspace.
Methods inherited from VersionedService
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
#create(source: nil, content: false, metadata: false) ⇒ String
Initializes a new workspace rubocop:disable Metrics/AbcSize
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/dor/services/client/workspace.rb', line 21 def create(source: nil, content: false, metadata: false) resp = connection.post do |req| req.url workspace_path req.params['source'] = source if source req.params['content'] = content req.params['metadata'] = end return JSON.parse(resp.body)['path'] if resp.success? raise_exception_based_on_response!(resp, object_identifier) unless resp.success? end |