Class: Backup::Storage::Everbox
- Inherits:
-
Base
- Object
- Base
- Backup::Storage::Everbox
- Defined in:
- lib/backup/storage/everbox.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
Returns the value of attribute path.
-
#secret ⇒ Object
Returns the value of attribute secret.
-
#token ⇒ Object
Returns the value of attribute token.
Instance Method Summary collapse
-
#initialize(model, storage_id = nil, &block) ⇒ Everbox
constructor
A new instance of Everbox.
- #remove!(pkg) ⇒ Object
- #transfer! ⇒ Object
Constructor Details
#initialize(model, storage_id = nil, &block) ⇒ Everbox
Returns a new instance of Everbox.
10 11 12 13 14 15 16 |
# File 'lib/backup/storage/everbox.rb', line 10 def initialize(model, storage_id = nil, &block) super(model, storage_id) @path ||= 'backups' instance_eval(&block) if block_given? end |
Instance Attribute Details
#path ⇒ Object
Returns the value of attribute path.
8 9 10 |
# File 'lib/backup/storage/everbox.rb', line 8 def path @path end |
#secret ⇒ Object
Returns the value of attribute secret.
7 8 9 |
# File 'lib/backup/storage/everbox.rb', line 7 def secret @secret end |
#token ⇒ Object
Returns the value of attribute token.
7 8 9 |
# File 'lib/backup/storage/everbox.rb', line 7 def token @token end |
Instance Method Details
#remove!(pkg) ⇒ Object
18 19 20 21 22 23 |
# File 'lib/backup/storage/everbox.rb', line 18 def remove!(pkg) remote_path = remote_path_for(pkg) Logger. "#{storage_name} started removing " + "'#{ remote_path }'." connection.session.delete(remote_path) end |
#transfer! ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/backup/storage/everbox.rb', line 25 def transfer! remote_path = remote_path_for(@package) files_to_transfer_for(@package) do |local_file, remote_file| Logger. "#{storage_name} started transferring " + "'#{ local_file }'." connection.session.upload( File.join(local_path, local_file), File.join(remote_path, remote_file), :mode => :dropbox ) #File.open(File.join(local_path, local_file), 'r') do |file| # connection.put_object( # bucket, File.join(remote_path, remote_file), file # ) #end end end |