ejholmes/restforce — pull request #154 by theSteveMitchell (2014-11-29 17:52:41+00:00)
Title: add a page_size method to Restforce::Collection

I have a Salesforce query that returns many results using the lazy-fetched enumerable Restforce::Collection. Something like

results = restforce_client.query("Select Id from #{sf_class}")
results.each_slice(1_000) do |slice|
delay_send_spam_email(slice)
end
Using each_slice with the SF page size seems very clean, and efficient, since I can fetch a single page of results, and only get the next page when I'm ready to process it.
But sometimes SF returns pages of 1k results, sometimes 2k, and I don't want to have to figure that out.

So I'd like to do results.each_slice(results.page_size) do |slice| ...