Class: Dor::Services::Client::Accession
- Inherits:
-
VersionedService
- Object
- VersionedService
- Dor::Services::Client::Accession
- Defined in:
- lib/dor/services/client/accession.rb
Overview
API calls that are about starting accessioning on a repository object
Constant Summary
Constants inherited from VersionedService
VersionedService::EXCEPTION_CLASS, VersionedService::JSON_API_MIME_TYPE
Instance Method Summary collapse
-
#initialize(connection:, version:, object_identifier:) ⇒ Accession
constructor
A new instance of Accession.
-
#start(params = {}) ⇒ Boolean
Start accession on an object (start specified workflow, assemblyWF by default, and version if needed).
Methods inherited from VersionedService
#async_result, #with_querystring
Constructor Details
#initialize(connection:, version:, object_identifier:) ⇒ Accession
Returns a new instance of Accession.
11 12 13 14 |
# File 'lib/dor/services/client/accession.rb', line 11 def initialize(connection:, version:, object_identifier:) super(connection: connection, version: version) @object_identifier = object_identifier end |
Instance Method Details
#start(params = {}) ⇒ Boolean
Start accession on an object (start specified workflow, assemblyWF by default, and version if needed)
25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/dor/services/client/accession.rb', line 25 def start(params = {}) body = params[:context] ? { 'context' => params[:context] }.to_json : '' resp = connection.post do |req| req.url with_querystring(url: path, params: params.except(:context)) req.headers['Content-Type'] = 'application/json' req.body = body end return true if resp.success? raise_exception_based_on_response!(resp) end |