Class: PurlFetcher::Client::Withdraw
- Inherits:
-
Object
- Object
- PurlFetcher::Client::Withdraw
- 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
-
#initialize(druid:, version:) ⇒ Withdraw
constructor
A new instance of Withdraw.
- #restore ⇒ Object
- #withdraw ⇒ Object
Constructor Details
#initialize(druid:, version:) ⇒ Withdraw
Returns a new instance of Withdraw.
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
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
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
#restore ⇒ Object
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 |
#withdraw ⇒ Object
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 |