Class: Sentdm::Resources::Numbers

Inherits:
Object
  • Object
show all
Defined in:
lib/sentdm/resources/numbers.rb

Overview

Manage and lookup phone numbers

Instance Method Summary collapse

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.

Parameters:



39
40
41
# File 'lib/sentdm/resources/numbers.rb', line 39

def initialize(client:)
  @client = client
end

Instance Method Details

#lookup(phone_number, x_profile_id: nil, request_options: {}) ⇒ Sentdm::Models::NumberLookupResponse

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

Retrieves detailed information about a phone number including carrier, line type, porting status, and VoIP detection. Uses the customer’s messaging provider for rich data, with fallback to the internal index.

Parameters:

  • phone_number (String)
  • x_profile_id (String)

    Profile UUID to scope the request to a child profile. Only organization API keys

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

Returns:

See Also:



25
26
27
28
29
30
31
32
33
34
# File 'lib/sentdm/resources/numbers.rb', line 25

def lookup(phone_number, params = {})
  parsed, options = Sentdm::NumberLookupParams.dump_request(params)
  @client.request(
    method: :get,
    path: ["v3/numbers/lookup/%1$s", phone_number],
    headers: parsed.transform_keys(x_profile_id: "x-profile-id"),
    model: Sentdm::Models::NumberLookupResponse,
    options: options
  )
end