def pull_collection
      @service.set_contexts(@contexts)
      collection = @service.list(object_name)
      @service.clear_contexts
      collection.each_with_index do |remote_object_hash, index|
        remote_id = remote_object_hash.delete("id")
        local_object = @factory.with_remote_id(remote_id)
        unless local_object
          local_object = @factory.new
          local_object.update_remote_id(remote_id)
        end
        local_object.before_pull(self) if local_object.respond_to?(:before_pull)
        local_object._collection_order = index
        fields = configuration.synchronizable_for_pull
        fields.each do |field|
          value = remote_object_hash[field.to_s]
          local_object.send("#{field}=", value)
        end
        local_object.after_pull(self) if local_object.respond_to?(:after_pull)
        local_object.save
      end
      collection.count
    end
def pull_collection
      @service.set_contexts(@contexts)
      collection = @service.list(object_name)
      @service.clear_contexts
      collection.each_with_index do |remote_object_hash, index|
        remote_id = remote_object_hash.delete("id")
        local_object = @factory.with_remote_id(remote_id)
        unless local_object
          local_object = @factory.new
          local_object.update_remote_id(remote_id)
        end
        local_object.before_pull(self) if local_object.respond_to?(:before_pull)
        local_object._collection_order = index
        fields = configuration.synchronizable_for_pull
        fields.each do |field|
          value = remote_object_hash[field.to_s]
          local_object.send("#{field}=", value)
        end
        local_object.after_pull(self) if local_object.respond_to?(:after_pull)
        local_object.save
      end
      collection.count
    end
Pulls whole remote collection. If it cannot find
 matching local object, it will create one.
 This method is slow, useful for initial import, not
 for regular updates. For regular updates, only
 changed remote objects should be updates using pull_object
 @see pull_object