Class: Tomba::Phone
Overview
Phone service for phone number lookup and validation.
Provides methods to find and validate phone numbers.
Instance Method Summary collapse
-
#finder(params, webhook_url: nil) ⇒ Hash
Phone Finder.
-
#validator(phone, country_code: nil) ⇒ Hash
Phone Validator.
Methods inherited from Service
Constructor Details
This class inherits a constructor from Tomba::Service
Instance Method Details
#finder(params, webhook_url: nil) ⇒ Hash
Phone Finder
Finds a phone number using search parameters.
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/tomba/services/phone.rb', line 19 def finder(params, webhook_url: nil) raise Tomba::Exception, 'Missing required parameter: "params"' if params.nil? || params.empty? path = '/phone-finder' params[:webhook_url] = webhook_url unless webhook_url.nil? @client.call('get', path, { 'content-type' => 'application/json' }, params) end |
#validator(phone, country_code: nil) ⇒ Hash
Phone Validator
Validates a phone number and returns detailed information about it.
40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/tomba/services/phone.rb', line 40 def validator(phone, country_code: nil) raise Tomba::Exception, 'Missing required parameter: "phone"' if phone.nil? path = '/phone-validator' params = { phone: phone } params[:country_code] = country_code unless country_code.nil? @client.call('get', path, { 'content-type' => 'application/json' }, params) end |