Class: Telnyx::Resources::Enterprises::Reputation

Inherits:
Object
  • Object
show all
Defined in:
lib/telnyx/resources/enterprises/reputation.rb,
lib/telnyx/resources/enterprises/reputation/loa.rb,
lib/telnyx/resources/enterprises/reputation/numbers.rb,
lib/telnyx/resources/enterprises/reputation/remediation.rb

Overview

Phone-number reputation monitoring (spam-score lookup and tracking).

Defined Under Namespace

Classes: Loa, Numbers, Remediation

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Reputation

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 Reputation.

Parameters:



147
148
149
150
151
152
# File 'lib/telnyx/resources/enterprises/reputation.rb', line 147

def initialize(client:)
  @client = client
  @numbers = Telnyx::Resources::Enterprises::Reputation::Numbers.new(client: client)
  @loa = Telnyx::Resources::Enterprises::Reputation::Loa.new(client: client)
  @remediation = Telnyx::Resources::Enterprises::Reputation::Remediation.new(client: client)
end

Instance Attribute Details

#loaTelnyx::Resources::Enterprises::Reputation::Loa (readonly)

Phone-number reputation monitoring (spam-score lookup and tracking).



14
15
16
# File 'lib/telnyx/resources/enterprises/reputation.rb', line 14

def loa
  @loa
end

#numbersTelnyx::Resources::Enterprises::Reputation::Numbers (readonly)

Phone-number reputation monitoring (spam-score lookup and tracking).



10
11
12
# File 'lib/telnyx/resources/enterprises/reputation.rb', line 10

def numbers
  @numbers
end

#remediationTelnyx::Resources::Enterprises::Reputation::Remediation (readonly)

Phone-number reputation monitoring (spam-score lookup and tracking).



18
19
20
# File 'lib/telnyx/resources/enterprises/reputation.rb', line 18

def remediation
  @remediation
end

Instance Method Details

#disable(enterprise_id, request_options: {}) ⇒ nil

Disable Phone Number Reputation. All registered numbers are de-registered as a cascade. The enterprise itself is unaffected. Returns ‘204` on success, `404` if reputation is not enabled for this enterprise.

Parameters:

  • enterprise_id (String)

    The enterprise id. Lowercase UUID.

  • request_options (Telnyx::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

  • (nil)

See Also:



58
59
60
61
62
63
64
65
# File 'lib/telnyx/resources/enterprises/reputation.rb', line 58

def disable(enterprise_id, params = {})
  @client.request(
    method: :delete,
    path: ["enterprises/%1$s/reputation", enterprise_id],
    model: NilClass,
    options: params[:request_options]
  )
end

#enable(enterprise_id, loa_document_id:, check_frequency: nil, request_options: {}) ⇒ Telnyx::Models::Enterprises::ReputationEnableResponse

Some parameter documentations has been truncated, see Models::Enterprises::ReputationEnableParams for more details.

Activate Phone Number Reputation for the given enterprise. Requires an uploaded Letter of Authorization document (the ‘loa_document_id` references the Telnyx Documents API) and a refresh-frequency selection. After activation, individual phone numbers can be registered via `POST …/reputation/numbers`.

Prerequisite: the calling user must have agreed to the Phone Number Reputation Terms of Service (‘POST /terms_of_service/number_reputation/agree`).

Failure modes:

  • ‘403` - Phone Number Reputation Terms of Service not accepted.

  • ‘404` - enterprise does not exist or does not belong to your account.

  • ‘400` - reputation already enabled for this enterprise.

  • ‘422` - `loa_document_id` missing or `check_frequency` invalid.

Pricing: This is a billable action. See telnyx.com/pricing/numbers for current pricing.

Parameters:

Returns:

See Also:



101
102
103
104
105
106
107
108
109
110
# File 'lib/telnyx/resources/enterprises/reputation.rb', line 101

def enable(enterprise_id, params)
  parsed, options = Telnyx::Enterprises::ReputationEnableParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["enterprises/%1$s/reputation", enterprise_id],
    body: parsed,
    model: Telnyx::Models::Enterprises::ReputationEnableResponse,
    options: options
  )
end

#retrieve(enterprise_id, request_options: {}) ⇒ Telnyx::Models::Enterprises::ReputationRetrieveResponse

Phone Number Reputation tracks how your outbound caller-IDs are perceived (spam risk, engagement, etc.) across the call-screening ecosystem. This endpoint reads the enterprise-level settings: whether the product is enabled, the refresh cadence, and the stored Letter of Authorization document id.

Returns ‘404` if reputation has never been enabled for this enterprise.

Parameters:

  • enterprise_id (String)

    The enterprise id. Lowercase UUID.

  • request_options (Telnyx::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



36
37
38
39
40
41
42
43
# File 'lib/telnyx/resources/enterprises/reputation.rb', line 36

def retrieve(enterprise_id, params = {})
  @client.request(
    method: :get,
    path: ["enterprises/%1$s/reputation", enterprise_id],
    model: Telnyx::Models::Enterprises::ReputationRetrieveResponse,
    options: params[:request_options]
  )
end

#update_frequency(enterprise_id, check_frequency:, request_options: {}) ⇒ Telnyx::Models::Enterprises::ReputationUpdateFrequencyResponse

Some parameter documentations has been truncated, see Models::Enterprises::ReputationUpdateFrequencyParams for more details.

Update how often Telnyx refreshes the reputation data for this enterprise’s registered numbers. The new frequency takes effect on the next scheduled refresh.

The enterprise’s reputation must be in ‘approved` status. A request made while the status is `pending` is rejected with `400 Bad Request`.

Parameters:

Returns:

See Also:



133
134
135
136
137
138
139
140
141
142
# File 'lib/telnyx/resources/enterprises/reputation.rb', line 133

def update_frequency(enterprise_id, params)
  parsed, options = Telnyx::Enterprises::ReputationUpdateFrequencyParams.dump_request(params)
  @client.request(
    method: :patch,
    path: ["enterprises/%1$s/reputation/frequency", enterprise_id],
    body: parsed,
    model: Telnyx::Models::Enterprises::ReputationUpdateFrequencyResponse,
    options: options
  )
end