Class: Dor::Services::Client::Workflows

Inherits:
VersionedService show all
Defined in:
lib/dor/services/client/workflows.rb

Overview

API calls around workflows in DOR

Constant Summary

Constants inherited from VersionedService

VersionedService::EXCEPTION_CLASS, VersionedService::JSON_API_MIME_TYPE

Instance Method Summary collapse

Methods inherited from VersionedService

#async_result, #initialize

Constructor Details

This class inherits a constructor from Dor::Services::Client::VersionedService

Instance Method Details

#template(workflow_name) ⇒ Hash

Retrieves a workflow template given a workflow name

Returns:

  • (Hash)

    the set of processes within a template



22
23
24
25
26
27
28
29
30
# File 'lib/dor/services/client/workflows.rb', line 22

def template(workflow_name)
  resp = connection.get do |req|
    req.url "#{api_version}/workflow_templates/#{workflow_name}"
    req.headers['Accept'] = 'application/json'
  end
  raise_exception_based_on_response!(resp) unless resp.success?

  JSON.parse(resp.body)
end

#templatesArray<String>

Retrieves a list of workflow template name

Returns:

  • (Array<String>)

    the list of templates



10
11
12
13
14
15
16
17
18
# File 'lib/dor/services/client/workflows.rb', line 10

def templates
  resp = connection.get do |req|
    req.url "#{api_version}/workflow_templates"
    req.headers['Accept'] = 'application/json'
  end
  raise_exception_based_on_response!(resp) unless resp.success?

  JSON.parse(resp.body)
end