lib/tweetable/user.rb in tweetable-0.1.13 vs lib/tweetable/user.rb in tweetable-0.1.14

- old
+ new

@@ -40,11 +40,11 @@ self.config[:include_on_update].include?(:messages) ? update_messages : [] # return newly found messages end def update_info - uid = self.screen_name # self.user_id.blank? ? self.screen_name : self.user_id + uid = self.user_id.blank? ? self.screen_name : self.user_id info = self.client.user(uid) self.user_id = info[:id] self.screen_name = info[:screen_name].downcase self.profile_image_url = info[:profile_image_url] @@ -67,14 +67,27 @@ most_recent_message = self.messages.sort(:order => 'DESC', :by => :message_id).first options.merge!(:count => self.config[:max_message_count], :screen_name => self.screen_name) options[:since_id] = most_recent_message.message_id if most_recent_message timeline = self.client.user_timeline(options) + + puts "**** #{options.inspect}" + puts "********************************************************************************************************" + puts "**** #{most_recent_message.inspect}" + puts "********************************************************************************************************" + puts "**** #{timeline[0].inspect}" + puts "********************************************************************************************************" + puts "**** #{timeline[-1].inspect}" + puts "********************************************************************************************************" + puts "**** #{timeline.size}" + + # puts "**** #{timeline.inspect}" + build_messages(timeline, self.messages) end def update_friend_messages(options = {}) - most_recent_message = self.friend_messages.sort(:order => 'DESC', :by => :message_id).first + most_recent_message = self.friend_messages.sort(:order => 'DESC', :by => :message_id, :limit => 1).first options.merge!(:count => self.config[:max_message_count], :screen_name => self.screen_name) options[:since_id] = most_recent_message.message_id if most_recent_message timeline = self.client.friends_timeline(options) build_messages(timeline, self.friend_messages, :create_user => true) \ No newline at end of file