sul-dlss/dor-services-app

View on GitHub
app/jobs/robots/dor_repo/accession/publish.rb

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
# frozen_string_literal: true

module Robots
  module DorRepo
    module Accession
      # Publishing metadata and shelving files for object.
      class Publish < Robots::Robot
        def initialize
          super('accessionWF', 'publish', retriable_exceptions: [PurlFetcher::Client::Error])
        end

        def perform_work
          return LyberCore::ReturnState.new(status: :skipped, note: 'Admin policy objects are not published') if cocina_object.admin_policy?

          ::Publish::MetadataTransferService.publish(druid:)
          EventFactory.create(druid:, event_type: 'publishing_complete', data: {})
        end
      end
    end
  end
end