tomba 1.0.1 → 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,39 +1,42 @@
1
- module Tomba
2
- class Domain < Service
3
-
4
- def domain_search(domain:, page: nil, limit: nil, department: nil)
5
- if domain.nil?
6
- raise Tomba::Exception.new('Missing required parameter: "domain"')
7
- end
8
-
9
- path = '/domain-search/'
10
-
11
- params = {}
12
-
13
- if !domain.nil?
14
- params[:domain] = domain
15
- end
16
-
17
- if !page.nil?
18
- params[:page] = page
19
- end
1
+ # frozen_string_literal: true
20
2
 
21
- if !limit.nil?
22
- params[:limit] = limit
23
- end
24
-
25
- if !department.nil?
26
- params[:department] = department
27
- end
28
-
29
- return @client.call('get', path, {
30
- 'content-type' => 'application/json',
31
- }, params);
32
- end
33
-
34
-
35
- protected
36
-
37
- private
3
+ module Tomba
4
+ # Domain Search service.
5
+ #
6
+ # Search emails associated with a domain.
7
+ #
8
+ # @see https://docs.tomba.io/api/finder#domain-search
9
+ class Domain < Service
10
+ # Domain Search
11
+ #
12
+ # Returns all email addresses found for a given domain.
13
+ #
14
+ # @see https://docs.tomba.io/api/finder#domain-search#domain-search
15
+ # @param domain [String] the domain name to search
16
+ # @param page [Integer, nil] the page number for pagination
17
+ # @param limit [Integer, nil] the number of results per page
18
+ # @param department [String, nil] filter by department
19
+ # @param enrich_mobile [Boolean, nil] whether to enrich mobile phone data
20
+ # @param webhook_url [String, nil] webhook URL for async notifications
21
+ # @return [Hash] API response containing the list of emails
22
+ # @raise [Tomba::Exception]
23
+ def domain_search(domain:, page: nil, limit: nil, department: nil, enrich_mobile: nil, webhook_url: nil)
24
+ raise Tomba::Exception, 'Missing required parameter: "domain"' if domain.nil?
25
+
26
+ path = '/domain-search/'
27
+
28
+ params = {}
29
+
30
+ params[:domain] = domain unless domain.nil?
31
+ params[:page] = page unless page.nil?
32
+ params[:limit] = limit unless limit.nil?
33
+ params[:department] = department unless department.nil?
34
+ params[:enrich_mobile] = enrich_mobile unless enrich_mobile.nil?
35
+ params[:webhook_url] = webhook_url unless webhook_url.nil?
36
+
37
+ @client.call('get', path, {
38
+ 'content-type' => 'application/json'
39
+ }, params)
38
40
  end
41
+ end
39
42
  end
