class Strava::Api::Cursor

Attributes

client[R]
params[R]
path[R]

Public Class Methods

new(client, path, params = {}) click to toggle source
# File lib/strava/api/cursor.rb, line 10
def initialize(client, path, params = {})
  @client = client
  @path = path
  @params = params
end

Public Instance Methods

each() { |response| ... } click to toggle source
# File lib/strava/api/cursor.rb, line 16
def each
  next_page = 1
  loop do
    query = params.merge(page: next_page)
    response = client.get(path, query)
    break unless response.any?

    yield response
    next_page += 1
  end
end