dor-workflow-service 1.4.1 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/dor/services/workflow_service.rb +13 -0
- data/lib/dor/workflow_version.rb +1 -1
- data/spec/workflow_service_spec.rb +14 -0
- metadata +2 -2
@@ -275,6 +275,19 @@ module Dor
|
|
275
275
|
dor_services[url].post ''
|
276
276
|
end
|
277
277
|
|
278
|
+
# Calls the versionClose endpoint of the WorkflowService:
|
279
|
+
# - completes the versioningWF:submit-version and versioningWF:start-accession steps
|
280
|
+
# - initiates accesssionWF
|
281
|
+
# @param [String] repo The repository the object resides in. The service recoginzes "dor" and "sdr" at the moment
|
282
|
+
# @param [String] druid The id of the object to delete the workflow from
|
283
|
+
# @param [Boolean] create_accession_wf Option to create accessionWF when closing a version. Defaults to true
|
284
|
+
def close_version(repo, druid, create_accession_wf = true)
|
285
|
+
uri = "#{repo}/objects/#{druid}/versionClose"
|
286
|
+
uri << "?create-accession=false" if(!create_accession_wf)
|
287
|
+
workflow_resource[uri].post ''
|
288
|
+
return true
|
289
|
+
end
|
290
|
+
|
278
291
|
def workflow_resource
|
279
292
|
raise "Please call Dor::WorkflowService.configure(url) once before calling any WorkflowService methods" if(@@resource.nil?)
|
280
293
|
@@resource
|
data/lib/dor/workflow_version.rb
CHANGED
@@ -261,4 +261,18 @@ describe Dor::WorkflowService do
|
|
261
261
|
end
|
262
262
|
end
|
263
263
|
|
264
|
+
describe "#close_version" do
|
265
|
+
it "calls the versionClose endpoint with druid" do
|
266
|
+
@mock_resource.should_receive(:[]).with("dor/objects/druid:123/versionClose").and_return(@mock_resource)
|
267
|
+
@mock_resource.should_receive(:post).with('').and_return('')
|
268
|
+
Dor::WorkflowService.close_version(@repo, @druid)
|
269
|
+
end
|
270
|
+
|
271
|
+
it "optionally prevents creation of accessionWF" do
|
272
|
+
@mock_resource.should_receive(:[]).with("dor/objects/druid:123/versionClose?create-accession=false").and_return(@mock_resource)
|
273
|
+
@mock_resource.should_receive(:post).with('').and_return('')
|
274
|
+
Dor::WorkflowService.close_version(@repo, @druid, false)
|
275
|
+
end
|
276
|
+
end
|
277
|
+
|
264
278
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dor-workflow-service
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2014-02-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|