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::DefaultFlatPaginationForInexplicitNumberOrders<Telnyx::Models::Pricing::ProductListResponse>
Returns the full product catalog with pagination.
-
#retrieve(slug, 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.
70 71 72 |
# File 'lib/telnyx/resources/pricing/products.rb', line 70 def initialize(client:) @client = client end |
Instance Method Details
#list(page_number: nil, page_size: nil, request_options: {}) ⇒ Telnyx::Internal::DefaultFlatPaginationForInexplicitNumberOrders<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.
54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/telnyx/resources/pricing/products.rb', line 54 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, page: Telnyx::Internal::DefaultFlatPaginationForInexplicitNumberOrders, model: Telnyx::Models::Pricing::ProductListResponse, options: ) end |
#retrieve(slug, 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.
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/telnyx/resources/pricing/products.rb', line 27 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, model: Telnyx::Models::Pricing::ProductRetrieveResponse, options: ) end |