@@ -0,0 +1,72 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Tomba
4
+ # Enrichment service for data enrichment.
5
+ #
6
+ # Provides methods to enrich person and company data.
7
+ #
8
+ # @see https://docs.tomba.io/api/enrichment
9
+ class Enrichment < Service
10
+ # Person Enrichment
11
+ #
12
+ # Enriches data about a person using their email address.
13
+ #
14
+ # @see https://docs.tomba.io/api/enrichment#person-enrichment
15
+ # @param email [String] the email address of the person
16
+ # @param webhook_url [String, nil] webhook URL for async notifications
17
+ # @return [Hash] API response containing enriched person data
18
+ # @raise [Tomba::Exception]
19
+ def person(email, webhook_url: nil)
20
+ raise Tomba::Exception, 'Missing required parameter: "email"' if email.nil?
21
+
22
+ path = '/enrichment/person'
23
+
24
+ params = { email: email }
25
+ params[:webhook_url] = webhook_url unless webhook_url.nil?
26
+
27
+ @client.call('get', path, {
28
+ 'content-type' => 'application/json'
29
+ }, params)
30
+ end
31
+
32
+ # Company Enrichment
33
+ #
34
+ # Enriches data about a company using its domain name.
35
+ #
36
+ # @see https://docs.tomba.io/api/enrichment#company-enrichment
37
+ # @param domain [String] the domain name of the company
38
+ # @return [Hash] API response containing enriched company data
39
+ # @raise [Tomba::Exception]
40
+ def company(domain)
41
+ raise Tomba::Exception, 'Missing required parameter: "domain"' if domain.nil?
42
+
43
+ path = '/enrichment/company'
44
+
45
+ params = { domain: domain }
46
+
47
+ @client.call('get', path, {
48
+ 'content-type' => 'application/json'
49
+ }, params)
50
+ end
51
+
52
+ # Combined Enrichment
53
+ #
54
+ # Returns combined person and company enrichment data for an email.
55
+ #
56
+ # @see https://docs.tomba.io/api/enrichment#combined-enrichment
57
+ # @param email [String] the email address to enrich
58
+ # @return [Hash] API response containing combined enrichment data
59
+ # @raise [Tomba::Exception]
60
+ def combined(email)
61
+ raise Tomba::Exception, 'Missing required parameter: "email"' if email.nil?
62
+
63
+ path = '/enrichment/combined'
64
+
65
+ params = { email: email }
66
+
67
+ @client.call('get', path, {
68
+ 'content-type' => 'application/json'
69
+ }, params)
70
+ end
71
+ end
72
+ end
@@ -1,95 +1,109 @@
1
- module Tomba
2
- class Finder < Service
3
-
4
- def email_finder(domain:, first_name:, last_name:)
5
- if domain.nil?
6
- raise Tomba::Exception.new('Missing required parameter: "domain"')
7
- end
8
-
9
- if first_name.nil?
10
- raise Tomba::Exception.new('Missing required parameter: "firstName"')
11
- end
12
-
13
- if last_name.nil?
14
- raise Tomba::Exception.new('Missing required parameter: "lastName"')
15
- end
16
-
17
- path = '/email-finder'
18
-
19
- params = {}
20
-
21
- if !domain.nil?
22
- params[:domain] = domain
23
- end
24
-
25
- if !first_name.nil?
26
- params[:first_name] = first_name
27
- end
28
-
29
- if !last_name.nil?
30
- params[:last_name] = last_name
31
- end
32
-
33
- return @client.call('get', path, {
34
- 'content-type' => 'application/json',
35
- }, params);
36
- end
37
-
38
- def author_finder(url:)
39
- if url.nil?
40
- raise Tomba::Exception.new('Missing required parameter: "url"')
41
- end
42
-
43
- path = '/author-finder'
44
-
45
- params = {}
46
-
47
- if !url.nil?
48
- params[:url] = url
49
- end
1
+ # frozen_string_literal: true
50
2
 
3
+ module Tomba
4
+ # Finder service for email, author, LinkedIn, and phone lookups.
5
+ #
6
+ # Provides methods to find email addresses, authors, LinkedIn profiles,
7
+ # and phone numbers.
8
+ #
9
+ # @see https://docs.tomba.io/api/finder
10
+ class Finder < Service
11
+ # Email Finder
12
+ #
13
+ # Generates or retrieves the most likely email address from a domain and name.
14
+ #
15
+ # @see https://docs.tomba.io/api/finder#email-finder
16
+ # @param domain [String] the domain name
17
+ # @param first_name [String] the first name of the person
18
+ # @param last_name [String] the last name of the person
19
+ # @param webhook_url [String, nil] webhook URL for async notifications
20
+ # @return [Hash] API response
21
+ # @raise [Tomba::Exception]
22
+ def email_finder(domain:, first_name:, last_name:, webhook_url: nil)
23
+ raise Tomba::Exception, 'Missing required parameter: "domain"' if domain.nil?
24
+ raise Tomba::Exception, 'Missing required parameter: "first_name"' if first_name.nil?
25
+ raise Tomba::Exception, 'Missing required parameter: "last_name"' if last_name.nil?
26
+
27
+ path = '/email-finder'
28
+
29
+ params = {}
30
+ params[:domain] = domain unless domain.nil?
31
+ params[:first_name] = first_name unless first_name.nil?
32
+ params[:last_name] = last_name unless last_name.nil?
33
+ params[:webhook_url] = webhook_url unless webhook_url.nil?
34
+
35
+ @client.call('get', path, {
36
+ 'content-type' => 'application/json'
37
+ }, params)
38
+ end
51
39
 
