Class: Telnyx::Resources::Enterprises

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

Overview

Manage the legal-entity record that owns your DIRs and phone numbers.

Defined Under Namespace

Classes: Dir, Reputation, Usage

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Enterprises

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

Parameters:



284
285
286
287
288
289
# File 'lib/telnyx/resources/enterprises.rb', line 284

def initialize(client:)
  @client = client
  @reputation = Telnyx::Resources::Enterprises::Reputation.new(client: client)
  @dir = Telnyx::Resources::Enterprises::Dir.new(client: client)
  @usage = Telnyx::Resources::Enterprises::Usage.new(client: client)
end

Instance Attribute Details

#dirTelnyx::Resources::Enterprises::Dir (readonly)

A Display Identity Record (DIR) is the verified calling identity (display name, logo, call reasons) shown to recipients on outbound calls.



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

def dir
  @dir
end

#reputationTelnyx::Resources::Enterprises::Reputation (readonly)

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



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

def reputation
  @reputation
end

#usageTelnyx::Resources::Enterprises::Usage (readonly)



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

def usage
  @usage
end

Instance Method Details

#activate_branded_calling(enterprise_id, request_options: {}) ⇒ Telnyx::Models::EnterpriseActivateBrandedCallingResponse

Branded Calling is a paid product that must be activated on each enterprise. Activation is idempotent:

  • First call: marks the enterprise as activated and begins onboarding it with the Branded Calling platform asynchronously. Returns ‘200` with `branded_calling_enabled: true`.

  • Re-call after success: no-op, returns the same enterprise body.

  • Re-call after a prior failure: re-queues onboarding, returns ‘200`.

Prerequisite: the calling user must have agreed to the Branded Calling Terms of Service (‘POST /terms_of_service/branded_calling/agree`). Without that, this endpoint returns `403 terms_of_service_not_accepted`.

Failure modes:

  • ‘403` - Branded Calling Terms of Service not accepted.

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

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

Parameters:

  • enterprise_id (String)

    The enterprise id. Lowercase UUID.

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

Returns:

See Also:



272
273
274
275
276
277
278
279
# File 'lib/telnyx/resources/enterprises.rb', line 272

def activate_branded_calling(enterprise_id, params = {})
  @client.request(
    method: :post,
    path: ["enterprises/%1$s/branded_calling", enterprise_id],
    model: Telnyx::Models::EnterpriseActivateBrandedCallingResponse,
    options: params[:request_options]
  )
end

#create(billing_address:, billing_contact:, country_code:, doing_business_as:, fein:, industry:, jurisdiction_of_incorporation:, legal_name:, number_of_employees:, organization_contact:, organization_legal_type:, organization_physical_address:, organization_type:, website:, corporate_registration_number: nil, customer_reference: nil, dun_bradstreet_number: nil, primary_business_domain_sic_code: nil, professional_license_number: nil, role_type: nil, request_options: {}) ⇒ Telnyx::Models::EnterpriseCreateResponse

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

Create the legal entity (enterprise) that represents your business on the Telnyx platform.

The response carries a server-assigned ‘id` you use for every subsequent call. An enterprise is created once and reused; the API collects all required fields up front.

Common failure modes:

  • ‘422` - a required field is missing or malformed (the response `errors[].source.pointer` names the field).

  • ‘409` - an enterprise with the same identifying details already exists under your account.

Parameters:

Returns:

See Also:



83
84
85
86
87
88
89
90
91
92
# File 'lib/telnyx/resources/enterprises.rb', line 83

def create(params)
  parsed, options = Telnyx::EnterpriseCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "enterprises",
    body: parsed,
    model: Telnyx::Models::EnterpriseCreateResponse,
    options: options
  )
end

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

Soft-delete an enterprise.

Failure modes:

  • ‘400` - the enterprise still has dependent resources in a non-deletable state. Remove those first; the response `detail` identifies what is blocking the delete.

  • ‘409` - the enterprise has a dependent resource with an unresolved claim. Resolve it before deleting.

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

Parameters:

  • enterprise_id (String)

    The enterprise id. Lowercase UUID.

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

Returns:

  • (nil)

See Also:



233
234
235
236
237
238
239
240
# File 'lib/telnyx/resources/enterprises.rb', line 233

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

#list(filter_legal_name_contains: nil, legal_name: nil, page_number: nil, page_size: nil, request_options: {}) ⇒ Telnyx::Internal::DefaultFlatPagination<Telnyx::Models::EnterprisePublic>

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

Return the enterprises you own, paginated. The default page size is 20; the maximum is 250.

Parameters:

  • filter_legal_name_contains (String)

    Case-insensitive partial match on legal name.

  • legal_name (String)

    Filter by legal name (partial match).

  • page_number (Integer)

    1-based page number. Out-of-range values return an empty page with correct meta.

  • page_size (Integer)

    Items per page. Default 10. Maximum 250; values above are clamped to 250.

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

Returns:

See Also:



196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
# File 'lib/telnyx/resources/enterprises.rb', line 196

def list(params = {})
  parsed, options = Telnyx::EnterpriseListParams.dump_request(params)
  query = Telnyx::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "enterprises",
    query: query.transform_keys(
      filter_legal_name_contains: "filter[legal_name][contains]",
      page_number: "page[number]",
      page_size: "page[size]"
    ),
    page: Telnyx::Internal::DefaultFlatPagination,
    model: Telnyx::EnterprisePublic,
    options: options
  )
end

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

Retrieve a single enterprise by id. Returns ‘404` if the id does not exist or does not belong to your account.

Parameters:

  • enterprise_id (String)

    The enterprise id. Lowercase UUID.

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

Returns:

See Also:



106
107
108
109
110
111
112
113
# File 'lib/telnyx/resources/enterprises.rb', line 106

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

#update(enterprise_id, billing_address: nil, billing_contact: nil, corporate_registration_number: nil, customer_reference: nil, doing_business_as: nil, dun_bradstreet_number: nil, fein: nil, industry: nil, jurisdiction_of_incorporation: nil, legal_name: nil, number_of_employees: nil, organization_contact: nil, organization_legal_type: nil, organization_physical_address: nil, primary_business_domain_sic_code: nil, professional_license_number: nil, website: nil, request_options: {}) ⇒ Telnyx::Models::EnterpriseUpdateResponse

Replace the enterprise’s mutable fields. Only mutable fields may be sent. Server-assigned and immutable fields (‘id`, `record_type`, `created_at`, `updated_at`, status fields, `organization_type`, `country_code`, `role_type`) cannot be changed: including any of them in the body is rejected with `400 Bad Request` (`Field ’X’ is not allowed in this request`).

Parameters:

Returns:

See Also:



164
165
166
167
168
169
170
171
172
173
# File 'lib/telnyx/resources/enterprises.rb', line 164

def update(enterprise_id, params = {})
  parsed, options = Telnyx::EnterpriseUpdateParams.dump_request(params)
  @client.request(
    method: :put,
    path: ["enterprises/%1$s", enterprise_id],
    body: parsed,
    model: Telnyx::Models::EnterpriseUpdateResponse,
    options: options
  )
end