dor-workflow-client 3.24.0 → 5.0.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.
@@ -11,59 +11,35 @@ module Dor
11
11
 
12
12
  # Returns all the distinct laneIds for a given workflow step
13
13
  #
14
- # @param [String] repo -- deprecated, ignored by workflow service
15
14
  # @param [String] workflow name
16
15
  # @param [String] process name
17
16
  # @return [Array<String>] all of the distinct laneIds. Array will be empty if no lane ids were found
18
- def lane_ids(*args)
19
- if args.count == 3
20
- Deprecation.warn(
21
- self,
22
- '`#lane_ids` only takes two args: workflow name, & process/step name. This will raise an exception in Dor::Workflow::Client 4.0.0'
23
- )
24
- args.shift # ditch the `repo` argument
25
- end
26
- uri = "workflow_queue/lane_ids?step=#{args.first}:#{args.second}"
17
+ def lane_ids(workflow, process)
18
+ uri = "workflow_queue/lane_ids?step=#{workflow}:#{process}"
27
19
  doc = Nokogiri::XML(requestor.request(uri))
28
20
  doc.xpath('/lanes/lane').map { |n| n['id'] }
29
21
  end
30
22
 
31
23
  # Gets all of the workflow steps that have a status of 'queued' that have a last-updated timestamp older than the number of hours passed in
32
24
  # This will enable re-queueing of jobs that have been lost by the job manager
33
- # @param [String] repository -- deprecated, ignored by workflow service
34
25
  # @param [Hash] opts optional values for query
35
26
  # @option opts [Integer] :hours_ago steps older than this value will be returned by the query. If not passed in, the service defaults to 0 hours,
36
27
  # meaning you will get all queued workflows
37
28
  # @option opts [Integer] :limit sets the maximum number of workflow steps that can be returned. Defaults to no limit
38
29
  # @return [Array[Hash]] each Hash represents a workflow step. It will have the following keys:
39
30
  # :workflow, :step, :druid, :lane_id
40
- def stale_queued_workflows(*args)
41
- if args.count == 2
42
- Deprecation.warn(
43
- self,
44
- '`#stale_queued_workflows` only takes one arg: a hash. This will raise an exception in Dor::Workflow::Client 4.0.0'
45
- )
46
- args.shift # ditch the `repo` argument
47
- end
48
- uri_string = build_queued_uri(args.first)
31
+ def stale_queued_workflows(opts)
32
+ uri_string = build_queued_uri(opts)
49
33
  parse_queued_workflows_response requestor.request(uri_string)
50
34
  end
51
35
 
52
36
  # Returns a count of workflow steps that have a status of 'queued' that have a last-updated timestamp older than the number of hours passed in
53
- # @param [String] repository -- deprecated, ignored by workflow service
54
37
  # @param [Hash] opts optional values for query
55
38
  # @option opts [Integer] :hours_ago steps older than this value will be returned by the query. If not passed in, the service defaults to 0 hours,
56
39
  # meaning you will get all queued workflows
57
40
  # @return [Integer] number of stale, queued steps if the :count_only option was set to true
58
- def count_stale_queued_workflows(*args)
59
- if args.count == 2
60
- Deprecation.warn(
61
- self,
62
- '`#count_stale_queued_workflows` only takes one arg: a hash. This will raise an exception in Dor::Workflow::Client 4.0.0'
63
- )
64
- args.shift # ditch the `repo` argument
65
- end
66
- uri_string = build_queued_uri(args.first) + '&count-only=true'
41
+ def count_stale_queued_workflows(opts)
42
+ uri_string = "#{build_queued_uri(opts)}&count-only=true"
67
43
  doc = Nokogiri::XML(requestor.request(uri_string))
68
44
  doc.at_xpath('/objects/@count').value.to_i
69
45
  end
@@ -102,7 +78,6 @@ module Dor
102
78
  # }
103
79
  #
104
80
  def objects_for_workstep(completed, waiting, lane_id = 'default', options = {})
