tomba 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,59 +1,84 @@
1
- module Tomba
2
- class LeadsLists < Service
3
-
4
- def get_lists()
5
- path = '/leads_lists/{id}'
6
-
7
- params = {}
8
-
9
- return @client.call('get', path, {
10
- 'content-type' => 'application/json',
11
- }, params);
12
- end
13
-
14
- def delete_list_id(id:)
15
- if id.nil?
16
- raise Tomba::Exception.new('Missing required parameter: "id"')
17
- end
18
-
19
- path = '/leads_lists/{id}'
20
- .gsub('{id}', id)
21
-
22
- params = {}
23
-
24
- return @client.call('delete', path, {
25
- 'content-type' => 'application/json',
26
- }, params);
27
- end
28
-
29
- def create_list()
30
- path = '/leads_lists/{id}'
1
+ # frozen_string_literal: true
31
2
 
32
- params = {}
33
-
34
- return @client.call('post', path, {
35
- 'content-type' => 'application/json',
36
- }, params);
37
- end
38
-
39
- def update_list_id(id:)
40
- if id.nil?
41
- raise Tomba::Exception.new('Missing required parameter: "id"')
42
- end
43
-
44
- path = '/leads_lists/{id}'
45
- .gsub('{id}', id)
46
-
47
- params = {}
48
-
49
- return @client.call('put', path, {
50
- 'content-type' => 'application/json',
51
- }, params);
52
- end
53
-
54
-
55
- protected
56
-
57
- private
58
- end
59
- end
3
+ module Tomba
4
+ # Leads Lists service for managing lead lists.
5
+ #
6
+ # Provides methods to list, create, update, and delete lead lists.
7
+ #
8
+ # @see https://docs.tomba.io/api/leads-lists
9
+ class LeadsLists < Service
10
+ # List all leads lists.
11
+ #
12
+ # Returns all leads lists associated with the account.
13
+ #
14
+ # @see https://docs.tomba.io/api/leads-lists#list-leads-lists
15
+ # @return [Hash] API response containing the lists
16
+ # @raise [Tomba::Exception]
17
+ def get_lists
18
+ path = '/leads_lists'
19
+
20
+ params = {}
21
+
22
+ @client.call('get', path, {
23
+ 'content-type' => 'application/json'
24
+ }, params)
25
+ end
26
+
27
+ # Delete a leads list.
28
+ #
29
+ # Removes a specific leads list by its ID.
30
+ #
31
+ # @see https://docs.tomba.io/api/leads-lists#delete-leads-list
32
+ # @param id [String] the list ID to delete
33
+ # @return [Hash] API response
34
+ # @raise [Tomba::Exception]
35
+ def delete_list_id(id:)
36
+ raise Tomba::Exception, 'Missing required parameter: "id"' if id.nil?
37
+
38
+ path = "/leads_lists/#{id}"
39
+
40
+ params = {}
41
+
42
+ @client.call('delete', path, {
43
+ 'content-type' => 'application/json'
44
+ }, params)
45
+ end
46
+
47
+ # Create a new leads list.
48
+ #
49
+ # Creates a new leads list for organizing leads.
50
+ #
51
+ # @see https://docs.tomba.io/api/leads-lists#create-leads-list
52
+ # @return [Hash] API response containing the new list
53
+ # @raise [Tomba::Exception]
54
+ def create_list
55
+ path = '/leads_lists'
56
+
57
+ params = {}
58
+
59
+ @client.call('post', path, {
60
+ 'content-type' => 'application/json'
61
+ }, params)
62
+ end
63
+
64
+ # Update a leads list.
65
+ #
66
+ # Updates a specific leads list by its ID.
67
+ #
68
+ # @see https://docs.tomba.io/api/leads-lists#update-leads-list
69
+ # @param id [String] the list ID to update
70
+ # @return [Hash] API response
71
+ # @raise [Tomba::Exception]
72
+ def update_list_id(id:)
73
+ raise Tomba::Exception, 'Missing required parameter: "id"' if id.nil?
74
+
75
+ path = "/leads_lists/#{id}"
76
+
77
+ params = {}
78
+
79
+ @client.call('put', path, {
80
+ 'content-type' => 'application/json'
81
+ }, params)
82
+ end
83
+ end
84
+ end
@@ -0,0 +1,108 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Tomba
4
+ # Leads service for managing individual leads.
5
+ #
6
+ # Provides methods to list, get, create, update, and delete leads.
7
+ #
8
+ # @see https://docs.tomba.io/api/leads
9
+ class Leads < Service
10
+ # List Leads
11
+ #
12
+ # Returns a paginated list of leads.
13
+ #
14
+ # @see https://docs.tomba.io/api/leads
15
+ # @param page [Integer, nil] the page number for pagination
16
+ # @param limit [Integer, nil] the number of results per page
17
+ # @param domain [String, nil] filter leads by domain
18
+ # @return [Hash] API response containing the list of leads
19
+ # @raise [Tomba::Exception]
20
+ def list_leads(page: nil, limit: nil, domain: nil)
21
+ path = '/leads'
22
+
23
+ params = {}
24
+ params[:page] = page unless page.nil?
25
+ params[:limit] = limit unless limit.nil?
26
+ params[:domain] = domain unless domain.nil?
27
+
28
+ @client.call('get', path, {
29
+ 'content-type' => 'application/json'
30
+ }, params)
31
+ end
32
+
33
+ # Get Lead
34
+ #
35
+ # Returns a specific lead by its ID.
36
+ #
37
+ # @see https://docs.tomba.io/api/leads#retrieve-a-single-lead
38
+ # @param id [String] the lead ID
39
+ # @return [Hash] API response containing the lead data
40
+ # @raise [Tomba::Exception]
41
+ def get_lead(id)
42
+ raise Tomba::Exception, 'Missing required parameter: "id"' if id.nil?
43
+
44
+ path = "/leads/#{id}"
45
+
46
+ params = {}
47
+
48
+ @client.call('get', path, {
49
+ 'content-type' => 'application/json'
50
+ }, params)
51
+ end
52
+
53
+ # Create Lead
54
+ #
55
+ # Creates a new lead with the provided data.
56
+ #
57
+ # @see https://docs.tomba.io/api/leads#create-a-lead
58
+ # @param data [Hash] the lead data (e.g., email, first_name, last_name)
59
+ # @return [Hash] API response containing the created lead
60
+ # @raise [Tomba::Exception]
61
+ def create_lead(**data)
62
+ path = '/leads'
63
+
64
+ @client.call('post', path, {
65
+ 'content-type' => 'application/json'
66
+ }, data)
67
+ end
68
+
69
+ # Update Lead
70
+ #
71
+ # Updates an existing lead by its ID.
72
+ #
73
+ # @see https://docs.tomba.io/api/leads#update-a-lead
74
+ # @param id [String] the lead ID to update
75
+ # @param data [Hash] the lead data to update
76
+ # @return [Hash] API response containing the updated lead
77
+ # @raise [Tomba::Exception]
78
+ def update_lead(id, **data)
79
+ raise Tomba::Exception, 'Missing required parameter: "id"' if id.nil?
80
+
81
+ path = "/leads/#{id}"
82
+
83
+ @client.call('put', path, {
84
+ 'content-type' => 'application/json'
85
+ }, data)
86
+ end
87
+
88
+ # Delete Lead
89
+ #
90
+ # Deletes a specific lead by its ID.
91
+ #
92
+ # @see https://docs.tomba.io/api/leads#delete-a-lead
93
+ # @param id [String] the lead ID to delete
94
+ # @return [Hash] API response
95
+ # @raise [Tomba::Exception]
96
+ def delete_lead(id)
97
+ raise Tomba::Exception, 'Missing required parameter: "id"' if id.nil?
98
+
99
+ path = "/leads/#{id}"
100
+
101
+ params = {}
102
+
103
+ @client.call('delete', path, {
104
+ 'content-type' => 'application/json'
105
+ }, params)
106
+ end
107
+ end
108
+ end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Tomba
4
+ # Location service for retrieving company location data.
5
+ #
6
+ # Provides methods to get the geographic location associated with a domain.
7
+ #
8
+ # @see https://docs.tomba.io/api/finder#location
9
+ class Location < Service
10
+ # Get Location
11
+ #
12
+ # Returns the geographic location information for a given domain.
13
+ #
14
+ # @see https://docs.tomba.io/api/finder#location#get-location
15
+ # @param domain [String] the domain name to look up location for
16
+ # @return [Hash] API response containing location data
17
+ # @raise [Tomba::Exception]
18
+ def get_location(domain)
19
+ raise Tomba::Exception, 'Missing required parameter: "domain"' if domain.nil?
20
+
21
+ path = '/location'
22
+
23
+ params = { domain: domain }
24
+
25
+ @client.call('get', path, {
26
+ 'content-type' => 'application/json'
27
+ }, params)
28
+ end
29
+ end
30
+ end
@@ -1,19 +1,31 @@
1
- module Tomba
2
- class Logs < Service
3
-
4
- def get_logs()
5
- path = '/logs'
6
-
7
- params = {}
8
-
9
- return @client.call('get', path, {
10
- 'content-type' => 'application/json',
11
- }, params);
12
- end
1
+ # frozen_string_literal: true
13
2
 
