Class: Telnyx::Resources::Enterprises::Reputation::Numbers
- Inherits:
-
Object
- Object
- Telnyx::Resources::Enterprises::Reputation::Numbers
- Defined in:
- lib/telnyx/resources/enterprises/reputation/numbers.rb
Overview
Associate phone numbers with an enterprise for reputation monitoring and retrieve reputation scores
Instance Method Summary collapse
-
#associate(enterprise_id, phone_numbers:, request_options: {}) ⇒ Telnyx::Models::Enterprises::Reputation::NumberAssociateResponse
Associate one or more phone numbers with an enterprise for Number Reputation monitoring.
-
#disassociate(phone_number, enterprise_id:, request_options: {}) ⇒ nil
Remove a phone number from Number Reputation monitoring for an enterprise.
-
#initialize(client:) ⇒ Numbers
constructor
private
A new instance of Numbers.
-
#list(enterprise_id, page_number: nil, page_size: nil, phone_number: nil, request_options: {}) ⇒ Telnyx::Internal::DefaultFlatPagination<Telnyx::Models::ReputationPhoneNumberWithReputationData>
List all phone numbers associated with an enterprise for Number Reputation monitoring.
-
#retrieve(phone_number, enterprise_id:, fresh: nil, request_options: {}) ⇒ Telnyx::Models::Enterprises::Reputation::NumberRetrieveResponse
Some parameter documentations has been truncated, see Models::Enterprises::Reputation::NumberRetrieveParams for more details.
Constructor Details
#initialize(client:) ⇒ Numbers
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 Numbers.
167 168 169 |
# File 'lib/telnyx/resources/enterprises/reputation/numbers.rb', line 167 def initialize(client:) @client = client end |
Instance Method Details
#associate(enterprise_id, phone_numbers:, request_options: {}) ⇒ Telnyx::Models::Enterprises::Reputation::NumberAssociateResponse
Associate one or more phone numbers with an enterprise for Number Reputation monitoring.
Validations:
-
Phone numbers must be in E.164 format (e.g., ‘+16035551234`)
-
Phone numbers must be in-service and belong to your account (verified via Warehouse)
-
Phone numbers must be US local numbers
-
Phone numbers cannot already be associated with any enterprise
Note: This operation is atomic — if any number fails validation, the entire request fails.
Maximum: 100 phone numbers per request.
123 124 125 126 127 128 129 130 131 132 |
# File 'lib/telnyx/resources/enterprises/reputation/numbers.rb', line 123 def associate(enterprise_id, params) parsed, = Telnyx::Enterprises::Reputation::NumberAssociateParams.dump_request(params) @client.request( method: :post, path: ["enterprises/%1$s/reputation/numbers", enterprise_id], body: parsed, model: Telnyx::Models::Enterprises::Reputation::NumberAssociateResponse, options: ) end |
#disassociate(phone_number, enterprise_id:, request_options: {}) ⇒ nil
Remove a phone number from Number Reputation monitoring for an enterprise.
The number will no longer be tracked and reputation data will no longer be refreshed.
150 151 152 153 154 155 156 157 158 159 160 161 162 |
# File 'lib/telnyx/resources/enterprises/reputation/numbers.rb', line 150 def disassociate(phone_number, params) parsed, = Telnyx::Enterprises::Reputation::NumberDisassociateParams.dump_request(params) enterprise_id = parsed.delete(:enterprise_id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :delete, path: ["enterprises/%1$s/reputation/numbers/%2$s", enterprise_id, phone_number], model: NilClass, options: ) end |
#list(enterprise_id, page_number: nil, page_size: nil, phone_number: nil, request_options: {}) ⇒ Telnyx::Internal::DefaultFlatPagination<Telnyx::Models::ReputationPhoneNumberWithReputationData>
List all phone numbers associated with an enterprise for Number Reputation monitoring.
Returns phone numbers with their cached reputation data (if available). Supports pagination and filtering by phone number.
83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/telnyx/resources/enterprises/reputation/numbers.rb', line 83 def list(enterprise_id, params = {}) parsed, = Telnyx::Enterprises::Reputation::NumberListParams.dump_request(params) query = Telnyx::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["enterprises/%1$s/reputation/numbers", enterprise_id], query: query.transform_keys(page_number: "page[number]", page_size: "page[size]"), page: Telnyx::Internal::DefaultFlatPagination, model: Telnyx::ReputationPhoneNumberWithReputationData, options: ) end |
#retrieve(phone_number, enterprise_id:, fresh: nil, request_options: {}) ⇒ Telnyx::Models::Enterprises::Reputation::NumberRetrieveResponse
Some parameter documentations has been truncated, see Models::Enterprises::Reputation::NumberRetrieveParams for more details.
Get detailed reputation data for a specific phone number associated with an enterprise.
**Query Parameters:**
-
‘fresh` (default: `false`): When `true`, fetches fresh reputation data (incurs API cost). When `false`, returns cached data. If no cached data exists, fresh data is automatically fetched.
Returns:
-
‘spam_risk`: Overall spam risk level (`low`, `medium`, `high`)
-
‘spam_category`: Spam category classification
-
‘maturity_score`: Maturity metric (0–100)
-
‘connection_score`: Connection quality metric (0–100)
-
‘engagement_score`: Engagement metric (0–100)
-
‘sentiment_score`: Sentiment metric (0–100)
-
‘last_refreshed_at`: Timestamp of last data refresh
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/telnyx/resources/enterprises/reputation/numbers.rb', line 46 def retrieve(phone_number, params) parsed, = Telnyx::Enterprises::Reputation::NumberRetrieveParams.dump_request(params) query = Telnyx::Internal::Util.encode_query_params(parsed) enterprise_id = parsed.delete(:enterprise_id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :get, path: ["enterprises/%1$s/reputation/numbers/%2$s", enterprise_id, phone_number], query: query, model: Telnyx::Models::Enterprises::Reputation::NumberRetrieveResponse, options: ) end |