Class: Dbox::DB::DropboxFile
Instance Attribute Summary
Attributes inherited from DropboxBlob
#modified_at, #path, #revision
Instance Method Summary
collapse
Methods inherited from DropboxBlob
#api, #create, #delete, #force_metadata_update_from_server, #initialize, #local_path, #modified?, #parse_time, #remote_path, #saving_parent_timestamp, #smart_new, #time_to_s, #update, #update_file_timestamp, #update_modification_info
Methods included from Loggable
included, #log
Instance Method Details
#create_local ⇒ Object
481
482
483
484
485
|
# File 'lib/dbox/db.rb', line 481
def create_local
saving_parent_timestamp do
download
end
end
|
#create_remote ⇒ Object
498
499
500
|
# File 'lib/dbox/db.rb', line 498
def create_remote
upload
end
|
#delete_local ⇒ Object
487
488
489
490
491
492
|
# File 'lib/dbox/db.rb', line 487
def delete_local
log.info "Deleting file: #{local_path}"
saving_parent_timestamp do
FileUtils.rm_rf(local_path)
end
end
|
#delete_remote ⇒ Object
502
503
504
|
# File 'lib/dbox/db.rb', line 502
def delete_remote
api.delete_file(remote_path)
end
|
#dir? ⇒ Boolean
477
478
479
|
# File 'lib/dbox/db.rb', line 477
def dir?
false
end
|
#download ⇒ Object
510
511
512
513
514
515
516
517
|
# File 'lib/dbox/db.rb', line 510
def download
res = api.get_file(remote_path)
File.open(local_path, "w") do |f|
f << res
end
update_file_timestamp
end
|
#update_local ⇒ Object
494
495
496
|
# File 'lib/dbox/db.rb', line 494
def update_local
download
end
|
#update_remote ⇒ Object
506
507
508
|
# File 'lib/dbox/db.rb', line 506
def update_remote
upload
end
|
#upload ⇒ Object
519
520
521
522
|
# File 'lib/dbox/db.rb', line 519
def upload
api.put_file(remote_path, local_path)
force_metadata_update_from_server
end
|