lib/namespace.rb in inbox-0.17.3 vs lib/namespace.rb in inbox-0.17.4

- old
+ new

@@ -5,11 +5,10 @@ require 'draft' require 'contact' require 'file' require 'calendar' require 'event' -require 'folder' require 'yajl' require 'em-http' require 'ostruct' # Rather than saying require 'thread', we need to explicitly force @@ -61,18 +60,10 @@ def events @events ||= RestfulModelCollection.new(Event, @_api, @id) end - def folders - @folders ||= RestfulModelCollection.new(Folder, @_api, @id) - end - - def labels - @labels ||= RestfulModelCollection.new(Label, @_api, @id) - end - def get_cursor(timestamp) # Get the cursor corresponding to a specific timestamp. path = @_api.url_for_path("/n/#{@namespace_id}/delta/generate_cursor") data = { :start => timestamp } @@ -95,12 +86,10 @@ "event" => Inbox::Event, "file" => Inbox::File, "message" => Inbox::Message, "namespace" => Inbox::Namespace, "tag" => Inbox::Tag, - "folder" => Inbox::Folder, - "label" => Inbox::Label, } def _build_exclude_types(exclude_types) exclude_string = "&exclude_types=" @@ -134,10 +123,14 @@ start_cursor = json["cursor_start"] end_cursor = json["cursor_end"] json["deltas"].each do |delta| + if not OBJECTS_TABLE.has_key?(delta['object']) + next + end + cls = OBJECTS_TABLE[delta['object']] obj = cls.new(@_api, @namespace_id) case delta["event"] when 'create', 'modify' @@ -169,9 +162,13 @@ path = @_api.url_for_path("/n/#{@namespace_id}/delta/streaming?cursor=#{cursor}#{exclude_string}") parser = Yajl::Parser.new(:symbolize_keys => false) parser.on_parse_complete = proc do |data| delta = Inbox.interpret_response(OpenStruct.new(:code => '200'), data, {:expected_class => Object, :result_parsed => true}) + + if not OBJECTS_TABLE.has_key?(delta['object']) + next + end cls = OBJECTS_TABLE[delta['object']] obj = cls.new(@_api, @namespace_id) case delta["event"]