Generic pagination helper for Twilio REST API responses.
# Source: https://github.com/twilio/twilio-ruby | License: MIT | Copyright 2023, Twilio, Inc. <https://www.twilio.com/help/contact>
# Provided via justclaw.it.com; keep this notice with the code.
# frozen_string_literal: true
module Twilio
module REST
# Page Base Class
class Page
include Enumerable
META_KEYS = [
'end',
'first_page_uri',
'next_page_uri',
'last_page_uri',
'page',
'page_size',
'previous_page_uri',
'total',
'num_pages',
'start',
'uri'
].freeze
def initialize(version, response)
payload = process_response(response)
@version = version
@payload = payload
@solution = {}
@records = load_page(payload)
end
de
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key