Class: Telnyx::Resources::Pricing::Products
- Inherits:
-
Object
- Object
- Telnyx::Resources::Pricing::Products
- Defined in:
- lib/telnyx/resources/pricing/products.rb,
sig/telnyx/resources/pricing/products.rbs
Overview
Public pricing operations
Instance Method Summary collapse
-
#initialize(client:) ⇒ Products
constructor
private
A new instance of Products.
-
#list(page_number: nil, page_size: nil, request_options: {}) ⇒ Telnyx::Internal::DefaultFlatPagination<Telnyx::Models::Pricing::ProductListResponse>
Returns the full product catalog with pagination.
-
#retrieve(slug, filter_country_iso: nil, page_number: nil, page_size: nil, request_options: {}) ⇒ Telnyx::Models::Pricing::ProductRetrieveResponse
Returns pricing entries for a single product.
Constructor Details
#initialize(client:) ⇒ Products
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Products.
76 77 78 |
# File 'lib/telnyx/resources/pricing/products.rb', line 76 def initialize(client:) @client = client end |
Instance Method Details
#list(page_number: nil, page_size: nil, request_options: {}) ⇒ Telnyx::Internal::DefaultFlatPagination<Telnyx::Models::Pricing::ProductListResponse>
Returns the full product catalog with pagination. Each entry contains a slug, display name, and description. Use the slug to fetch per-product pricing via GET /pricing/products/slug.
60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/telnyx/resources/pricing/products.rb', line 60 def list(params = {}) parsed, = Telnyx::Pricing::ProductListParams.dump_request(params) query = Telnyx::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "pricing/products", query: query.transform_keys(page_number: "page[number]", page_size: "page[size]"), page: Telnyx::Internal::DefaultFlatPagination, model: Telnyx::Models::Pricing::ProductListResponse, options: ) end |
#retrieve(slug, filter_country_iso: nil, page_number: nil, page_size: nil, request_options: {}) ⇒ Telnyx::Models::Pricing::ProductRetrieveResponse
Returns pricing entries for a single product. Most products return standard rate entries with fields like rate, unit, country_iso, direction, and tiers. Inference products return model-specific fields (model, input_rate, output_rate, cached_input_rate) with tiered pricing. Some products use rate decks (pricing_type: rate_deck) where rates are determined dynamically.
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/telnyx/resources/pricing/products.rb', line 29 def retrieve(slug, params = {}) parsed, = Telnyx::Pricing::ProductRetrieveParams.dump_request(params) query = Telnyx::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["pricing/products/%1$s", slug], query: query.transform_keys( filter_country_iso: "filter[country_iso]", page_number: "page[number]", page_size: "page[size]" ), model: Telnyx::Models::Pricing::ProductRetrieveResponse, options: ) end |