Class: Vonage::NumberInsight

Inherits:
Namespace
  • Object
show all
Defined in:
lib/vonage/number_insight.rb

Instance Method Summary collapse

Instance Method Details

#advanced(params) ⇒ Response

Provides advanced number insight information about a number synchronously.

Examples:

response = client.number_insight.advanced(number: '447700900000')

Parameters:

  • params (Hash)

Options Hash (params):

  • :number (required, String)

    A single phone number that you need insight about in national or international format.

  • :country (String)

    If a number does not have a country code or is uncertain, set the two-character country code. This code must be in ISO 3166-1 alpha-2 format and in upper case. For example, GB or US. If you set country and number is already in E.164 format, country must match the country code in number.

  • :cnam (Boolean)

    Indicates if the name of the person who owns the phone number should be looked up and returned in the response. Set to true to receive phone number owner name in the response. This features is available for US numbers only and incurs an additional charge.

  • :ip (String)

    The IP address of the user. If supplied, we will compare this to the country the user's phone is located in and return an error if it does not match.

Returns:

Raises:

See Also:



93
94
95
96
97
98
99
# File 'lib/vonage/number_insight.rb', line 93

def advanced(params)
  response = request('/ni/advanced/json', params: params)

  raise ServiceError.new(response: response), response[:status_message] unless response.status.zero?

  response
end

#advanced_async(params) ⇒ Response

Provides advanced number insight number information asynchronously using the URL specified in the callback parameter.

Examples:

response = client.number_insight.advanced_async(number: '447700900000', callback: webhook_url)

Parameters:

  • params (Hash)

Options Hash (params):

  • :callback (required, String)

    The callback URL.

  • :number (required, String)

    A single phone number that you need insight about in national or international format.

  • :country (String)

    If a number does not have a country code or is uncertain, set the two-character country code. This code must be in ISO 3166-1 alpha-2 format and in upper case. For example, GB or US. If you set country and number is already in E.164 format, country must match the country code in number.

  • :cnam (Boolean)

    Indicates if the name of the person who owns the phone number should be looked up and returned in the response. Set to true to receive phone number owner name in the response. This features is available for US numbers only and incurs an additional charge.

  • :ip (String)

    The IP address of the user. If supplied, we will compare this to the country the user's phone is located in and return an error if it does not match.

Returns:

Raises:

See Also:



132
133
134
135
136
137
138
# File 'lib/vonage/number_insight.rb', line 132

def advanced_async(params)
  response = request('/ni/advanced/async/json', params: params)

  raise ServiceError.new(response: response), response[:status_message] unless response.status.zero?

  response
end

#basic(params) ⇒ Response

Provides basic number insight information about a number.

Examples:

response = client.number_insight.basic(number: '447700900000')

Parameters:

  • params (Hash)

Options Hash (params):

  • :number (required, String)

    A single phone number that you need insight about in national or international format.

  • :country (String)

    If a number does not have a country code or is uncertain, set the two-character country code. This code must be in ISO 3166-1 alpha-2 format and in upper case. For example, GB or US. If you set country and number is already in E.164 format, country must match the country code in number.

Returns:

Raises:

See Also:



25
26
27
28
29
30
31
# File 'lib/vonage/number_insight.rb', line 25

def basic(params)
  response = request('/ni/basic/json', params: params)

  raise ServiceError.new(response: response), response[:status_message] unless response.status.zero?

  response
end

#standard(params) ⇒ Response

Provides standard number insight information about a number.

Examples:

response = client.number_insight.standard(number: '447700900000')

Parameters:

  • params (Hash)

Options Hash (params):

  • :number (required, String)

    A single phone number that you need insight about in national or international format.

  • :country (String)

    If a number does not have a country code or is uncertain, set the two-character country code. This code must be in ISO 3166-1 alpha-2 format and in upper case. For example, GB or US. If you set country and number is already in E.164 format, country must match the country code in number.

  • :cnam (Boolean)

    Indicates if the name of the person who owns the phone number should be looked up and returned in the response. Set to true to receive phone number owner name in the response. This features is available for US numbers only and incurs an additional charge.

Returns:

Raises:

See Also:



57
58
59
60
61
62
63
# File 'lib/vonage/number_insight.rb', line 57

def standard(params)
  response = request('/ni/standard/json', params: params)

  raise ServiceError.new(response: response), response[:status_message] unless response.status.zero?

  response
end