Class: PurlFetcher::Client::Withdraw

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

Overview

Withdraw / restore a version of an item from the purl-fetcher cache

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(druid:, version:) ⇒ Withdraw

Returns a new instance of Withdraw.

Parameters:

  • druid (String)

    the identifier of the item

  • version (String)

    the version of the item



21
22
23
24
# File 'lib/purl_fetcher/client/withdraw.rb', line 21

def initialize(druid:, version:)
  @druid = druid
  @version = version
end

Class Method Details

.restore(druid:, version:) ⇒ Object

Parameters:

  • druid (String)

    the identifier of the item

  • version (String)

    the version of the item



15
16
17
# File 'lib/purl_fetcher/client/withdraw.rb', line 15

def self.restore(druid:, version:)
  new(druid:, version:).restore
end

.withdraw(druid:, version:) ⇒ Object

Parameters:

  • druid (String)

    the identifier of the item

  • version (String)

    the version of the item



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

def self.withdraw(druid:, version:)
  new(druid:, version:).withdraw
end

Instance Method Details

#restoreObject



33
34
35
36
37
38
# File 'lib/purl_fetcher/client/withdraw.rb', line 33

def restore
  logger.debug("Starting a restore request for: #{druid} (#{version})")
  response = client.put(path: path(:restore))
  logger.debug("Withdraw request complete")
  response
end

#withdrawObject



26
27
28
29
30
31
# File 'lib/purl_fetcher/client/withdraw.rb', line 26

def withdraw
  logger.debug("Starting a withdraw request for: #{druid} (#{version})")
  response = client.put(path: path(:withdraw))
  logger.debug("Withdraw request complete")
  response
end