105
- Deprecation.warn(self, 'the `:default_repository` option in `#objects_for_workstep` is unused and will go away in Dor::Workflow::Client 4.0.0. omit argument to silence.') if options[:default_repository]
106
81
  waiting_param = qualify_step(options[:default_workflow], waiting)
107
82
  uri_string = "workflow_queue?waiting=#{waiting_param}"
108
83
  if completed
@@ -133,19 +108,17 @@ module Dor
133
108
  #
134
109
  # @param [String] workflow name
135
110
  # @param [String] step name
136
- # @param [String] repository -- deprecated, ignored by workflow service
137
111
  #
138
112
  # @return [Hash] hash of results, with key has a druid, and value as the error message
139
113
  # @example
140
114
  # client.errored_objects_for_workstep('accessionWF','content-metadata')
141
115
  # => {"druid:qd556jq0580"=>"druid:qd556jq0580 - Item error; caused by
142
- # #<Rubydora::FedoraInvalidRequest: Error modifying datastream contentMetadata for druid:qd556jq0580. See logger for details>"}
143
- def errored_objects_for_workstep(workflow, step, repository = nil)
144
- Deprecation.warn(self, 'the third argument to `#errored_objects_for_workstep` is unused and will go away in Dor::Workflow::Client 4.0.0. omit argument to silence.') unless repository.nil?
116
+ # blah blah. See logger for details>"}
117
+ def errored_objects_for_workstep(workflow, step)
145
118
  resp = requestor.request "workflow_queue?workflow=#{workflow}&error=#{step}"
146
- Nokogiri::XML(resp).xpath('//object').map do |node|
119
+ Nokogiri::XML(resp).xpath('//object').to_h do |node|
147
120
  [node['id'], node['errorMessage']]
148
- end.to_h
121
+ end
149
122
  end
150
123
 
151
124
  # Used by preservation robots stats reporter
@@ -153,11 +126,9 @@ module Dor
153
126
  # @param [String] workflow name
154
127
  # @param [String] step name
155
128
  # @param [String] type
156
- # @param [String] repo -- deprecated, ignored by workflow service
157
129
  #
158
130
  # @return [Hash] hash of results, with key has a druid, and value as the error message
159
- def count_objects_in_step(workflow, step, type, repo = nil)
160
- Deprecation.warn(self, 'the fourth argument to `#count_objects_in_step` is unused and will go away in Dor::Workflow::Client 4.0.0. omit argument to silence.') unless repo.nil?
131
+ def count_objects_in_step(workflow, step, type)
161
132
  resp = requestor.request "workflow_queue?workflow=#{workflow}&#{type}=#{step}"
162
133
  extract_object_count(resp)
163
134
  end
@@ -166,11 +137,9 @@ module Dor
166
137
  #
167
138
  # @param [String] workflow name
168
139
  # @param [String] step name
169
- # @param [String] repository -- deprecated, ignored by workflow service
170
140
  #
171
141
  # @return [Integer] Number of objects with this repository:workflow:step that have a status of 'error'
172
- def count_errored_for_workstep(workflow, step, repository = nil)
173
- Deprecation.warn(self, 'the third argument to `#count_errored_for_workstep` is unused and will go away in Dor::Workflow::Client 4.0.0. omit argument to silence.') unless repository.nil?
142
+ def count_errored_for_workstep(workflow, step)
174
143
  count_objects_in_step(workflow, step, 'error')
175
144
  end
176
145
 
@@ -178,11 +147,9 @@ module Dor
178
147
  #
179
148
  # @param [String] workflow name
180
149
  # @param [String] step name
181
- # @param [String] repository -- deprecated, ignored by workflow service
182
150
  #
183
151
  # @return [Integer] Number of objects with this repository:workflow:step that have a status of 'queued'
184
- def count_queued_for_workstep(workflow, step, repository = nil)
185
- Deprecation.warn(self, 'the third argument to `#count_queued_for_workstep` is unused and will go away in Dor::Workflow::Client 4.0.0. omit argument to silence.') unless repository.nil?
152
+ def count_queued_for_workstep(workflow, step)
186
153
  count_objects_in_step(workflow, step, 'queued')
