Class: Backup::Connection::Dropbox
- Defined in:
- lib/backup/connection/dropbox.rb
Instance Attribute Summary collapse
-
#adapter ⇒ Object
Returns the value of attribute adapter.
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#final_file ⇒ Object
Returns the value of attribute final_file.
-
#password ⇒ Object
Returns the value of attribute password.
-
#path ⇒ Object
Returns the value of attribute path.
-
#procedure ⇒ Object
Returns the value of attribute procedure.
-
#secret_access_key ⇒ Object
Returns the value of attribute secret_access_key.
-
#tmp_path ⇒ Object
Returns the value of attribute tmp_path.
-
#username ⇒ Object
Returns the value of attribute username.
Instance Method Summary collapse
- #connect ⇒ Object
-
#initialize(adapter = false) ⇒ Dropbox
constructor
A new instance of Dropbox.
- #session ⇒ Object
- #static_initialize(procedure) ⇒ Object
- #store ⇒ Object
Constructor Details
#initialize(adapter = false) ⇒ Dropbox
Returns a new instance of Dropbox.
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/backup/connection/dropbox.rb', line 9 def initialize(adapter=false) if adapter self.adapter = adapter self.procedure = adapter.procedure self.final_file = adapter.final_file self.tmp_path = adapter.tmp_path.gsub('\ ', ' ') load_storage_configuration_attributes end end |
Instance Attribute Details
#adapter ⇒ Object
Returns the value of attribute adapter.
7 8 9 |
# File 'lib/backup/connection/dropbox.rb', line 7 def adapter @adapter end |
#api_key ⇒ Object
Returns the value of attribute api_key.
7 8 9 |
# File 'lib/backup/connection/dropbox.rb', line 7 def api_key @api_key end |
#final_file ⇒ Object
Returns the value of attribute final_file.
7 8 9 |
# File 'lib/backup/connection/dropbox.rb', line 7 def final_file @final_file end |
#password ⇒ Object
Returns the value of attribute password.
7 8 9 |
# File 'lib/backup/connection/dropbox.rb', line 7 def password @password end |
#path ⇒ Object
Returns the value of attribute path.
7 8 9 |
# File 'lib/backup/connection/dropbox.rb', line 7 def path @path end |
#procedure ⇒ Object
Returns the value of attribute procedure.
7 8 9 |
# File 'lib/backup/connection/dropbox.rb', line 7 def procedure @procedure end |
#secret_access_key ⇒ Object
Returns the value of attribute secret_access_key.
7 8 9 |
# File 'lib/backup/connection/dropbox.rb', line 7 def secret_access_key @secret_access_key end |
#tmp_path ⇒ Object
Returns the value of attribute tmp_path.
7 8 9 |
# File 'lib/backup/connection/dropbox.rb', line 7 def tmp_path @tmp_path end |
#username ⇒ Object
Returns the value of attribute username.
7 8 9 |
# File 'lib/backup/connection/dropbox.rb', line 7 def username @username end |
Instance Method Details
#connect ⇒ Object
36 37 38 |
# File 'lib/backup/connection/dropbox.rb', line 36 def connect session end |
#session ⇒ Object
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/backup/connection/dropbox.rb', line 25 def session @session ||= ::Dropbox::Session.new(api_key, secret_access_key) unless @session. @session. = username @session. = password @session. end @session end |
#static_initialize(procedure) ⇒ Object
20 21 22 23 |
# File 'lib/backup/connection/dropbox.rb', line 20 def static_initialize(procedure) self.procedure = procedure load_storage_configuration_attributes(true) end |
#store ⇒ Object
44 45 46 47 |
# File 'lib/backup/connection/dropbox.rb', line 44 def store path_to_file = File.join(tmp_path, final_file) session.upload(path_to_file, path, :mode => :dropbox) end |