lib/dbox/db.rb in dbox-0.3.0 vs lib/dbox/db.rb in dbox-0.4.0
- old
+ new
@@ -39,10 +39,14 @@
def self.push(local_path)
load(local_path).push
end
+ def self.move(new_remote_path, local_path)
+ load(local_path).move(new_remote_path)
+ end
+
# IMPORTANT: DropboxDb.new is private. Please use DropboxDb.create, DropboxDb.clone, or DropboxDb.load as the entry point.
private_class_method :new
def initialize(local_path, res)
@local_path = local_path
@remote_path = res["path"]
@@ -65,9 +69,15 @@
def push
res = @root.push
save
res
+ end
+
+ def move(new_remote_path)
+ api.move(@remote_path, new_remote_path)
+ @remote_path = new_remote_path
+ save
end
def local_to_relative_path(path)
if path.include?(@local_path)
path.sub(@local_path, "").sub(/^\//, "")