Sha256: 29465b771d1411a98212f540dee0abaf4f6b08ee0e2c93162b0ee02e4e9516cd

Contents?: true

Size: 1.78 KB

Versions: 15

Compression:

Stored size: 1.78 KB

Contents

# frozen_string_literal: true

module Dor
  module Services
    class Client
      # API calls that are about starting accessioning on a repository object
      class Accession < VersionedService
        # @param connection [Faraday::Connection] an HTTP connection to dor-services-app
        # @param version [String] id for the version of the API call
        # @param object_identifier [String] the pid for the object
        def initialize(connection:, version:, object_identifier:)
          super(connection: connection, version: version)
          @object_identifier = object_identifier
        end

        # Start accession on an object (start specified workflow, assemblyWF by default, and version if needed)
        # @param params [Hash<Symbol,String>] optional parameter hash
        # @option params [String] :significance set significance (major/minor/patch) of version change - required
        # @option params [String] :description set description of version change - required
        # @option params [String] :opening_user_name add opening username to the event - optional
        # @option params [String] :workflow the workflow to start - defaults to 'assemblyWF'
        # @return [Boolean] true on success
        # @raise [NotFoundResponse] when the response is a 404 (object not found)
        # @raise [UnexpectedResponse] when the response is not successful.
        def start(params = {})
          resp = connection.post do |req|
            req.url with_querystring(url: path, params: params)
          end
          return true if resp.success?

          raise_exception_based_on_response!(resp)
        end

        private

        attr_reader :object_identifier

        def path
          "#{api_version}/objects/#{object_identifier}/accession"
        end
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
dor-services-client-14.4.0 lib/dor/services/client/accession.rb
dor-services-client-14.3.0 lib/dor/services/client/accession.rb
dor-services-client-14.2.1 lib/dor/services/client/accession.rb
dor-services-client-14.2.0 lib/dor/services/client/accession.rb
dor-services-client-14.1.0 lib/dor/services/client/accession.rb
dor-services-client-14.0.0 lib/dor/services/client/accession.rb
dor-services-client-13.4.0 lib/dor/services/client/accession.rb
dor-services-client-13.3.0 lib/dor/services/client/accession.rb
dor-services-client-13.2.0 lib/dor/services/client/accession.rb
dor-services-client-13.1.1 lib/dor/services/client/accession.rb
dor-services-client-13.1.0 lib/dor/services/client/accession.rb
dor-services-client-13.0.1 lib/dor/services/client/accession.rb
dor-services-client-13.0.0 lib/dor/services/client/accession.rb
dor-services-client-12.18.0 lib/dor/services/client/accession.rb
dor-services-client-12.17.0 lib/dor/services/client/accession.rb