lib/restful_model_collection.rb in nylas-0.17.0 vs lib/restful_model_collection.rb in nylas-0.17.1

- old
+ new

@@ -61,9 +61,13 @@ def range(offset = 0, limit = 100) accumulated = [] finished = false chunk_size = 100 + if limit < chunk_size + chunk_size = limit + end + while (!finished && accumulated.length < limit) do results = get_model_collection(offset + accumulated.length, chunk_size) accumulated = accumulated.concat(results) # we're done if we have more than 'limit' items, or if we asked for 50 and got less than 50...