class AppleMusic::PaginatedResponse

Public Class Methods

new(client, response) click to toggle source
# File lib/client.rb, line 66
def initialize(client, response)
  @client = client
  @response = response
end

Public Instance Methods

each(&block) click to toggle source
# File lib/client.rb, line 71
def each(&block)
  return to_enum(:each) unless block_given?
  return if @response.nil? or @response["data"].nil?

  @response["data"].each(&block)
  return if @response["next"].nil?
  PaginatedResponse.new(@client, @client.get(@response["next"])).each(&block)
end