Class: DropSync::Engine
- Inherits:
-
Object
- Object
- DropSync::Engine
- Defined in:
- lib/dropsync/engine.rb
Instance Method Summary collapse
- #download(path) ⇒ Object
-
#initialize(access_token) ⇒ Engine
constructor
A new instance of Engine.
- #upload(path_to_file) ⇒ Object
Constructor Details
#initialize(access_token) ⇒ Engine
Returns a new instance of Engine.
3 4 5 |
# File 'lib/dropsync/engine.rb', line 3 def initialize(access_token) @client = DropboxClient.new(access_token) end |
Instance Method Details
#download(path) ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/dropsync/engine.rb', line 7 def download(path) puts '--- DropSync ---' puts "> Searching for #{path}" url = get_url(path) puts "> Downloading file" Mecha.automatic_download(path, url) puts '> Download finished!' logout end |
#upload(path_to_file) ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/dropsync/engine.rb', line 17 def upload(path_to_file) puts '--- DropSync ---' filename = File.basename(path_to_file) puts "> Uploading #{filename}" @client.put_file(filename, open(path_to_file)) puts '> Upload finished!' logout end |