dor-workflow-client 3.9.0 → 3.10.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 103d448136015a1fcfe0742a1804ac0d883106071ca53472ccf8e0671b158e11
4
- data.tar.gz: b94093ac940a33c03dca26685ef808322d07f1430b61769414aabfbb6203587f
3
+ metadata.gz: 357ae42f561bd2a83ecd8250dc767b3426c0817d651fe38da5c81879d8bfbfc4
4
+ data.tar.gz: a6696a3639a6eaea0aa37b101d752f89a70104027f68473852e3a0f35432c1a5
5
5
  SHA512:
6
- metadata.gz: 75b52575766b05e2645d800203e18e6f2ffe2929be1de46b00c31b36712246280ae35332102d4675e642e74dbc8076f675df9a2fdc7d9f547c599cad4ee50134
7
- data.tar.gz: 55279fcdcb43e241a3f368290b2d86c896956a7962a2bb2506c8b01f02533c5b6690545a7de675865d1323d58a03d34e928dc758c61dd8733727c04e2d2b4ed0
6
+ metadata.gz: cf907f6f4995caa88e19e06f0bf39e3a7ba54ce8515c106b69fc39c31f365d55de4de20afc673f9827f3264eeedb0dab8a804783853f6da3d9f025c0c9ac6bc4
7
+ data.tar.gz: e135d69b3ab60c5518f58524f1aee09a086d54277a02f7e344e8028e9b47d0ce79b015a94a852f4b3ee039770a3a57488511029239c0890942348613e3bdb56d
data/README.md CHANGED
@@ -13,11 +13,36 @@ https://consul.stanford.edu/display/DOR/DOR+services#DORservices-initializeworkf
13
13
  You should initialize a `Dor::Workflow::Client` object in your application configuration, i.e. in a bootup or startup method like:
14
14
 
15
15
  ```ruby
16
- wfs = Dor::Workflow::Client.new(url: 'https://test-server.edu/workflow/')
16
+ client = Dor::Workflow::Client.new(url: 'https://test-server.edu/workflow/')
17
17
  ```
18
18
 
19
19
  Consumers of recent versions of the [dor-services](https://github.com/sul-dlss/dor-services) gem can access the configured `Dor::Workflow::Client` object via `Dor::Config`.
20
20
 
21
+ ## API
22
+
23
+ Create a workflow
24
+ ```
25
+ client.create_workflow_by_name('druid:bc123df4567', 'etdSubmitWF')
26
+ ```
27
+
28
+ Update a workflow step's status
29
+ ```
30
+ client.update_status(druid: 'druid:bc123df4567',
31
+ workflow: 'etdSubmitWF',
32
+ process: 'registrar-approval',
33
+ status: 'completed')
34
+ ```
35
+
36
+ List workflow templates
37
+ ```
38
+ client.workflow_templates
39
+ ```
40
+
41
+ Show a workflow template
42
+ ```
43
+ client.workflow_template('etdSubmitWF')
44
+ ```
45
+
21
46
  ## Underlying Clients
22
47
 
23
48
  This gem currently uses the [Faraday](https://github.com/lostisland/faraday) HTTP client to access the back-end service. The clients be accessed directly from your `Dor::Workflow::Client` object:
@@ -3,7 +3,7 @@
3
3
  module Dor
4
4
  module Workflow
5
5
  class Client
6
- VERSION = '3.9.0'
6
+ VERSION = '3.10.0'
7
7
  end
8
8
  end
9
9
  end
@@ -70,7 +70,15 @@ module Dor
70
70
  end
71
71
 
72
72
  def workflow_template(name)
73
- WorkflowTemplate.new(requestor: requestor).retrieve(name)
73
+ templates.retrieve(name)
74
+ end
75
+
76
+ def workflow_templates
77
+ templates.all
78
+ end
79
+
80
+ def templates
81
+ WorkflowTemplate.new(requestor: requestor)
74
82
  end
75
83
 
76
84
  private
@@ -207,6 +207,29 @@ RSpec.describe Dor::Workflow::Client do
207
207
  end
208
208
  end
209
209
 
210
+ describe '#workflow_templates' do
211
+ subject(:workflow_templates) { client.workflow_templates }
212
+
213
+ let(:workflow_template_client) { instance_double Dor::Workflow::Client::WorkflowTemplate, all: 'data' }
214
+
215
+ before do
216
+ allow(Dor::Workflow::Client::WorkflowTemplate).to receive(:new).and_return(workflow_template_client)
217
+ end
218
+
219
+ it 'delegates to the client' do
220
+ expect(workflow_templates).to eq 'data'
221
+ expect(workflow_template_client).to have_received(:all)
222
+ end
223
+ end
224
+
225
+ describe '#templates' do
226
+ subject(:templates) { client.templates }
227
+
228
+ it 'returns the template client' do
229
+ expect(templates).to be_instance_of Dor::Workflow::Client::WorkflowTemplate
230
+ end
231
+ end
232
+
210
233
  describe '#workflow_status' do
211
234
  let(:repo) { @repo }
212
235
  let(:druid) { @druid }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dor-workflow-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.9.0
4
+ version: 3.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Willy Mene
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-09-20 00:00:00.000000000 Z
12
+ date: 2019-09-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport