Pagination
List methods in the Telnyx API are paginated. This library provides auto-paginating iterators with each list response, so you do not have to request successive pages manually:#next_page? and #next_page methods for more granular control working with pages.
File uploads
Request parameters that correspond to file uploads can be passed as raw contents, aPathname instance, StringIO, or more.
IO descriptor, but this disables retries, as the library can’t be sure if the descriptor is a file or pipe (which cannot be rewound).
BaseModel
All parameter and response objects inherit fromTelnyx::Internal::Type::BaseModel, which provides several conveniences, including:
-
All fields, including unknown ones, are accessible with
obj[:prop]syntax, and can be destructured withobj => {prop: prop}or pattern-matching syntax. - Structural equivalence for equality; if two API calls return the same values, comparing the responses with == will return true.
- Both instances and the classes themselves can be pretty-printed.
-
Helpers such as
#to_h,#deep_to_h,#to_json, and#to_yaml.
Sorbet
This library provides comprehensive RBI definitions, and has no dependency on sorbet-runtime. You can provide typesafe request parameters like so:Enums
Since this library does not depend onsorbet-runtime, it cannot provide T::Enum instances. Instead, we provide “tagged symbols” instead, which is always a primitive at runtime: