class DropboxClient

Attributes

date_string[RW]

Public Instance Methods

create_folder(path) click to toggle source
# File lib/zeitungen/dropbox_client.rb, line 40
def create_folder(path)
  file_create_folder(path)
rescue DropboxError => e
  nil
end
dir?(path) click to toggle source
# File lib/zeitungen/dropbox_client.rb, line 35
def dir?(path)
  r = metadata(path)
  r["is_dir"]
end
exist_in_private_dest?(filename) click to toggle source
# File lib/zeitungen/dropbox_client.rb, line 16
def exist_in_private_dest?(filename)
  exists?(private_dest_path(filename))
end
exist_in_public_dest?(filename) click to toggle source
# File lib/zeitungen/dropbox_client.rb, line 12
def exist_in_public_dest?(filename)
  exists?(public_dest_path(filename))
end
exists?(path) click to toggle source

path can be a dir or a file

# File lib/zeitungen/dropbox_client.rb, line 47
def exists?(path)
  r = metadata(path)
  return !r["is_deleted"]
rescue DropboxError => e
  false 
end
include?(dir, file) click to toggle source
# File lib/zeitungen/dropbox_client.rb, line 30
def include?(dir, file)
  r = metadata(dir)
  r["contents"].map{|e| File.basename(e["path"])}.include?(file)
end
mv_file_in_private_dest(filename, file) click to toggle source
# File lib/zeitungen/dropbox_client.rb, line 25
def mv_file_in_private_dest(filename, file)
  f = open(file)
  put_file(private_dest_path(filename), f)
end
mv_file_in_public_dest(filename, file) click to toggle source
# File lib/zeitungen/dropbox_client.rb, line 20
def mv_file_in_public_dest(filename, file)
  f = open(file)
  put_file(public_dest_path(filename), f)
end
private_dest_path(filename) click to toggle source
# File lib/zeitungen/dropbox_client.rb, line 8
def private_dest_path(filename)
  File.join("zeitungen", filename)
end
public_dest_path(filename) click to toggle source
# File lib/zeitungen/dropbox_client.rb, line 4
def public_dest_path(filename)
  File.join("quotidie", @date_string, filename)
end