187
154
  end
188
155
 
@@ -42,7 +42,6 @@ module Dor
42
42
  end
43
43
 
44
44
  # @return [Hash{Symbol => Object}] including :status_code and :status_time
45
- # rubocop:disable Metrics/MethodLength
46
45
  def info
47
46
  @info ||= begin
48
47
  # if we have an accessioned milestone, this is the last possible step and should be the status regardless of time stamp
@@ -64,7 +63,6 @@ module Dor
64
63
  { status_code: status_code, status_time: status_time }
65
64
  end
66
65
  end
67
- # rubocop:enable Metrics/MethodLength
68
66
 
69
67
  def status_code
70
68
  info.fetch(:status_code)
@@ -3,7 +3,7 @@
3
3
  module Dor
4
4
  module Workflow
5
5
  class Client
6
- VERSION = '3.24.0'
6
+ VERSION = '5.0.0'
7
7
  end
8
8
  end
9
9
  end
@@ -17,32 +17,10 @@ module Dor
17
17
  # @param [String] repo The repository the object resides in. This parameter is deprecated
18
18
  # @param [String] druid The id of the object to delete the workflow from
19
19
  # @param [Boolean] create_accession_wf Option to create accessionWF when closing a version. Defaults to true
20
- # rubocop:disable Metrics/MethodLength
21
- def close_version(*args)
22
- case args.size
23
- when 3
24
- Deprecation.warn(self, 'you provided 3 args, but close_version now takes kwargs')
25
- (repo, druid, create_accession_wf) = args
26
- when 2
27
- Deprecation.warn(self, 'you provided 2 args, but close_version now takes kwargs')
28
- (repo, druid) = args
29
- create_accession_wf = true
30
- when 1
31
- opts = args.first
32
- repo = opts[:repo]
33
- druid = opts[:druid]
34
- version = opts[:version]
35
- create_accession_wf = opts.key?(:create_accession_wf) ? opts[:create_accession_wf] : true
36
- else
37
- raise ArgumentError, 'wrong number of arguments, must be 1-3'
38
- end
39
-
40
- Deprecation.warn(self, 'passing the repo parameter to close_version is no longer necessary. This will raise an error in dor-workflow-client version 4') if repo
41
-
20
+ def close_version(druid:, version:, create_accession_wf: true)
42
21
  requestor.request(construct_url(druid, version, create_accession_wf), 'post', '')
43
22
  true
44
23
  end
45
- # rubocop:enable Metrics/MethodLength
46
24
 
47
25
  private
48
26
 
@@ -4,31 +4,13 @@ module Dor
4
4
  module Workflow
5
5
  class Client
6
6
  # Makes requests relating to a workflow
7
- # rubocop:disable Metrics/ClassLength
8
7
  class WorkflowRoutes
9
- extend Deprecation
10
-
11
8
  def initialize(requestor:)
12
9
  @requestor = requestor
13
10
  end
14
11
 
15
- # This method is deprecated and calls create_workflow_by_name.
16
- #
17
- # @param [String] repo Ignored
18
- # @param [String] druid The id of the object
19
- # @param [String] workflow_name The name of the workflow you want to create
20
- # @param [String] wf_xml Ignored
21
- # @param [Hash] opts optional params
22
- # @option opts [String] :lane_id adds laneId attribute to all process elements in the wf_xml workflow xml. Defaults to a value of 'default'
23
- # @return [Boolean] always true
24
- #
25
- def create_workflow(_repo, druid, workflow_name, _wf_xml, opts = {})
26
- create_workflow_by_name(druid, workflow_name, opts)
27
- end
28
- deprecation_deprecate create_workflow: 'use create_workflow_by_name instead'
29
-
30
12
  # Creates a workflow for a given object in the repository. If this particular workflow for this objects exists,
31
- # it will replace the old workflow. You have the option of creating a datastream or not.
13
+ # it will replace the old workflow.
32
14
  # Returns true on success. Caller must handle any exceptions.
