lib/wunderlist/sync.rb
# Just process the data we received in step 1
Just process the data we received in step 1
Just process the data we received in step 1
def run_step_2
      response = @step_1_response
      @user_id = response['user_id'].to_i
      sync_table = response['sync_table']
      return unless sync_table
      web_sync(
        sync_table['new_lists'],
        self.lists,
        Wunderlist::List
      )
      web_sync(
        sync_table['new_tasks'],
        self.tasks,
        Wunderlist::Task
      )
      if sync_table['synced_lists']
        sync_table['synced_lists'].each do |hash|
          hash.each do |id,online_id|
            local = lists.find{|list| list.id? && list.id == id}
            unless local
              raise ConsistencyError.new(
                "Couldn't find local object for %s => %d" % [id, online_id]
              )
            end
            local.online_id = online_id
          end
        end
      end
    end
def run_step_2 response = @step_1_response @user_id = response [ 'user_id' ] . to_i sync_table = response [ 'sync_table' ] return unless sync_table web_sync ( sync_table [ 'new_lists' ] , self . lists , Wunderlist :: List ) web_sync ( sync_table [ 'new_tasks' ] , self . tasks , Wunderlist :: Task ) if sync_table [ 'synced_lists' ] sync_table [ 'synced_lists' ] . each do | hash | hash . each do | id , online_id | local = lists . find { | list | list . id? && list . id == id } unless local raise ConsistencyError . new ( "Couldn't find local object for %s => %d" % [ id , online_id ] ) end local . online_id = online_id end end end end
Just process the data we received in step 1
Just process the data we received in step 1