3
+ module Tomba
4
+ # Logs service for retrieving API request logs.
5
+ #
6
+ # Provides methods to get the history of API requests.
7
+ #
8
+ # @see https://docs.tomba.io/api/account#retrieve-api-logs
9
+ class Logs < Service
10
+ # Get Logs
11
+ #
12
+ # Returns the log history of API requests.
13
+ #
14
+ # @see https://docs.tomba.io/api/account#retrieve-api-logs#get-logs
15
+ # @param page [Integer, nil] the page number for pagination
16
+ # @param limit [Integer, nil] the number of results per page
17
+ # @return [Hash] API response containing log entries
18
+ # @raise [Tomba::Exception]
19
+ def get_logs(page: nil, limit: nil)
20
+ path = '/logs'
14
21
 
15
- protected
22
+ params = {}
23
+ params[:page] = page unless page.nil?
24
+ params[:limit] = limit unless limit.nil?
16
25
 
17
- private
18
- end
19
- end
26
+ @client.call('get', path, {
27
+ 'content-type' => 'application/json'
28
+ }, params)
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,53 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Tomba
4
+ # Phone service for phone number lookup and validation.
5
+ #
6
+ # Provides methods to find and validate phone numbers.
7
+ #
8
+ # @see https://docs.tomba.io/api/phone
9
+ class Phone < Service
10
+ # Phone Finder
11
+ #
12
+ # Finds a phone number using search parameters.
13
+ #
14
+ # @see https://docs.tomba.io/api/phone#phone-finder
15
+ # @param params [Hash] search parameters (e.g., email, domain)
16
+ # @param webhook_url [String, nil] webhook URL for async notifications
17
+ # @return [Hash] API response containing phone number data
18
+ # @raise [Tomba::Exception]
19
+ def finder(params, webhook_url: nil)
20
+ raise Tomba::Exception, 'Missing required parameter: "params"' if params.nil? || params.empty?
21
+
22
+ path = '/phone-finder'
23
+
24
+ params[:webhook_url] = webhook_url unless webhook_url.nil?
25
+
26
+ @client.call('get', path, {
27
+ 'content-type' => 'application/json'
28
+ }, params)
29
+ end
30
+
31
+ # Phone Validator
32
+ #
33
+ # Validates a phone number and returns detailed information about it.
34
+ #
35
+ # @see https://docs.tomba.io/api/phone#phone-validator
36
+ # @param phone [String] the phone number to validate
37
+ # @param country_code [String, nil] optional ISO country code (e.g., "US")
38
+ # @return [Hash] API response containing validation results
39
+ # @raise [Tomba::Exception]
40
+ def validator(phone, country_code: nil)
41
+ raise Tomba::Exception, 'Missing required parameter: "phone"' if phone.nil?
42
+
43
+ path = '/phone-validator'
44
+
45
+ params = { phone: phone }
46
+ params[:country_code] = country_code unless country_code.nil?
47
+
48
+ @client.call('get', path, {
49
+ 'content-type' => 'application/json'
50
+ }, params)
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Tomba
4
+ # Reveal service for company search.
5
+ #
6
+ # Provides methods to search for companies.
7
+ #
8
+ # @see https://docs.tomba.io/api/reveal
9
+ class Reveal < Service
10
+ # Companies Search
11
+ #
12
+ # Searches for companies matching the given parameters.
13
+ #
14
+ # @see https://docs.tomba.io/api/reveal#companies-search
15
+ # @param params [Hash] search parameters (e.g., query, page, limit)
16
+ # @return [Hash] API response containing matching companies
17
+ # @raise [Tomba::Exception]
18
+ def companies_search(params)
19
+ raise Tomba::Exception, 'Missing required parameter: "params"' if params.nil? || params.empty?
20
+
21
+ path = '/reveal'
22
+
23
+ @client.call('get', path, {
24
+ 'content-type' => 'application/json'
25
+ }, params)
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Tomba
4
+ # Similar service for finding similar websites.
5
+ #
6
+ # Provides methods to find websites similar to a given domain.
7
+ #
8
+ # @see https://docs.tomba.io/api/similar
9
+ class Similar < Service
10
+ # Similar Websites
11
+ #
12
+ # Returns a list of websites similar to the given domain.
13
+ #
14
+ # @see https://docs.tomba.io/api/similar#similar-websites
15
+ # @param domain [String] the domain name to find similar websites for
16
+ # @return [Hash] API response containing similar websites
17
+ # @raise [Tomba::Exception]
18
+ def websites(domain)
19
+ raise Tomba::Exception, 'Missing required parameter: "domain"' if domain.nil?
20
+
21
+ path = '/similar'
22
+
23
+ params = { domain: domain }
24
+
25
+ @client.call('get', path, {
26
+ 'content-type' => 'application/json'
27
+ }, params)
28
+ end
29
+ end
30
+ end
@@ -1,24 +1,31 @@
1
- module Tomba
2
- class Sources < Service
3
-
4
- def email_sources(email:)
5
- if email.nil?
6
- raise Tomba::Exception.new('Missing required parameter: "email"')
7
- end
8
-
9
- path = '/email-sources/{email}'
10
- .gsub('{email}', email)
1
+ # frozen_string_literal: true
11
2
 