33
15
  #
34
16
  # @param [String] druid The id of the object
@@ -38,13 +20,8 @@ module Dor
38
20
  # @param [Integer] version specifies the version so that workflow service doesn't need to query dor-services.
39
21
  # @return [Boolean] always true
40
22
  #
41
- def create_workflow_by_name(druid, workflow_name, version: nil, lane_id: 'default')
42
- params = { 'lane-id' => lane_id }
43
- if version
44
- params['version'] = version
45
- else
46
- Deprecation.warn(self, 'Calling create_workflow_by_name without passing version is deprecated and will result in an error in dor-workflow-client 4.0')
47
- end
23
+ def create_workflow_by_name(druid, workflow_name, version:, lane_id: 'default')
24
+ params = { 'lane-id' => lane_id, 'version' => version }
48
25
  requestor.request "objects/#{druid}/workflows/#{workflow_name}", 'post', '',
49
26
  content_type: 'application/xml',
50
27
  params: params
@@ -82,41 +59,6 @@ module Dor
82
59
  Workflow::Response::Update.new(json: response)
83
60
  end
84
61
 
85
- # Updates the status of one step in a workflow.
86
- # Returns true on success. Caller must handle any exceptions
87
- #
88
- # @param [String] repo The repository the object resides in. The service recoginzes "dor" and "sdr" at the moment
89
- # @param [String] druid The id of the object
90
- # @param [String] workflow The name of the workflow
91
- # @param [String] process The name of the process step
92
- # @param [String] status The status that you want to set -- using one of the values in VALID_STATUS
93
- # @param [Hash] opts optional values for the workflow step
94
- # @option opts [Float] :elapsed The number of seconds it took to complete this step. Can have a decimal. Is set to 0 if not passed in.
95
- # @option opts [String] :lifecycle Bookeeping label for this particular workflow step. Examples are: 'registered', 'shelved'
96
- # @option opts [String] :note Any kind of string annotation that you want to attach to the workflow
97
- # @option opts [String] :lane_id Id of processing lane used by the job manager. Can convey priority or name of an applicaiton specific processing lane (e.g. 'high', 'critical', 'hydrus')
98
- # @option opts [String] :current_status Setting this string tells the workflow service to compare the current status to this value. If the current value does not match this value, the update is not performed
99
- # @return [Boolean] always true
100
- # Http Call
101
- # ==
102
- # The method does an HTTP PUT to the base URL. As an example:
103
- #
104
- # PUT "/dor/objects/pid:123/workflows/GoogleScannedWF/convert"
105
- # <process name=\"convert\" status=\"completed\" />"
106
- def update_workflow_status(repo, druid, workflow, process, status, opts = {})
107
- raise ArgumentError, "Unknown status value #{status}" unless VALID_STATUS.include?(status.downcase)
108
-
109
- opts = { elapsed: 0, lifecycle: nil, note: nil }.merge!(opts)
110
- opts[:elapsed] = opts[:elapsed].to_s
111
- current_status = opts.delete(:current_status)
112
- xml = create_process_xml({ name: process, status: status.downcase }.merge!(opts))
113
- uri = "#{repo}/objects/#{druid}/workflows/#{workflow}/#{process}"
114
- uri += "?current-status=#{current_status.downcase}" if current_status
115
- response = requestor.request(uri, 'put', xml, content_type: 'application/xml')
116
- Workflow::Response::Update.new(json: response)
117
- end
118
- deprecation_deprecate update_workflow_status: 'use update_status instead.'
119
-
120
62
  #
121
63
  # Retrieves the process status of the given workflow for the given object identifier
122
64
  # @param [String] repo The repository the object resides in. Currently recoginzes "dor" and "sdr".
@@ -124,21 +66,7 @@ module Dor
124
66
  # @param [String] workflow The name of the workflow
125
67
  # @param [String] process The name of the process step
126
68
  # @return [String] status for repo-workflow-process-druid
