Class: Backup::Storage::Dropbox

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

Defined Under Namespace

Classes: Error

Instance Attribute Summary collapse

Attributes inherited from Base

#keep, #model, #package, #path, #storage_id

Instance Method Summary collapse

Methods inherited from Base

#perform!

Methods included from Config::Helpers

included

Constructor Details

#initialize(model, storage_id = nil) ⇒ Dropbox

Creates a new instance of the storage object



50
51
52
53
54
55
56
57
58
59
60
# File 'lib/backup/storage/dropbox.rb', line 50

def initialize(model, storage_id = nil)
  super

  @path           ||= 'backups'
  @cache_path     ||= '.cache'
  @access_type    ||= :app_folder
  @chunk_size     ||= 4 # MiB
  @max_retries    ||= 10
  @retry_waitsec  ||= 30
  path.sub!(/^\//, '')
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Backup::Config::Helpers

Instance Attribute Details

#access_typeObject

Dropbox Access Type Valid values are:

:app_folder (default)
:dropbox (full access)


30
31
32
# File 'lib/backup/storage/dropbox.rb', line 30

def access_type
  @access_type
end

#api_keyObject

Dropbox API credentials



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

def api_key
  @api_key
end

#api_secretObject

Dropbox API credentials



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

def api_secret
  @api_secret
end

#cache_pathObject

Path to store cached authorized session.

Relative paths will be expanded using Config.root_path, which by default is ~/Backup unless –root-path was used on the command line or set in config.rb.

By default, cache_path is ‘.cache’, which would be ‘~/Backup/.cache/’ if using the default root_path.



23
24
25
# File 'lib/backup/storage/dropbox.rb', line 23

def cache_path
  @cache_path
end

#chunk_sizeObject

Chunk size, specified in MiB, for the ChunkedUploader.



34
35
36
# File 'lib/backup/storage/dropbox.rb', line 34

def chunk_size
  @chunk_size
end

#max_retriesObject

Number of times to retry failed operations.

Default: 10



40
41
42
# File 'lib/backup/storage/dropbox.rb', line 40

def max_retries
  @max_retries
end

#retry_waitsecObject

Time in seconds to pause before each retry.

Default: 30



46
47
48
# File 'lib/backup/storage/dropbox.rb', line 46

def retry_waitsec
  @retry_waitsec
end