Class: Tomba::Domain

Inherits:
Service show all
Defined in:
lib/tomba/services/domain.rb

Overview

Domain Search service.

Search emails associated with a domain.

Instance Method Summary collapse

Methods inherited from Service

#initialize

Constructor Details

This class inherits a constructor from Tomba::Service

Instance Method Details

#domain_search(domain:, page: nil, limit: nil, department: nil, enrich_mobile: nil, webhook_url: nil) ⇒ Hash

Domain Search

Returns all email addresses found for a given domain.

Parameters:

  • domain (String)

    the domain name to search

  • page (Integer, nil) (defaults to: nil)

    the page number for pagination

  • limit (Integer, nil) (defaults to: nil)

    the number of results per page

  • department (String, nil) (defaults to: nil)

    filter by department

  • enrich_mobile (Boolean, nil) (defaults to: nil)

    whether to enrich mobile phone data

  • webhook_url (String, nil) (defaults to: nil)

    webhook URL for async notifications

Returns:

  • (Hash)

    API response containing the list of emails

Raises:

See Also:



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/tomba/services/domain.rb', line 23

def domain_search(domain:, page: nil, limit: nil, department: nil, enrich_mobile: nil, webhook_url: nil)
  raise Tomba::Exception, 'Missing required parameter: "domain"' if domain.nil?

  path = '/domain-search/'

  params = {}

  params[:domain] = domain unless domain.nil?
  params[:page] = page unless page.nil?
  params[:limit] = limit unless limit.nil?
  params[:department] = department unless department.nil?
  params[:enrich_mobile] = enrich_mobile unless enrich_mobile.nil?
  params[:webhook_url] = webhook_url unless webhook_url.nil?

  @client.call('get', path, {
                 'content-type' => 'application/json'
               }, params)
end