Class: Dor::Services::Client::Accession

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

Overview

API calls that are about starting accessioning on a repository 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, #with_querystring

Constructor Details

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

Returns a new instance of Accession.

Parameters:

  • connection (Faraday::Connection)

    an HTTP connection to dor-services-app

  • version (String)

    id for the version of the API call

  • object_identifier (String)

    the pid for the object



11
12
13
14
# File 'lib/dor/services/client/accession.rb', line 11

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

Instance Method Details

#start(params = {}) ⇒ Boolean

Start accession on an object (start specified workflow, assemblyWF by default, and version if needed)

Parameters:

  • params (Hash<Symbol,String>) (defaults to: {})

    optional parameter hash

Options Hash (params):

  • :significance (String)

    set significance (major/minor/patch) of version change - required

  • :description (String)

    set description of version change - required

  • :opening_user_name (String)

    add opening username to the event - optional

  • :workflow (String)

    the workflow to start - defaults to ‘assemblyWF’

Returns:

  • (Boolean)

    true on success

Raises:



25
26
27
28
29
30
31
32
# File 'lib/dor/services/client/accession.rb', line 25

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