Class: Backups::Restore
- Inherits:
-
Object
- Object
- Backups::Restore
- Defined in:
- lib/backups/restore.rb
Instance Method Summary collapse
-
#initialize(name) ⇒ Restore
constructor
A new instance of Restore.
- #run ⇒ Object
Constructor Details
#initialize(name) ⇒ Restore
Returns a new instance of Restore.
5 6 7 |
# File 'lib/backups/restore.rb', line 5 def initialize(name) @name = name end |
Instance Method Details
#run ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/backups/restore.rb', line 9 def run raise StandardError, "No backups found" if backups["files"].blank? raise StandardError, "File not found" unless service.exist?(key) File.open(path, "wb") do |file| file.write(ActiveSupport::Gzip.decompress(service.download(key))) end end |