Class: Dor::Workflow::Client::WorkflowTemplate
- Inherits:
-
Object
- Object
- Dor::Workflow::Client::WorkflowTemplate
- Defined in:
- lib/dor/workflow/client/workflow_template.rb
Overview
Makes requests relating to a workflow template
Instance Method Summary collapse
-
#all ⇒ Array<String>
Retrieves a list of workflow template name.
-
#initialize(requestor:) ⇒ WorkflowTemplate
constructor
A new instance of WorkflowTemplate.
-
#retrieve(workflow_name) ⇒ Hash
Retrieves a representation of the workflow template.
Constructor Details
#initialize(requestor:) ⇒ WorkflowTemplate
Returns a new instance of WorkflowTemplate.
8 9 10 |
# File 'lib/dor/workflow/client/workflow_template.rb', line 8 def initialize(requestor:) @requestor = requestor end |
Instance Method Details
#all ⇒ Array<String>
Retrieves a list of workflow template name
28 29 30 31 |
# File 'lib/dor/workflow/client/workflow_template.rb', line 28 def all body = requestor.request 'workflow_templates' JSON.parse(body) end |
#retrieve(workflow_name) ⇒ Hash
Retrieves a representation of the workflow template
@example: retrieve('assemblyWF') => '"processes":[{"name":"start-assembly","name":"content-metadata-create",...]}'
19 20 21 22 |
# File 'lib/dor/workflow/client/workflow_template.rb', line 19 def retrieve(workflow_name) body = requestor.request "workflow_templates/#{workflow_name}" JSON.parse(body) end |