Class: Dor::Workflow::Client::LifecycleRoutes
- Inherits:
-
Object
- Object
- Dor::Workflow::Client::LifecycleRoutes
- Defined in:
- lib/dor/workflow/client/lifecycle_routes.rb
Overview
Makes requests relating to a lifecycle
Instance Method Summary collapse
-
#active_lifecycle(repo, druid, milestone_name) ⇒ Time
Returns the Date for a requested milestone ONLY FROM THE ACTIVE workflow table.
-
#initialize(requestor:) ⇒ LifecycleRoutes
constructor
A new instance of LifecycleRoutes.
-
#lifecycle(repo, druid, milestone_name) ⇒ Time
Returns the Date for a requested milestone from workflow lifecycle.
- #milestones(repo, druid) ⇒ Hash
Constructor Details
#initialize(requestor:) ⇒ LifecycleRoutes
Returns a new instance of LifecycleRoutes.
8 9 10 |
# File 'lib/dor/workflow/client/lifecycle_routes.rb', line 8 def initialize(requestor:) @requestor = requestor end |
Instance Method Details
#active_lifecycle(repo, druid, milestone_name) ⇒ Time
Returns the Date for a requested milestone ONLY FROM THE ACTIVE workflow table
28 29 30 |
# File 'lib/dor/workflow/client/lifecycle_routes.rb', line 28 def active_lifecycle(repo, druid, milestone_name) filter_milestone(query_lifecycle(repo, druid, true), milestone_name) end |
#lifecycle(repo, druid, milestone_name) ⇒ Time
Returns the Date for a requested milestone from workflow lifecycle
18 19 20 |
# File 'lib/dor/workflow/client/lifecycle_routes.rb', line 18 def lifecycle(repo, druid, milestone_name) filter_milestone(query_lifecycle(repo, druid), milestone_name) end |
#milestones(repo, druid) ⇒ Hash
33 34 35 36 37 38 |
# File 'lib/dor/workflow/client/lifecycle_routes.rb', line 33 def milestones(repo, druid) doc = query_lifecycle(repo, druid) doc.xpath('//lifecycle/milestone').collect do |node| { milestone: node.text, at: Time.parse(node['date']), version: node['version'] } end end |