Class: Dor::Services::Client::ObjectWorkflows

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

Overview

API calls around workflows for an object.

Constant Summary

Constants inherited from VersionedService

VersionedService::EXCEPTION_CLASS, VersionedService::JSON_API_MIME_TYPE

Instance Method Summary collapse

Methods inherited from VersionedService

#async_result

Constructor Details

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

Returns a new instance of ObjectWorkflows.

Parameters:

  • object_identifier (String)

    the druid for the object



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

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

Instance Method Details

#listDor::Services::Response::Workflows

Retrieves all workflows for the given object



16
17
18
19
20
21
22
23
24
# File 'lib/dor/services/client/object_workflows.rb', line 16

def list
  resp = connection.get do |req|
    req.url "#{api_version}/objects/#{object_identifier}/workflows"
    req.headers['Accept'] = 'application/xml'
  end
  raise_exception_based_on_response!(resp) unless resp.success?

  Dor::Services::Response::Workflows.new(xml: Nokogiri::XML(resp.body))
end