Sha256: 8b3c5dd3066cd6db8a0ede4170a714c6e19a4cd420b6ac58ec13e0dfa92c5c9f
Contents?: true
Size: 1.54 KB
Versions: 1
Compression:
Stored size: 1.54 KB
Contents
# frozen_string_literal: true module PurlFetcher class Client # Publish (metadata-only) to the purl cache class Publish def self.publish(...) new(...).publish end # @param [Cocina::Models::DRO,Cocina::Models::Collection] cocina the Cocina data object # @param [Hash<String,String>] file_uploads map of cocina filenames to staging filenames (UUIDs) # @param [String] version the version of the item # @param [DateTime] version_date the version date # @param [Boolean] must_version whether the item must be versioned 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 def publish logger.debug("Starting a publish request for: #{druid}") client.post(path:, body:) logger.debug("Publish request complete") end private attr_reader :cocina, :file_uploads, :version, :version_date, :must_version def druid cocina.externalIdentifier end def body { object: cocina.to_h, file_uploads: file_uploads, version: version, version_date: version_date.iso8601, must_version: must_version }.to_json end def logger Client.config.logger end def client Client.instance end def path "/v1/resources" end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
purl_fetcher-client-2.0.0 | lib/purl_fetcher/client/publish.rb |