uploadcare / uploadcare-ruby

Ruby API client that handles uploads and further operations with files by wrapping Uploadcare Upload and REST APIs.
https://uploadcare.com
MIT License
39 stars 28 forks source link

Implement ResourceList#each_page method #38

Closed vizvamitra closed 3 years ago

vizvamitra commented 7 years ago

Currently when you want to do something with each page you'll need to do something like this:

list = api.file_list(limit: 10)

list.each_slice(10) do |page_of_10_files|
  # do something with the page
end

The issue here is that someone outside of the file list needs to know the :limit value to synchronize each_slice with page fetching requests.

Offcource there is a FileList#options method, but it'll contain the :limit option only when it was set during the list instantiation.

This is not a blocker for the release but rather a small convinience that can be implemented later