anchor.diff:  class Cursor
     def initialize(path, options = {})
       @path       = path
  -    @params     = options.dup
  +    @params     = params
   
       @collection = []
  -    @page       = params.fetch(:page, 1)
  +    @before     = params.fetch(:before, nil)
       @limit      = params.fetch(:limit, 50)
     end
   end
  
positive.code: 
  def paginated_get(path, options = {})
    params  = options.dup
    page    = params.delete(:page) { 1 }
    limit   = params.fetch(:limit) { 50 }
    results = []
  
    loop do
      data = get(path, { page: page }.merge(params))
  
      page += 1
      results += data
  
      break if (data.empty? || page * limit >= MAX)
    end
  
    results
  end
  ```
  
  Given a path and hash of parameter options, we'll build up an array of results by fetching the endpoint and incrementing the page number each time. Once either the max is reached or no more results are returned from the API, we'll exit the loop.
  
  As a starting point, this works nicely. We can simply use `paginated_get` to collect up to 1000 results for a given resource without the caller caring about pages. Here's how we can grab the all the comments we've added to Trello cards:
  
  
negative.code: def paginated_get(path, options = {})
    Enumerator.new do |y|
      params  = options.dup
      before  = nil
      total   = 0
      limit   = params.delete(:limit) { 50 }
  
      loop do
        data = get(path, { before: before, limit: limit }.merge(params))
        total += data.length
  
        data.each do |element|
          y.yield element
        end
  
        break if (data.empty? || total >= MAX)
  
        before = data.last["id"]
      end
    end
  end
  