twilio/twilio-ruby
61.7
Adequate · 6 November 2026
5.7k
lines of production code
Ruby
primary language
4
measurements over time
What this system is
Features
Added Ruby SDK usage examples for core resources and public OAuth
New example scripts demonstrate how to use the Twilio Ruby SDK for managing accounts, calls, SMS/MMS messages, phone numbers, conferences, and queues, including specific patterns like dequeuing with a TwiML URL and decommissioning phone numbers. A separate example illustrates authenticating via public OAuth using client credentials.
examples · high confidence
Added Twilio webhook authentication middleware
A new Rack middleware, \Rack::TwilioWebhookAuthentication\, has been added to validate incoming Twilio webhook signatures. It checks the \X-Twilio-Signature\ header against the request URL and parameters, returning a 403 Forbidden status if validation fails. The middleware supports dynamic token lookup based on the \AccountSid\ parameter and handles edge cases such as percent-encoded paths and non-form-data payloads to ensure robust security.
lib/rack · high confidence
Introduction of OAuth 2.0 client credentials authentication strategy
The library now supports authenticating via OAuth 2.0 client credentials. This change introduces a new \AuthStrategy\ abstraction and specific implementations for token-based authentication (\TokenAuthStrategy\) and no-auth scenarios (\NoAuthStrategy\). It adds credential providers (\OrgsCredentialProvider\ and \ClientCredentialProvider\) that manage client IDs and secrets, automatically fetching and caching access tokens using \OrgTokenManager\ or \ClientTokenManager\, and injecting the resulting Bearer token into requests. This enables users to authenticate using organization-level tokens or standard client credentials flows instead of relying solely on legacy Account SID/AuthToken methods.
_lib/twilio-ruby/auth\strategy, lib/twilio-ruby/credential · high confidence
New Accounts V1 API resources and deprecated legacy shortcuts
The \lib/twilio-ruby/rest/accounts\ area now includes a generated V1 API implementation exposing \auth\_token\_promotion\, \bulk\_consents\, \bulk\_contacts\, \credentials\ (with \public\_key\ and \aws\ sub-resources), \messaging\_geopermissions\, and \safelist\. To maintain backward compatibility, the legacy top-level methods (\auth\_token\_promotion\, \credentials\, \secondary\_auth\_token\) on the Accounts resource are preserved but now emit deprecation warnings and delegate to the new \v1\ namespace.
lib/twilio-ruby/rest · high confidence
Behavioural changes
Library restructured with new configuration and autoload system
The library has been refactored to replace the legacy monolithic entry point with a modular structure. Users now configure the client via a dedicated \Twilio.configure\ block that sets a \Configuration\ object, supporting global settings like \account\_sid\, \auth\_token\, \region\, and \edge\. The main entry file (\lib/twilio-ruby.rb\) uses \autoload\ for major components (JWT, TwiML, HTTP, REST) to improve load performance, and conditionally loads Rack webhook authentication only when the Rack gem is present.
lib · high confidence
New ClientBase class with regional/edge URI handling and automatic Content-Type headers
The library introduces a new \ClientBase\ class in \lib/twilio-ruby/base\ that centralizes API request logic. This change adds support for regional and edge processing by automatically modifying request URIs based on configured region and edge settings, ensuring requests are routed to the correct Twilio endpoints. Additionally, the client now automatically sets the \Content-Type\ header to \application/x-www-form-urlencoded\ for POST and PUT requests when not explicitly provided, and includes a new method to validate SSL certificates against Twilio's test endpoint.
lib/twilio-ruby/base · high confidence
New HTTP client implementation with Faraday and token managers
The HTTP layer has been replaced with a new implementation using the Faraday library. The new \Twilio::HTTP::Client\ supports proxy configuration (protocol, address, port, and credentials), global timeout settings, and allows users to inject custom connection configurations via a \configure\_connection\ method. It also introduces \ClientTokenManager\ and \OrgTokenManager\ classes to handle OAuth 2.0 token fetching for public and private OAuth flows, respectively.
lib/twilio-ruby/http · high confidence
New JWT token generation classes for Access Tokens, Client Capabilities, and Task Router
The library introduces a new JWT generation architecture in the \lib/twilio-ruby/jwt\ directory, featuring \AccessToken\, \ClientCapability\, and \TaskRouterCapability\ classes that inherit from a common \BaseJWT\ base class. \AccessToken\ supports granular grants for Chat, Voice, Sync, Video, and TaskRouter services, including specific features like the \region\ header and \incoming\_allow\ for Voice. \ClientCapability\ handles client scopes (incoming, outgoing, and event streams), while \TaskRouterCapability\ manages workspace policies and web socket policies. This refactoring centralizes JWT logic and expands supported Twilio product integrations.
lib/twilio-ruby/jwt · high confidence
New REST framework with token pagination and metadata support
The \lib/twilio-ruby/framework/rest\ directory now contains a complete, new REST client implementation. This introduces token-based pagination via the new \TokenPage\ class, allowing users to navigate large result sets using page tokens. It also adds a \PageMetadata\ class to expose raw response metadata alongside records. The framework now supports the HTTP PATCH method for partial updates, in addition to existing GET, POST, PUT, and DELETE operations. Error handling has been redesigned with specific \RestError\ and \RestErrorV10\ classes to provide detailed error messages, codes, and status information. Additionally, the \Version\ class now provides \stream\ and \stream\_with\_metadata\ methods for iterating through records, and the \Domain\ class handles URL construction and request dispatching.
lib/twilio-ruby/framework/rest · high confidence
New framework components for request handling, serialization, and value management
This change introduces four new core framework files that underpin the library's API interaction capabilities. The \Request\ class now encapsulates HTTP request details and provides a \to\_s\ method to generate cURL-compatible command strings for debugging. The \Response\ class handles HTTP responses, automatically parsing JSON bodies and normalizing empty responses. A new \Serialize\ module adds utilities for converting dates and datetimes to ISO 8601 formats, flattening nested hashes for query parameters, and serializing complex objects. Finally, the \Values\ module introduces an \:unset\ sentinel value mechanism, allowing the library to distinguish between explicitly passed \nil\ values and omitted parameters during request construction.
lib/twilio-ruby/framework · high confidence
Pre-commit hook rewrites internal Ruby registry URLs in Gemfile.lock
The pre-commit hook now automatically detects and rewrites internal Artifactory registry URLs in Gemfile.lock files to the public rubygems.org endpoint before they are committed. This ensures that lockfiles only reference public registries, aligning with CI enforcement rules for gem-lockfile hygiene.
githooks · high confidence
Project scaffolding and build configuration overhaul
The repository has been restructured with new configuration files including \.rubocop.yml\ and \.rubocop\_todo.yml\ for code linting, a \Makefile\ for build automation, and a \Dockerfile\ based on Ruby 3.2. The \Rakefile\ has been updated to use Bundler and RSpec tasks, replacing the previous gem packaging setup. Additionally, standard documentation files such as \CONTRIBUTING.md\, \CODE\_OF\CONDUCT.md\, and \UPGRADE.md\ have been added, while legacy files like \README.markdown\ and \example-\.rb\ have been removed.
(repo-wide) · high confidence
Request validation now supports URLs with and without explicit ports
The RequestValidator now validates Twilio request signatures against both the URL with the standard port included and the URL with the port removed. This ensures signature verification succeeds regardless of whether the incoming request URL includes an explicit port number, addressing inconsistencies in how backends generate signatures.
lib/twilio-ruby/security · high confidence
TwiML generation rewritten with Nokogiri and block-based builders
The TwiML library has been completely rewritten to use Nokogiri instead of libxml, improving XML generation reliability. The new API allows developers to build TwiML responses (Voice, Messaging, Fax) using Ruby blocks for cleaner, nested syntax, and supports adding comments, text nodes, and generic child elements. Attribute naming is now automatically converted from snake\_case to the required camelCase format, and the XML output is accessible via the standard \to\_s\ method (aliased as \to\_xml\).
lib/twilio-ruby/twiml · high confidence
Twilio Ruby SDK version 7.11.3 release
This update releases version 7.11.3 of the Twilio Ruby SDK. The change introduces new autoload files for the HTTP, REST, and Util modules to streamline library loading, while the Util module now emits deprecation warnings for the url\_encode and get\_string methods. Users upgrading to this version will see the new version constant and be alerted to deprecated utility functions.
lib/twilio-ruby · high confidence
Test coverage
Added Holodeck and Hologram test helper classes; Added RSpec test suite and test configuration; Added integration tests for Twilio API capabilities; Added test coverage for HTTP client behavior; Added test coverage for JWT token generation and capability scopes; Added test coverage for REST framework error handling, pagination, and token-based paging; Added test coverage for TwiML Messaging and Voice Response generators; Added test coverage for framework request handling, serialization, and versioned API actions; Added tests for REST client configuration, SSL validation, logging, and regional/edge URL handling; Added tests for Rack webhook authentication middleware; Added tests for RequestValidator configuration and signature validation; Added tests for configuration attributes and date URL encoding; Removed legacy SVN metadata and test files.
Dependencies
Update Ruby dependencies and lockfile
The project now pins specific versions for development and runtime dependencies via a new Gemfile and Gemfile.lock. Runtime dependencies are set to jwt (\>= 1.5, \< 4.0), nokogiri (\>= 1.6, \< 2.0), and faraday (\>= 2.0, \< 3.0). Development dependencies include rubocop (1.71.2), rspec (\~\> 3.0), and others, ensuring reproducible builds.
(dependencies) · high confidence
Housekeeping
Removed SVN metadata files; Removed Subversion metadata from lib directory.
Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
Score
- CAI 61 → 62 (+1.1)
- Rubric changed (rubric-2026.10.5 → rubric-2026.11.2) — scores are not directly comparable.
Lenses
- Code Health 75 → 75 (+0.0)
- Architecture 88 → 87 (-1.5)
- Maturity 50 → 56 (+5.7)
- Readiness 61 → 61 (+0.0)
- Security 76 → 65 (-11.0)
Resolved (6)
- Duplicate HTTP request capabilities across multiple layers. ClientBase, Domain, Version, and HTTP.Client all expose a request method with similar signatures. This creates ambiguity about which layer should be used for raw HTTP calls and leads to code duplication.
- Duplicate error types with overlapping intent. Both represent REST API errors with similar properties (code, message, status_code/response). RestErrorV10 appears to be a legacy or specific version variant, creating confusion for consumers who must choose between them or handle both.
- Inconsistent pagination API surface. Page, PageMetadata, and TokenPage all expose previous_page and next_page methods, but TokenPage also exposes previous_token and next_token. Furthermore, Page and PageMetadata duplicate the URL retrieval methods (previous_page_url, next_page_url) which could be abstracted or handled uniformly. The presence of TokenPage with token-based navigation alongside standard page-based navigation suggests a fragmented pagination strategy.
- Off-boarding risk: anonymized user #1
- Orphaned file (lib/twilio-ruby/rest/messaging.rb)
- Orphaned file (lib/twilio-ruby/security/request_validator.rb)
New (3)
- Further sole-owners (lower concentration)
- Low cohesion: V1 (LCOM4 5) (lib/twilio-ruby/rest/webhooks/v1.rb)
- Off-boarding risk: anonymized user #1
Changes since last survey
- 2 commits — 2 feature/other, 0 fixes
By area
- examples/WebhookSignatureValidation.md — 1 commit
- lib/twilio-ruby — 1 commit
Notable commits
- change: [Librarian] Release librarian/release-20261105-065257 (#821)
- change: chore: support HMAC-SHA256 webhook signatures in RequestValidator (#820)
Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
twilio/twilio-ruby was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 6 November 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit d9fbc889213650ae87126197646459790a2e5683 — the exact code this score is about.
- Scored under rubric-2026.11.2 — the same rubric and the same method as every other entry in this index.
- Measured by Canine Code Analyzer (cca.canine.dev) using cca measure-2026.11.2+preprod-5c4e66d9318b.