52
- return @client.call('get', path, {
53
- 'content-type' => 'application/json',
54
- }, params);
55
- end
56
-
57
- def linkedin_finder(url:)
58
- if url.nil?
59
- raise Tomba::Exception.new('Missing required parameter: "url"')
60
- end
61
-
62
- path = '/linkedin-finder'
63
-
64
- params = {}
65
-
66
- if !url.nil?
67
- params[:url] = url
68
- end
69
-
70
-
71
- return @client.call('get', path, {
72
- 'content-type' => 'application/json',
73
- }, params);
74
- end
75
-
76
- def phone_finder(email:)
77
- if email.nil?
78
- raise Tomba::Exception.new('Missing required parameter: "email"')
79
- end
80
-
81
- path = '/phone/{email}'
82
- .gsub('{email}', email)
83
-
84
- params = {}
85
-
86
- return @client.call('get', path, {
87
- 'content-type' => 'application/json',
88
- }, params);
89
- end
40
+ # Author Finder
41
+ #
42
+ # Retrieves the email address of the author of a given article URL.
43
+ #
44
+ # @see https://docs.tomba.io/api/finder#author-finder
45
+ # @param url [String] the URL of the article
46
+ # @param webhook_url [String, nil] webhook URL for async notifications
47
+ # @return [Hash] API response
48
+ # @raise [Tomba::Exception]
49
+ def author_finder(url:, webhook_url: nil)
50
+ raise Tomba::Exception, 'Missing required parameter: "url"' if url.nil?
51
+
52
+ path = '/author-finder'
53
+
54
+ params = {}
55
+ params[:url] = url unless url.nil?
56
+ params[:webhook_url] = webhook_url unless webhook_url.nil?
57
+
58
+ @client.call('get', path, {
59
+ 'content-type' => 'application/json'
60
+ }, params)
61
+ end
90
62
 
91
- protected
63
+ # LinkedIn Finder
64
+ #
65
+ # Retrieves the email address of a person from their LinkedIn URL.
66
+ #
67
+ # @see https://docs.tomba.io/api/finder#linkedin-finder
68
+ # @param url [String] the LinkedIn profile URL
69
+ # @param webhook_url [String, nil] webhook URL for async notifications
70
+ # @return [Hash] API response
71
+ # @raise [Tomba::Exception]
72
+ def linkedin_finder(url:, webhook_url: nil)
73
+ raise Tomba::Exception, 'Missing required parameter: "url"' if url.nil?
74
+
75
+ path = '/linkedin-finder'
76
+
77
+ params = {}
78
+ params[:url] = url unless url.nil?
79
+ params[:webhook_url] = webhook_url unless webhook_url.nil?
80
+
81
+ @client.call('get', path, {
82
+ 'content-type' => 'application/json'
83
+ }, params)
84
+ end
92
85
 
93
- private
86
+ # Phone Finder
87
+ #
88
+ # Retrieves the phone number associated with an email address.
89
+ #
90
+ # @see https://docs.tomba.io/api/finder#phone-finder
91
+ # @param email [String] the email address to look up
92
+ # @param webhook_url [String, nil] webhook URL for async notifications
93
+ # @return [Hash] API response
94
+ # @raise [Tomba::Exception]
95
+ def phone_finder(email:, webhook_url: nil)
96
+ raise Tomba::Exception, 'Missing required parameter: "email"' if email.nil?
97
+
98
+ path = '/phone-finder'
99
+
100
+ params = {}
101
+ params[:email] = email unless email.nil?
102
+ params[:webhook_url] = webhook_url unless webhook_url.nil?
103
+
104
+ @client.call('get', path, {
105
+ 'content-type' => 'application/json'
106
+ }, params)
94
107
  end
108
+ end
95
109
  end
@@ -0,0 +1,53 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Tomba
4
+ # Flag service for managing email flags.
5
+ #
6
+ # Provides methods to list and create flags for email addresses.
7
+ #
8
+ # @see https://docs.tomba.io/api/flag
9
+ class Flag < Service
10
+ # List Flags
11
+ #
12
+ # Returns all flags associated with the account.
13
+ #
14
+ # @see https://docs.tomba.io/api/flag#list-flags
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 the list of flags
18
+ # @raise [Tomba::Exception]
19
+ def list_flags(page: nil, limit: nil)
20
+ path = '/flags'
21
+
22
+ params = {}
23
+ params[:page] = page unless page.nil?
24
+ params[:limit] = limit unless limit.nil?
25
+
26
+ @client.call('get', path, {
27
+ 'content-type' => 'application/json'
28
+ }, params)
29
+ end
30
+
31
+ # Create Flag
32
+ #
33
+ # Creates a new flag for an email address.
34
+ #
35
+ # @see https://docs.tomba.io/api/flag#create-flag
36
+ # @param email [String] the email address to flag
37
+ # @param reason [String, nil] optional reason for the flag
38
+ # @return [Hash] API response containing the created flag
39
+ # @raise [Tomba::Exception]
40
+ def create_flag(email:, reason: nil)
41
+ raise Tomba::Exception, 'Missing required parameter: "email"' if email.nil?
42
+
43
+ path = '/flags'
44
+
45
+ params = { email: email }
46
+ params[:reason] = reason unless reason.nil?
47
+
48
+ @client.call('post', path, {
49
+ 'content-type' => 'application/json'
50
+ }, params)
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Tomba
4
+ # Format service for discovering email formats.
5
+ #
6
+ # Provides methods to find the email format used by a domain.
7
+ #
8
+ # @see https://docs.tomba.io/api/format
9
+ class Format < Service
10
+ # Email Format
11
+ #
12
+ # Returns the email format used by a given domain (e.g., first.last, first_last).
13
+ #
14
+ # @see https://docs.tomba.io/api/format#email-format
15
+ # @param domain [String] the domain name to look up the email format for
16
+ # @return [Hash] API response containing the email format
17
+ # @raise [Tomba::Exception]
18
+ def email_format(domain)
19
+ raise Tomba::Exception, 'Missing required parameter: "domain"' if domain.nil?
20
+
21
+ path = '/email-format'
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,59 +1,100 @@
1
- module Tomba
2
- class Keys < Service
3
-
4
- def get_keys()
5
- path = '/keys/{id}'
6
-
7
- params = {}
8
-
9
- return @client.call('get', path, {
10
- 'content-type' => 'application/json',
11
- }, params);
12
- end
13
-
14
- def delete_key(id:)
15
- if id.nil?
16
- raise Tomba::Exception.new('Missing required parameter: "id"')
17
- end
18
-
19
- path = '/keys/{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_key()
30
- path = '/keys/{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 reset_key(id:)
40
- if id.nil?
41
- raise Tomba::Exception.new('Missing required parameter: "id"')
42
- end
43
-
44
- path = '/keys/{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
+ # Keys service for managing API keys.
5
+ #
6
+ # Provides methods to list, create, reset, and delete API keys.
7
+ #
8
+ # @see https://docs.tomba.io/api/keys
9
+ class Keys < Service
10
+ # List all API keys.
11
+ #
12
+ # Returns all API keys associated with the account.
13
+ #
14
+ # @see https://docs.tomba.io/api/keys
15
+ # @return [Hash] API response containing the list of keys
16
+ # @raise [Tomba::Exception]
17
+ def get_keys
18
+ path = '/keys'
19
+
20
+ params = {}
21
+
22
+ @client.call('get', path, {
23
+ 'content-type' => 'application/json'
24
+ }, params)
25
+ end
26
+
27
+ # Get a specific API key by ID.
28
+ #
29
+ # @see https://docs.tomba.io/api/keys#get-key
30
+ # @param id [String] the key ID
31
+ # @return [Hash] API response
32
+ # @raise [Tomba::Exception]
33
+ def get_key(id:)
34
+ raise Tomba::Exception, 'Missing required parameter: "id"' if id.nil?
35
+
36
+ path = "/keys/#{id}"
37
+
38
+ @client.call('get', path, {
39
+ 'content-type' => 'application/json'
40
+ }, {})
41
+ end
42
+
43
+ # Delete an API key.
44
+ #
45
+ # Removes a specific API key by its ID.
46
+ #
47
+ # @see https://docs.tomba.io/api/keys#delete-an-api-key
48
+ # @param id [String] the key ID to delete
49
+ # @return [Hash] API response
50
+ # @raise [Tomba::Exception]
51
+ def delete_key(id:)
52
+ raise Tomba::Exception, 'Missing required parameter: "id"' if id.nil?
53
+
54
+ path = "/keys/#{id}"
55
+
56
+ params = {}
57
+
58
+ @client.call('delete', path, {
59
+ 'content-type' => 'application/json'
60
+ }, params)
61
+ end
62
+
63
+ # Create a new API key.
64
+ #
65
+ # Generates a new API key for the account.
66
+ #
67
+ # @see https://docs.tomba.io/api/keys#create-an-api-key
68
+ # @return [Hash] API response containing the new key
69
+ # @raise [Tomba::Exception]
70
+ def create_key
71
+ path = '/keys'
72
+
73
+ params = {}
74
+
75
+ @client.call('post', path, {
76
+ 'content-type' => 'application/json'
77
+ }, params)
78
+ end
79
+
80
+ # Reset an API key.
81
+ #
82
+ # Regenerates a specific API key by its ID.
83
+ #
84
+ # @see https://docs.tomba.io/api/keys#reset-an-api-key
85
+ # @param id [String] the key ID to reset
86
+ # @return [Hash] API response containing the reset key
87
+ # @raise [Tomba::Exception]
88
+ def reset_key(id:)
89
+ raise Tomba::Exception, 'Missing required parameter: "id"' if id.nil?
90
+
91
+ path = "/keys/#{id}"
92
+
93
+ params = {}
94
+
95
+ @client.call('put', path, {
96
+ 'content-type' => 'application/json'
97
+ }, params)
98
+ end
99
+ end
100
+ end