Class: Dor::Services::Client::Workflow

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

Overview

API calls that are about workflow

Instance Method Summary collapse

Constructor Details

#initialize(connection:, version:, object_identifier:) ⇒ Workflow

Returns a new instance of Workflow.

Parameters:

  • object_identifier (String)

    the pid for the object



9
10
11
12
# File 'lib/dor/services/client/workflow.rb', line 9

def initialize(connection:, version:, object_identifier:)
  super(connection: connection, version: version)
  @object_identifier = object_identifier
end

Instance Method Details

#create(wf_name:) ⇒ Object

Begin a new workflow

Parameters:

  • wf_name (String)

    the name of the workflow

Returns:

  • nil

Raises:



18
19
20
21
22
23
# File 'lib/dor/services/client/workflow.rb', line 18

def create(wf_name:)
  resp = connection.post do |req|
    req.url "#{api_version}/objects/#{object_identifier}/apo_workflows/#{wf_name}"
  end
  raise UnexpectedResponse, "#{resp.reason_phrase}: #{resp.status} (#{resp.body})" unless resp.success?
end