Sha256: b13079ca7eec88acf0c7e852e7c96467eb23d54dcfbf0a7d2eaf41d85d123141
Contents?: true
Size: 548 Bytes
Versions: 7
Compression:
Stored size: 548 Bytes
Contents
# frozen_string_literal: true module Strava module Api class Cursor include Enumerable attr_reader :client, :path, :params def initialize(client, path, params = {}) @client = client @path = path @params = params end 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 end end end
Version data entries
7 entries across 7 versions & 1 rubygems