Class: PurlFetcher::Client::Publish

Inherits:
Object
  • Object
show all
Defined in:
lib/purl_fetcher/client/publish.rb

Overview

Publish (metadata-only) to the purl cache

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cocina:, file_uploads:, version:, version_date:, must_version:) ⇒ Publish

Returns a new instance of Publish.

Parameters:

  • cocina (Cocina::Models::DRO, Cocina::Models::Collection)

    the Cocina data object

  • file_uploads (Hash<String,String>)

    map of cocina filenames to staging filenames (UUIDs)

  • version (String)

    the version of the item

  • version_date (DateTime)

    the version date

  • must_version (Boolean)

    whether the item must be versioned



16
17
18
19
20
21
22
# File 'lib/purl_fetcher/client/publish.rb', line 16

def initialize(cocina:, file_uploads:, version:, version_date:, must_version:)
  @cocina = cocina
  @file_uploads = file_uploads
  @version = version
  @version_date = version_date
  @must_version = must_version
end

Class Method Details

.publishObject



7
8
9
# File 'lib/purl_fetcher/client/publish.rb', line 7

def self.publish(...)
  new(...).publish
end

Instance Method Details

#publishObject



24
25
26
27
28
# File 'lib/purl_fetcher/client/publish.rb', line 24

def publish
  logger.debug("Starting a publish request for: #{druid}")
  client.put(path:, body:)
  logger.debug("Publish request complete")
end