Class: Dor::Workflow::Client::WorkflowTemplate

Inherits:
Object
  • Object
show all
Defined in:
lib/dor/workflow/client/workflow_template.rb

Overview

Makes requests relating to a workflow template

Instance Method Summary collapse

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

#allArray<String>

Retrieves a list of workflow template name

Returns:

  • (Array<String>)

    the list of templates



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",...]}'

Parameters:

  • workflow_name (String)

    The name of the workflow you want to retrieve

Returns:

  • (Hash)

    a representation of the workflow template



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