Sha256: b3034a326c7e58dca9f664ef8ccfeb90e8a609388bff037da59a44f339bdb282

Contents?: true

Size: 843 Bytes

Versions: 5

Compression:

Stored size: 843 Bytes

Contents

# frozen_string_literal: true

module Dor
  module Workflow
    class Client
      # Makes requests relating to a workflow template
      class WorkflowTemplate
        def initialize(requestor:)
          @requestor = requestor
        end

        # Retrieves a representation of the workflow template
        #
        # @param [String] workflow_name The name of the workflow you want to retrieve
        # @return [Hash] a representation of the workflow template
        # @example:
        #   retrieve('assemblyWF') => '{"processes":[{"name":"start-assembly"},{"name":"content-metadata-create"},...]}'
        #
        def retrieve(workflow_name)
          body = requestor.request "workflow_templates/#{workflow_name}"
          JSON.parse(body)
        end

        private

        attr_reader :requestor
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
dor-workflow-client-7.0.0 lib/dor/workflow/client/workflow_template.rb
dor-workflow-client-3.8.0 lib/dor/workflow/client/workflow_template.rb
dor-workflow-client-3.7.0 lib/dor/workflow/client/workflow_template.rb
dor-workflow-client-3.6.0 lib/dor/workflow/client/workflow_template.rb
dor-workflow-client-3.5.0 lib/dor/workflow/client/workflow_template.rb