12
- params = {}
13
-
14
- return @client.call('get', path, {
15
- 'content-type' => 'application/json',
16
- }, params);
17
- end
3
+ module Tomba
4
+ # Sources service for finding email sources.
5
+ #
6
+ # Provides methods to retrieve the sources where an email was found.
7
+ #
8
+ # @see https://docs.tomba.io/api/sources
9
+ class Sources < Service
10
+ # Email Sources
11
+ #
12
+ # Retrieves the sources where an email address has been found on the web.
13
+ #
14
+ # @see https://docs.tomba.io/api/sources#email-sources
15
+ # @param email [String] the email address to look up sources for
16
+ # @return [Hash] API response containing source information
17
+ # @raise [Tomba::Exception]
18
+ def email_sources(email:)
19
+ raise Tomba::Exception, 'Missing required parameter: "email"' if email.nil?
18
20
 
21
+ path = '/email-sources'
19
22
 
20
- protected
23
+ params = {}
24
+ params[:email] = email unless email.nil?
21
25
 
22
- private
23
- end
24
- end
26
+ @client.call('get', path, {
27
+ 'content-type' => 'application/json'
28
+ }, params)
29
+ end
30
+ end
31
+ end
@@ -1,45 +1,52 @@
1
- module Tomba
2
- class Status < Service
3
-
4
- def domain_status(domain:)
5
- if domain.nil?
6
- raise Tomba::Exception.new('Missing required parameter: "domain"')
7
- end
8
-
9
- path = '/domain-status'
10
-
11
- params = {}
12
-
13
- if !domain.nil?
14
- params[:domain] = domain
15
- end
16
-
17
- return @client.call('get', path, {
18
- 'content-type' => 'application/json',
19
- }, params);
20
- end
21
-
22
- def auto_complete(query:)
23
- if query.nil?
24
- raise Tomba::Exception.new('Missing required parameter: "query"')
25
- end
1
+ # frozen_string_literal: true
26
2
 