127
- # rubocop:disable Metrics/MethodLength
128
- # rubocop:disable Metrics/AbcSize
129
- def workflow_status(*args)
130
- case args.length
131
- when 4
132
- Deprecation.warn(self, 'Calling workflow_status with positional args is deprecated, use kwargs instead')
133
- (_repo, druid, workflow, process) = *args
134
- when 1
135
- opts = args.first
136
- repo = opts[:repo]
137
- Deprecation.warn(self, 'Passing `:repo` to workflow_status is deprecated and can be omitted') if repo
138
- druid = opts[:druid]
139
- workflow = opts[:workflow]
140
- process = opts[:process]
141
- end
69
+ def workflow_status(druid:, workflow:, process:)
142
70
  workflow_md = fetch_workflow(druid: druid, workflow: workflow)
143
71
  doc = Nokogiri::XML(workflow_md)
144
72
  raise Dor::WorkflowException, "Unable to parse response:\n#{workflow_md}" if doc.root.nil?
@@ -147,61 +75,6 @@ module Dor
147
75
  process = processes.max { |a, b| a.attr('version').to_i <=> b.attr('version').to_i }
148
76
  process&.attr('status')
149
77
  end
150
- # rubocop:enable Metrics/AbcSize
151
- # rubocop:enable Metrics/MethodLength
152
-
153
- #
154
- # Retrieves the raw XML for the given workflow
155
- # @param [String] repo The repository the object resides in. Currently recoginzes "dor" and "sdr".
156
- # @param [String] druid The id of the object
157
- # @param [String] workflow The name of the workflow
158
- # @return [String] XML of the workflow
159
- # rubocop:disable Metrics/MethodLength
160
- def workflow_xml(*args)
161
- case args.length
162
- when 3
163
- Deprecation.warn(self, 'Calling workflow_xml with positional args is deprecated, use kwargs instead')
164
- (repo, druid, workflow) = *args
165
- when 1
166
- opts = args.first
167
- repo = opts[:repo]
168
- Deprecation.warn(self, 'Passing `:repo` to workflow_xml is deprecated and can be omitted') if repo
169
- druid = opts[:druid]
170
- workflow = opts[:workflow]
171
- end
172
-
173
- raise ArgumentError, 'missing workflow' unless workflow
174
- return requestor.request "#{repo}/objects/#{druid}/workflows/#{workflow}" if repo
175
-
176
- fetch_workflow(druid: druid, workflow: workflow)
177
- end
178
- deprecation_deprecate workflow_xml: 'workflow_xml will not be replaced'
179
-
180
- # rubocop:enable Metrics/MethodLength
181
-
182
- # Updates the status of one step in a workflow to error.
183
- # Returns true on success. Caller must handle any exceptions
184
- #
185
- # @param [String] _repo The repository the object resides in. The service recoginzes "dor" and "sdr" at the moment
186
- # @param [String] druid The id of the object
187
- # @param [String] workflow The name of the workflow
188
- # @param [String] process The name of the workflow step
189
- # @param [String] error_msg The error message. Ideally, this is a brief message describing the error
190
- # @param [Hash] opts optional values for the workflow step
191
- # @option opts [String] :error_text A slot to hold more information about the error, like a full stacktrace
192
- # @return [Boolean] always true
193
- #
194
- # Http Call
195
- # ==
196
- # The method does an HTTP PUT to the base URL.
197
- #
198
- # PUT "/objects/pid:123/workflows/GoogleScannedWF/convert"
199
- # <process name=\"convert\" status=\"error\" />"
200
- def update_workflow_error_status(_repo, druid, workflow, process, error_msg, opts = {})
201
- update_error_status(druid: druid, workflow: workflow, process: process, error_msg: error_msg, error_text: opts[:error_text])
202
- true
203
- end
204
- deprecation_deprecate update_workflow_error_status: 'use update_error_status instead.'
205
78
 
206
79
  # Updates the status of one step in a workflow to error.
207
80
  # Returns true on success. Caller must handle any exceptions
