Class: Datapimp::Sync::DropboxDelta
- Inherits:
-
Object
- Object
- Datapimp::Sync::DropboxDelta
- Defined in:
- lib/datapimp/sync/dropbox_delta.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
Returns the value of attribute client.
-
#cursor ⇒ Object
Returns the value of attribute cursor.
-
#data ⇒ Object
Returns the value of attribute data.
-
#entries ⇒ Object
Returns the value of attribute entries.
-
#path_prefix ⇒ Object
Returns the value of attribute path_prefix.
Instance Method Summary collapse
- #_dropbox_delta(at = nil) ⇒ Object
- #fetch ⇒ Object
-
#initialize(client, cursor, path_prefix = nil) ⇒ DropboxDelta
constructor
A new instance of DropboxDelta.
- #on_reset(path_prefix, cursor) ⇒ Object
- #processed! ⇒ Object
Constructor Details
#initialize(client, cursor, path_prefix = nil) ⇒ DropboxDelta
Returns a new instance of DropboxDelta.
11 12 13 14 15 |
# File 'lib/datapimp/sync/dropbox_delta.rb', line 11 def initialize(client, cursor, path_prefix=nil) @client = client @cursor = cursor @path_prefix = path_prefix end |
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client.
5 6 7 |
# File 'lib/datapimp/sync/dropbox_delta.rb', line 5 def client @client end |
#cursor ⇒ Object
Returns the value of attribute cursor.
5 6 7 |
# File 'lib/datapimp/sync/dropbox_delta.rb', line 5 def cursor @cursor end |
#data ⇒ Object
Returns the value of attribute data.
5 6 7 |
# File 'lib/datapimp/sync/dropbox_delta.rb', line 5 def data @data end |
#entries ⇒ Object
Returns the value of attribute entries.
5 6 7 |
# File 'lib/datapimp/sync/dropbox_delta.rb', line 5 def entries @entries end |
#path_prefix ⇒ Object
Returns the value of attribute path_prefix.
5 6 7 |
# File 'lib/datapimp/sync/dropbox_delta.rb', line 5 def path_prefix @path_prefix end |
Instance Method Details
#_dropbox_delta(at = nil) ⇒ Object
28 29 30 31 32 33 |
# File 'lib/datapimp/sync/dropbox_delta.rb', line 28 def _dropbox_delta at=nil at ||= cursor response = client.delta(at, path_prefix) self.cursor = response["cursor"] response end |
#fetch ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/datapimp/sync/dropbox_delta.rb', line 42 def fetch return @response if @response response = _dropbox_delta if response["reset"] == true on_reset(path_prefix, cursor) end self.entries = {}.to_mash response["entries"].each do |entry| path, = entry self.entries[path] = end if response["has_more"] == true # TODO Implement end @response = response end |
#on_reset(path_prefix, cursor) ⇒ Object
39 40 |
# File 'lib/datapimp/sync/dropbox_delta.rb', line 39 def on_reset path_prefix, cursor end |
#processed! ⇒ Object
17 18 19 20 |
# File 'lib/datapimp/sync/dropbox_delta.rb', line 17 def processed! # TODO # Should update cursor end |