27
- path = '/domains-suggestion'
28
-
29
- params = {}
30
-
31
- if !query.nil?
32
- params[:query] = query
33
- end
34
-
35
- return @client.call('get', path, {
36
- 'content-type' => 'application/json',
37
- }, params);
38
- end
39
-
40
-
41
- protected
42
-
43
- private
44
- end
45
- end
3
+ module Tomba
4
+ # Status service for domain status and autocomplete.
5
+ #
6
+ # Provides methods to check domain status and get domain suggestions.
7
+ #
8
+ # @see https://docs.tomba.io/api/status
9
+ class Status < Service
10
+ # Domain Status
11
+ #
12
+ # Returns the status of a domain, including whether it is webmail or disposable.
13
+ #
14
+ # @see https://docs.tomba.io/api/status#domain-status
15
+ # @param domain [String] the domain name to check
16
+ # @return [Hash] API response containing domain status
17
+ # @raise [Tomba::Exception]
18
+ def domain_status(domain:)
19
+ raise Tomba::Exception, 'Missing required parameter: "domain"' if domain.nil?
20
+
21
+ path = '/domain-status'
22
+
23
+ params = {}
24
+ params[:domain] = domain unless domain.nil?
25
+
26
+ @client.call('get', path, {
27
+ 'content-type' => 'application/json'
28
+ }, params)
29
+ end
30
+
31
+ # Autocomplete
32
+ #
33
+ # Returns domain suggestions based on a search query.
34
+ #
35
+ # @see https://docs.tomba.io/api/status#domain-suggestions
36
+ # @param query [String] the search query for domain suggestions
37
+ # @return [Hash] API response containing domain suggestions
38
+ # @raise [Tomba::Exception]
39
+ def auto_complete(query:)
40
+ raise Tomba::Exception, 'Missing required parameter: "query"' if query.nil?
41
+
42
+ path = '/domain-suggestions'
43
+
44
+ params = {}
45
+ params[:query] = query unless query.nil?
46
+
47
+ @client.call('get', path, {
48
+ 'content-type' => 'application/json'
49
+ }, params)
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Tomba
4
+ # Technology service for detecting website technologies.
5
+ #
6
+ # Provides methods to discover the technologies used by a website.
7
+ #
8
+ # @see https://docs.tomba.io/api/domain#technology
9
+ class Technology < Service
10
+ # List Technologies
11
+ #
12
+ # Returns the technologies detected on a given domain.
13
+ #
14
+ # @see https://docs.tomba.io/api/domain#technology#list-technologies
15
+ # @param domain [String] the domain name to analyze
16
+ # @return [Hash] API response containing detected technologies
17
+ # @raise [Tomba::Exception]
18
+ def list(domain)
19
+ raise Tomba::Exception, 'Missing required parameter: "domain"' if domain.nil?
20
+
21
+ path = '/technology'
22
+
23
+ params = { domain: domain }
24
+
25
+ @client.call('get', path, {
26
+ 'content-type' => 'application/json'
27
+ }, params)
28
+ end
29
+ end
30
+ end
@@ -1,19 +1,27 @@
1
- module Tomba
2
- class Usage < Service
3
-
4
- def get_usage()
5
- path = '/usage'
6
-
7
- params = {}
8
-
9
- return @client.call('get', path, {
10
- 'content-type' => 'application/json',
11
- }, params);
12
- end
1
+ # frozen_string_literal: true
13
2
 
3
+ module Tomba
4
+ # Usage service for retrieving API usage statistics.
5
+ #
6
+ # Provides methods to get account usage information.
7
+ #
8
+ # @see https://docs.tomba.io/api/account#retrieve-api-usage
9
+ class Usage < Service
10
+ # Get Usage
11
+ #
12
+ # Returns the current API usage statistics for the account.
13
+ #
14
+ # @see https://docs.tomba.io/api/account#retrieve-api-usage#get-usage
15
+ # @return [Hash] API response containing usage statistics
16
+ # @raise [Tomba::Exception]
17
+ def get_usage
18
+ path = '/usage'
14
19
 
15
- protected
20
+ params = {}
16
21
 
17
- private
18
- end
19
- end
22
+ @client.call('get', path, {
23
+ 'content-type' => 'application/json'
24
+ }, params)
25
+ end
26
+ end
27
+ end