lib/eco/api/session/batch.rb in eco-helpers-1.0.6 vs lib/eco/api/session/batch.rb in eco-helpers-1.0.7
- old
+ new
@@ -98,13 +98,13 @@
looping = !params.key?(:page)
page = params[:page] || 1
people = []; total_pages = nil
- results_from = nil
+ cursor_id = nil
loop do
- params.merge!(results_from: results_from) unless !results_from
+ params.merge!(cursor_id: cursor_id) unless !cursor_id
people_res, response = client_get(client, params: params.merge(page: page), silent: silent)
people += people_res
total_iterations ||= response.body["total_pages"]
no_pages = !response.body["total_pages"]
@@ -116,10 +116,10 @@
msg = "iteration number: #{page}/#{total_iterations}, got num people #{people_res.length}, with total #{people.length} people got"
msg = "search(q=#{params[:q]}) " + msg if params.key?(:q)
logger.info(msg) unless silent
- iterate = (no_pages && results_from = response.body["next_results_from"]) || (looping && page < total_iterations)
+ iterate = (no_pages && cursor_id = response.body["cursor_id"]) || (looping && page < total_iterations)
break unless iterate
page += 1
end
return people