Class: RackCloudBackupDriver
- Inherits:
-
CloudBackup::Driver
- Object
- CloudBackup::Driver
- RackCloudBackupDriver
- Defined in:
- lib/drivers/rack_cloud_backup_driver.rb
Instance Method Summary collapse
-
#initialize(credentials) ⇒ RackCloudBackupDriver
constructor
A new instance of RackCloudBackupDriver.
- #initiate ⇒ Object
-
#list_by_date ⇒ Object
TODO: parse metadata.
- #remove(name) ⇒ Object
- #terminate ⇒ Object
-
#upload ⇒ Object
TODO: set metadata to objects.
Methods inherited from CloudBackup::Driver
Constructor Details
#initialize(credentials) ⇒ RackCloudBackupDriver
Returns a new instance of RackCloudBackupDriver.
5 6 7 8 9 10 |
# File 'lib/drivers/rack_cloud_backup_driver.rb', line 5 def initialize credentials @id = credentials[:id] @key = credentials[:key] @identificator = credentials[:bucket] @cf = CloudFiles::Connection.new(@id, @key) end |
Instance Method Details
#initiate ⇒ Object
12 13 14 |
# File 'lib/drivers/rack_cloud_backup_driver.rb', line 12 def initiate @bucket = get_or_create_bucket end |
#list_by_date ⇒ Object
TODO: parse metadata
17 18 19 |
# File 'lib/drivers/rack_cloud_backup_driver.rb', line 17 def list_by_date @bucket.objects end |
#remove(name) ⇒ Object
21 22 23 |
# File 'lib/drivers/rack_cloud_backup_driver.rb', line 21 def remove name @bucket.delete_object name end |
#terminate ⇒ Object
33 34 35 |
# File 'lib/drivers/rack_cloud_backup_driver.rb', line 33 def terminate @cf, @bucket = nil end |
#upload ⇒ Object
TODO: set metadata to objects
26 27 28 29 30 31 |
# File 'lib/drivers/rack_cloud_backup_driver.rb', line 26 def upload list.each do |file| object = @bucket.create_object File.basename(file) object.write File.read(file) end end |