@@ -245,23 +118,19 @@ module Dor
245
118
  # This method only works when this gem is used in a project that is configured to connect to DOR
246
119
  #
247
120
  # @param [String] pid of druid
248
- # @param [String] repo repository for the object
249
121
  # @return [Array<String>] list of worklows
250
122
  # @example
251
123
  # client.workflows('druid:sr100hp0609')
252
124
  # => ["accessionWF", "assemblyWF", "disseminationWF"]
253
- def workflows(pid, repo = nil)
254
- Deprecation.warn(self, 'Passing the second argument (repo) to workflows is deprecated and can be omitted') if repo
125
+ def workflows(pid)
255
126
  xml_doc = Nokogiri::XML(fetch_workflow(druid: pid, workflow: ''))
256
127
  xml_doc.xpath('//workflow').collect { |workflow| workflow['id'] }
257
128
  end
258
129
 
259
- # @param [String] repo repository of the object
260
130
  # @param [String] pid id of object
261
131
  # @param [String] workflow_name The name of the workflow
262
132
  # @return [Workflow::Response::Workflow]
263
- def workflow(repo: nil, pid:, workflow_name:)
264
- Deprecation.warn(self, 'passing the repo parameter is deprecated and will be removed in the next major versions') if repo
133
+ def workflow(pid:, workflow_name:)
265
134
  xml = fetch_workflow(druid: pid, workflow: workflow_name)
266
135
  Workflow::Response::Workflow.new(xml: xml)
267
136
  end
@@ -275,19 +144,13 @@ module Dor
275
144
  end
276
145
 
277
146
  # Deletes a workflow from a particular repository and druid. This is only used by Hydrus.
278
- # @param [String] repo The repository the object resides in. The service recoginzes "dor" and "sdr" at the moment
279
147
  # @param [String] druid The id of the object to delete the workflow from
280
148
  # @param [String] workflow The name of the workflow to be deleted
281
149
  # @param [Integer] version The version of the workflow to delete
282
150
  # @return [Boolean] always true
283
- def delete_workflow(repo, druid, workflow, version: nil)
284
- qs_args = if version
285
- "?version=#{version}"
286
- else
287
- Deprecation.warn(self, 'Calling delete_workflow without passing version is deprecated and will result in an error in dor-workflow-client 4.0')
288
- ''
289
- end
290
- requestor.request "#{repo}/objects/#{druid}/workflows/#{workflow}#{qs_args}", 'delete'
151
+ def delete_workflow(druid:, workflow:, version:)
152
+ qs_args = "?version=#{version}"
153
+ requestor.request "/objects/#{druid}/workflows/#{workflow}#{qs_args}", 'delete'
291
154
  true
292
155
  end
293
156
 
@@ -313,14 +176,13 @@ module Dor
313
176
  # @return [String]
314
177
  def create_process_xml(params)
315
178
  builder = Nokogiri::XML::Builder.new do |xml|
316
- attrs = params.reject { |_k, v| v.nil? }
317
- attrs = Hash[attrs.map { |k, v| [k.to_s.camelize(:lower), v] }] # camelize all the keys in the attrs hash
179
+ attrs = params.compact
180
+ attrs = attrs.transform_keys { |k| k.to_s.camelize(:lower) } # camelize all the keys in the attrs hash
318
181
  xml.process(attrs)
319
182
  end
320
183
  builder.to_xml
321
184
  end
322
185
  end
323
- # rubocop:enable Metrics/ClassLength
324
186
  end
325
187
  end
326
188
  end
@@ -5,6 +5,7 @@ require 'active_support/core_ext'
5
5
  require 'nokogiri'
6
6
  require 'zeitwerk'
7
7
  require 'faraday'
8
+ require 'faraday/retry'
8
9
  require 'deprecation'
9
10
 
10
11
  loader = Zeitwerk::Loader.new
@@ -39,8 +40,7 @@ module Dor
39
40
  @requestor = Requestor.new(connection: connection || ConnectionFactory.build_connection(url, timeout: timeout, logger: logger))
40
41
  end
