Class: Brine::CleaningUp::DeleteCommand
- Inherits:
-
Object
- Object
- Brine::CleaningUp::DeleteCommand
- Defined in:
- lib/brine/cleaning_up.rb
Overview
Capture the delete command which will be executed as part of cleaning up.
The command will be retried a specified number of times if an unsuccessful status code is received.
Instance Method Summary collapse
-
#cleanup ⇒ Boolean
Issue the delete based on the parameters provided during construction.
-
#initialize(client, path, oks: [200,204], attempts: 3) ⇒ DeleteCommand
constructor
Construct a command with the required paramters to perform the delete.
Constructor Details
permalink #initialize(client, path, oks: [200,204], attempts: 3) ⇒ DeleteCommand
Construct a command with the required paramters to perform the delete.
41 42 43 44 45 46 |
# File 'lib/brine/cleaning_up.rb', line 41 def initialize(client, path, oks: [200,204], attempts: 3) @client = client @path = path @oks = oks @attempts = attempts end |
Instance Method Details
permalink #cleanup ⇒ Boolean
Issue the delete based on the parameters provided during construction.
53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/brine/cleaning_up.rb', line 53 def cleanup for _ in 1..@attempts begin resp=@client.delete(@path) return true if @oks.include?(resp.status) rescue Exception => ex STDERR.puts "WARNING: #{ex}" end end STDERR.puts "ERROR: Could not DELETE #{@path}" false end |