Sha256: 962e58747df08a77d1e902b5c5835162e68132669980206a61f9a48eb6e1819d

Contents?: true

Size: 784 Bytes

Versions: 2

Compression:

Stored size: 784 Bytes

Contents

# frozen_string_literal: true

module Dor
  module Services
    class Client
      # API calls that are about workflow
      class Workflow
        def initialize(connection:)
          @connection = connection
        end

        attr_reader :connection

        # Begin a new workflow
        # @param object [String] the pid for the object
        # @param wf_name [String] the name of the workflow
        # @raises [Error] if the request is unsuccessful.
        # @return nil
        def create(object:, wf_name:)
          resp = connection.post do |req|
            req.url "v1/objects/#{object}/apo_workflows/#{wf_name}"
          end
          raise Error, "#{resp.reason_phrase}: #{resp.status} (#{resp.body})" unless resp.success?
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dor-services-client-0.3.0 lib/dor/services/client/workflow.rb
dor-services-client-0.2.0 lib/dor/services/client/workflow.rb