41
42
 
42
- delegate :create_workflow, :create_workflow_by_name, :update_workflow_status, :workflow_status,
43
- :workflow_xml, :update_workflow_error_status, :all_workflows_xml, :workflows,
43
+ delegate :create_workflow_by_name, :workflow_status, :all_workflows_xml, :workflows,
44
44
  :workflow, :process, :delete_workflow, :delete_all_workflows, :update_status, :update_error_status,
45
45
  to: :workflow_routes
46
46
 
@@ -51,8 +51,7 @@ module Dor
51
51
  @attributes[:laneId].presence
52
52
  end
53
53
 
54
- delegate :pid, :workflow_name, :repository, to: :parent
55
- deprecation_deprecate :repository
54
+ delegate :pid, :workflow_name, to: :parent
56
55
 
57
56
  private
58
57
 
@@ -5,9 +5,6 @@ module Dor
5
5
  module Response
6
6
  # The response from asking the server about a workflow for an item
7
7
  class Workflow
8
- extend Deprecation
9
- self.deprecation_horizon = '4.x'
10
-
11
8
  def initialize(xml:)
12
9
  @xml = xml
13
10
  end
@@ -20,11 +17,6 @@ module Dor
20
17
  workflow['id']
21
18
  end
22
19
 
23
- def repository
24
- workflow['repository']
25
- end
26
- deprecation_deprecate :repository
27
-
28
20
  # @param [Integer] version the version we are checking for.
29
21
  def active_for?(version:)
30
22
  result = ng_xml.at_xpath("/workflow/process[@version=#{version}]")
@@ -35,7 +27,7 @@ module Dor
35
27
  def process_for_recent_version(name:)
36
28
  nodes = process_nodes_for(name: name)
37
29
  node = nodes.max { |a, b| a.attr('version').to_i <=> b.attr('version').to_i }
38
- attributes = node ? Hash[node.attributes.collect { |k, v| [k.to_sym, v.value] }] : {}
30
+ attributes = node ? node.attributes.to_h { |k, v| [k.to_sym, v.value] } : {}
39
31
  Process.new(parent: self, **attributes)
40
32
  end
41
33
 
@@ -32,23 +32,6 @@ RSpec.describe Dor::Workflow::Response::Process do
32
32
  it { is_expected.to eq 'assemblyWF' }
33
33
  end
34
34
 
35
- describe '#repository' do
36
- before do
37
- allow(Deprecation).to receive(:warn)
38
- end
39
-
40
- subject { instance.repository }
41
-
42
- let(:xml) do
43
- <<~XML
44
- <workflow repository="dor" objectId="druid:mw971zk1113" id="assemblyWF">
45
- <process name="start-assembly">
46
- </workflow>
47
- XML
48
- end
49
- it { is_expected.to eq 'dor' }
50
- end
51
-
52
35
  describe '#name' do
53
36
  subject { instance.name }
54
37
 
@@ -29,22 +29,6 @@ RSpec.describe Dor::Workflow::Response::Workflow do
29
29
  it { is_expected.to eq 'assemblyWF' }
30
30
  end
31
31
 
32
- describe '#repository' do
33
- subject { instance.repository }
34
-
35
- before do
36
- allow(Deprecation).to receive(:warn)
37
- end
38
-
39
- let(:xml) do
40
- <<~XML
41
- <workflow repository="dor" objectId="druid:mw971zk1113" id="assemblyWF">
42
- </workflow>
43
- XML
44
- end
45
- it { is_expected.to eq 'dor' }
46
- end
47
-
48
32
  describe '#complete?' do
49
33
  subject { instance.complete? }
50
34
  context 'when all steps are complete' do
@@ -72,7 +56,7 @@ RSpec.describe Dor::Workflow::Response::Workflow do
72
56
  end
73
57
  end
74
58
 
75
- describe '#active?' do
59
+ describe '#active_for?' do
76
60
  subject { instance.active_for?(version: 2) }
77
61
 
78
62
  context 'when the workflow has not been instantiated for the given version' do