Class: Backup::Storage::Dropbox

Inherits:
Base
  • Object
show all
Defined in:
lib/backup/storage/dropbox.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#keep, #time

Instance Method Summary collapse

Methods inherited from Base

#cycle!, #local_file, #local_path, #provider, #remote_file

Methods included from Configuration::Helpers

#clear_defaults!, #getter_methods, #load_defaults!, #setter_methods

Constructor Details

#initialize(&block) ⇒ Dropbox

Creates a new instance of the Dropbox storage object First it sets the defaults (if any exist) and then evaluates the configuration block which may overwrite these defaults



31
32
33
34
35
36
37
38
39
40
# File 'lib/backup/storage/dropbox.rb', line 31

def initialize(&block)
  load_defaults!

  @path ||= 'backups'

  instance_eval(&block) if block_given?

  @timeout ||= 300
  @time = TIME
end

Instance Attribute Details

#api_keyObject

Dropbox API credentials



17
18
19
# File 'lib/backup/storage/dropbox.rb', line 17

def api_key
  @api_key
end

#api_secretObject

Dropbox API credentials



17
18
19
# File 'lib/backup/storage/dropbox.rb', line 17

def api_secret
  @api_secret
end

#emailObject

Dropbox user credentials



13
14
15
# File 'lib/backup/storage/dropbox.rb', line 13

def email
  @email
end

#passwordObject

Dropbox user credentials



13
14
15
# File 'lib/backup/storage/dropbox.rb', line 13

def password
  @password
end

#pathObject

Path to where the backups will be stored



21
22
23
# File 'lib/backup/storage/dropbox.rb', line 21

def path
  @path
end

#timeoutObject

Dropbox connection timeout



25
26
27
# File 'lib/backup/storage/dropbox.rb', line 25

def timeout
  @timeout
end

Instance Method Details

#perform!Object

Performs the backup transfer



50
51
52
53
# File 'lib/backup/storage/dropbox.rb', line 50

def perform!
  transfer!
  cycle!
end

#remote_pathObject

This is the remote path to where the backup files will be stored



44
45
46
# File 'lib/backup/storage/dropbox.rb', line 44

def remote_path
  File.join(path, TRIGGER)
end