Sha256: 4f9df50d7546eeceb3cab83e9cb6bb44b3bdd806388a5dbd1111fca4496db2d6

Contents?: true

Size: 793 Bytes

Versions: 7

Compression:

Stored size: 793 Bytes

Contents

# frozen_string_literal: true

module PurlFetcher
  class Client
    # Delete an item from the purl-fetcher cache
    class Unpublish
      # @param [String] druid the identifier of the item
      def self.unpublish(druid:)
        new(druid:).unpublish
      end

      # @param [String] druid the identifier of the item
      def initialize(druid:)
        @druid = druid
      end

      def unpublish
        logger.debug("Starting a unpublish request for: #{druid}")
        response = client.delete(path:)
        logger.debug("Unpublish request complete")
      end

      private

      attr_reader :druid

      def logger
        Client.config.logger
      end

      def client
        Client.instance
      end

      def path
        "/purls/#{druid}"
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
purl_fetcher-client-1.5.2 lib/purl_fetcher/client/unpublish.rb
purl_fetcher-client-1.5.1 lib/purl_fetcher/client/unpublish.rb
purl_fetcher-client-1.5.0 lib/purl_fetcher/client/unpublish.rb
purl_fetcher-client-1.4.1 lib/purl_fetcher/client/unpublish.rb
purl_fetcher-client-1.4.0 lib/purl_fetcher/client/unpublish.rb
purl_fetcher-client-1.2.1 lib/purl_fetcher/client/unpublish.rb
purl_fetcher-client-1.2.0 lib/purl_fetcher/client/unpublish.rb