Class: Dor::Workflow::Client::VersionRoutes

Inherits:
Object
  • Object
show all
Defined in:
lib/dor/workflow/client/version_routes.rb

Overview

Makes requests relating to versions

Instance Method Summary collapse

Constructor Details

#initialize(requestor:) ⇒ VersionRoutes

Returns a new instance of VersionRoutes.



8
9
10
# File 'lib/dor/workflow/client/version_routes.rb', line 8

def initialize(requestor:)
  @requestor = requestor
end

Instance Method Details

#close_version(repo, druid, create_accession_wf = true) ⇒ Object

Calls the versionClose endpoint of the workflow service:

  • completes the versioningWF:submit-version and versioningWF:start-accession steps
  • initiates accesssionWF

Parameters:

  • repo (String)

    The repository the object resides in. The service recoginzes "dor" and "sdr" at the moment

  • druid (String)

    The id of the object to delete the workflow from

  • create_accession_wf (Boolean) (defaults to: true)

    Option to create accessionWF when closing a version. Defaults to true



20
21
22
23
24
25
# File 'lib/dor/workflow/client/version_routes.rb', line 20

def close_version(repo, druid, create_accession_wf = true)
  uri = "#{repo}/objects/#{druid}/versionClose"
  uri += '?create-accession=false' unless create_accession_wf
  requestor.request(uri, 'post', '')
  true
end