Class: PurlFetcher::Client::Unpublish

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

Overview

Delete an item from the purl-fetcher cache

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(druid:) ⇒ Unpublish

Returns a new instance of Unpublish.

Parameters:

  • druid (String)

    the identifier of the item



14
15
16
# File 'lib/purl_fetcher/client/unpublish.rb', line 14

def initialize(druid:)
  @druid = druid
end

Class Method Details

.unpublish(druid:) ⇒ Object

Parameters:

  • druid (String)

    the identifier of the item

Raises:

  • (Purl::Fetcher::Client::AlreadyDeletedResponseError)

    if the item is already deleted



9
10
11
# File 'lib/purl_fetcher/client/unpublish.rb', line 9

def self.unpublish(druid:)
  new(druid:).unpublish
end

Instance Method Details

#unpublishObject



18
19
20
21
22
23
# File 'lib/purl_fetcher/client/unpublish.rb', line 18

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