examples/pagination_with_headers.rb in rest-in-peace-4.2.1 vs examples/pagination_with_headers.rb in rest-in-peace-5.0.0
- old
+ new
@@ -13,10 +13,10 @@
yielder << @klass.new(item)
end
# Only make a request to get the next page if we have not
# reached the last page yet.
- raise StopIteration if current_page == total_pages
+ raise StopIteration if current_page >= total_pages
@params.merge!(page: current_page + 1)
result = api.get(url, @params)
current_page = result.env.response_headers['X-Page'].to_i
end
end