lib/datapimp/sync/dropbox_folder.rb in datapimp-1.0.0 vs lib/datapimp/sync/dropbox_folder.rb in datapimp-1.0.1

- old
+ new

@@ -1,10 +1,37 @@ module Datapimp - class Sync::DropboxFolder < OpenStruct - class_attribute :default_path_prefix, :default_root + class Sync::DropboxFolder < Hashie::Mash + def dropbox + @dropbox ||= Datapimp::Sync.dropbox + end + def delta + @delta ||= dropbox.delta(cursor, remote_path) + end - def push - Datapimp.dropbox(token: client_token, secret: client_secret) + def local_path + Pathname(local) + end + + def remote_path + Datapimp::Sync.dropbox.ls(remote) + end + + def cursor + cursor_path.exist? && cursor_path.read + end + + def cursor_path + local_path.join('.dropbox-cursor') + end + + def run(action) + action = action.to_sym + + if action == :push + + elsif action == :pull + + end end end end