tomba 1.1.0 → 1.1.1
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.
- checksums.yaml +4 -4
- data/lib/tomba/client.rb +32 -0
- data/lib/tomba/services/bulk.rb +13 -13
- data/lib/tomba/services/enrichment.rb +3 -3
- data/lib/tomba/services/finder.rb +1 -1
- data/lib/tomba/services/flag.rb +12 -8
- data/lib/tomba/services/leads-attributes.rb +4 -4
- data/lib/tomba/services/leads-lists.rb +9 -4
- data/lib/tomba/services/reveal.rb +2 -2
- data/lib/tomba/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8ff6ec0d9448e445df78fd5bf6c07ef6793ed9f91c00be2796d4465c8a0f25a2
|
|
4
|
+
data.tar.gz: b18b046b50cdef9e1ab9683614e5ec01de2a221ef8b5cec86a8ce9613b2f693b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: '067991e7633f6fba45b7c679bbdce417e59065278fe7d780c31b30aa1028b2fe7254cba3a7cebf452272b2e1bfe08c818553612bd6f62c51fb57040f657dd14c'
|
|
7
|
+
data.tar.gz: 618f4040dcd9b973c18243138f3c37302ac895b85494fbe9c6f55914579ec4e1e0abd9ffd49464f043b5b9141981d2ba30e3ba29170eb28cb104e8a6b37839ce
|
data/lib/tomba/client.rb
CHANGED
|
@@ -56,6 +56,11 @@ module Tomba
|
|
|
56
56
|
fetch(method, uri, headers, params)
|
|
57
57
|
end
|
|
58
58
|
|
|
59
|
+
def call_raw(method, path = '', headers = {}, params = {})
|
|
60
|
+
uri = URI.parse(@endpoint + path + (method == METHOD_GET && params.length ? "?#{encode(params)}" : ''))
|
|
61
|
+
fetch_raw(method, uri, headers, params)
|
|
62
|
+
end
|
|
63
|
+
|
|
59
64
|
private
|
|
60
65
|
|
|
61
66
|
def fetch(method, uri, headers, params, limit = 5)
|
|
@@ -104,6 +109,33 @@ module Tomba
|
|
|
104
109
|
{ 'data' => res, 'rate_limit' => parse_rate_limit(response) }
|
|
105
110
|
end
|
|
106
111
|
|
|
112
|
+
def fetch_raw(method, uri, headers, _params, limit = 5)
|
|
113
|
+
raise ArgumentError, 'Too Many HTTP Redirects' if limit.zero?
|
|
114
|
+
|
|
115
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
|
116
|
+
http.use_ssl = (uri.scheme == 'https')
|
|
117
|
+
http.read_timeout = 120
|
|
118
|
+
http.open_timeout = 120
|
|
119
|
+
|
|
120
|
+
headers = @headers.merge(headers)
|
|
121
|
+
|
|
122
|
+
begin
|
|
123
|
+
response = http.send_request(method.upcase, uri.request_uri, '', headers)
|
|
124
|
+
rescue StandardError => e
|
|
125
|
+
raise Tomba::Exception, e.message
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
if response.instance_of?(Net::HTTPRedirection) || response.instance_of?(Net::HTTPMovedPermanently)
|
|
129
|
+
location = response['location']
|
|
130
|
+
uri = URI.parse("#{uri.scheme}://#{uri.host}#{location}")
|
|
131
|
+
return fetch_raw(method, uri, headers, {}, limit - 1)
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
raise Tomba::Exception.new(response.body, response.code, nil) if response.code.to_i >= 400
|
|
135
|
+
|
|
136
|
+
{ 'data' => response.body, 'rate_limit' => parse_rate_limit(response) }
|
|
137
|
+
end
|
|
138
|
+
|
|
107
139
|
def parse_rate_limit(response)
|
|
108
140
|
{
|
|
109
141
|
'x-second-rate-limit' => response['x-second-rate-limit']&.to_i,
|
data/lib/tomba/services/bulk.rb
CHANGED
|
@@ -69,7 +69,7 @@ module Tomba
|
|
|
69
69
|
#
|
|
70
70
|
# Creates a new bulk task of the specified type.
|
|
71
71
|
#
|
|
72
|
-
# @see https://docs.tomba.io/api/
|
|
72
|
+
# @see https://docs.tomba.io/api/bulks
|
|
73
73
|
# @param type [String] the bulk task type
|
|
74
74
|
# @param data [Hash] the bulk task data
|
|
75
75
|
# @return [Hash] API response containing the created bulk task
|
|
@@ -90,7 +90,7 @@ module Tomba
|
|
|
90
90
|
#
|
|
91
91
|
# Launches (starts) a bulk task by type and ID.
|
|
92
92
|
#
|
|
93
|
-
# @see https://docs.tomba.io/api/
|
|
93
|
+
# @see https://docs.tomba.io/api/bulks
|
|
94
94
|
# @param type [String] the bulk task type
|
|
95
95
|
# @param id [String] the bulk task ID
|
|
96
96
|
# @return [Hash] API response
|
|
@@ -101,11 +101,11 @@ module Tomba
|
|
|
101
101
|
validate_type(type)
|
|
102
102
|
raise Tomba::Exception, 'Missing required parameter: "id"' if id.nil?
|
|
103
103
|
|
|
104
|
-
path = "/bulk/#{type}/#{id}
|
|
104
|
+
path = "/bulk/#{type}/#{id}"
|
|
105
105
|
|
|
106
106
|
params = {}
|
|
107
107
|
|
|
108
|
-
@client.call('
|
|
108
|
+
@client.call('put', path, {
|
|
109
109
|
'content-type' => 'application/json'
|
|
110
110
|
}, params)
|
|
111
111
|
end
|
|
@@ -114,7 +114,7 @@ module Tomba
|
|
|
114
114
|
#
|
|
115
115
|
# Deletes a bulk task by type and ID.
|
|
116
116
|
#
|
|
117
|
-
# @see https://docs.tomba.io/api/
|
|
117
|
+
# @see https://docs.tomba.io/api/bulks
|
|
118
118
|
# @param type [String] the bulk task type
|
|
119
119
|
# @param id [String] the bulk task ID
|
|
120
120
|
# @return [Hash] API response
|
|
@@ -125,7 +125,7 @@ module Tomba
|
|
|
125
125
|
validate_type(type)
|
|
126
126
|
raise Tomba::Exception, 'Missing required parameter: "id"' if id.nil?
|
|
127
127
|
|
|
128
|
-
path = "/bulk/#{type}/#{id}"
|
|
128
|
+
path = "/bulk/#{type}/#{id}/delete"
|
|
129
129
|
|
|
130
130
|
params = {}
|
|
131
131
|
|
|
@@ -138,7 +138,7 @@ module Tomba
|
|
|
138
138
|
#
|
|
139
139
|
# Archives a bulk task by type and ID.
|
|
140
140
|
#
|
|
141
|
-
# @see https://docs.tomba.io/api/
|
|
141
|
+
# @see https://docs.tomba.io/api/bulks
|
|
142
142
|
# @param type [String] the bulk task type
|
|
143
143
|
# @param id [String] the bulk task ID
|
|
144
144
|
# @return [Hash] API response
|
|
@@ -153,7 +153,7 @@ module Tomba
|
|
|
153
153
|
|
|
154
154
|
params = {}
|
|
155
155
|
|
|
156
|
-
@client.call('
|
|
156
|
+
@client.call('delete', path, {
|
|
157
157
|
'content-type' => 'application/json'
|
|
158
158
|
}, params)
|
|
159
159
|
end
|
|
@@ -162,7 +162,7 @@ module Tomba
|
|
|
162
162
|
#
|
|
163
163
|
# Renames a bulk task by type and ID.
|
|
164
164
|
#
|
|
165
|
-
# @see https://docs.tomba.io/api/
|
|
165
|
+
# @see https://docs.tomba.io/api/bulks
|
|
166
166
|
# @param type [String] the bulk task type
|
|
167
167
|
# @param id [String] the bulk task ID
|
|
168
168
|
# @param name [String] the new name for the bulk task
|
|
@@ -212,7 +212,7 @@ module Tomba
|
|
|
212
212
|
#
|
|
213
213
|
# Downloads the results of a completed bulk task.
|
|
214
214
|
#
|
|
215
|
-
# @see https://docs.tomba.io/api/
|
|
215
|
+
# @see https://docs.tomba.io/api/bulks
|
|
216
216
|
# @param type [String] the bulk task type
|
|
217
217
|
# @param id [String] the bulk task ID
|
|
218
218
|
# @return [Hash] API response containing download data
|
|
@@ -227,9 +227,9 @@ module Tomba
|
|
|
227
227
|
|
|
228
228
|
params = {}
|
|
229
229
|
|
|
230
|
-
@client.
|
|
231
|
-
|
|
232
|
-
|
|
230
|
+
@client.call_raw('get', path, {
|
|
231
|
+
'content-type' => 'application/json'
|
|
232
|
+
}, params)
|
|
233
233
|
end
|
|
234
234
|
end
|
|
235
235
|
end
|
|
@@ -19,7 +19,7 @@ module Tomba
|
|
|
19
19
|
def person(email, webhook_url: nil)
|
|
20
20
|
raise Tomba::Exception, 'Missing required parameter: "email"' if email.nil?
|
|
21
21
|
|
|
22
|
-
path = '/
|
|
22
|
+
path = '/people/find'
|
|
23
23
|
|
|
24
24
|
params = { email: email }
|
|
25
25
|
params[:webhook_url] = webhook_url unless webhook_url.nil?
|
|
@@ -40,7 +40,7 @@ module Tomba
|
|
|
40
40
|
def company(domain)
|
|
41
41
|
raise Tomba::Exception, 'Missing required parameter: "domain"' if domain.nil?
|
|
42
42
|
|
|
43
|
-
path = '/
|
|
43
|
+
path = '/companies/find'
|
|
44
44
|
|
|
45
45
|
params = { domain: domain }
|
|
46
46
|
|
|
@@ -60,7 +60,7 @@ module Tomba
|
|
|
60
60
|
def combined(email)
|
|
61
61
|
raise Tomba::Exception, 'Missing required parameter: "email"' if email.nil?
|
|
62
62
|
|
|
63
|
-
path = '/
|
|
63
|
+
path = '/combined/find'
|
|
64
64
|
|
|
65
65
|
params = { email: email }
|
|
66
66
|
|
data/lib/tomba/services/flag.rb
CHANGED
|
@@ -17,7 +17,7 @@ module Tomba
|
|
|
17
17
|
# @return [Hash] API response containing the list of flags
|
|
18
18
|
# @raise [Tomba::Exception]
|
|
19
19
|
def list_flags(page: nil, limit: nil)
|
|
20
|
-
path = '/
|
|
20
|
+
path = '/flag'
|
|
21
21
|
|
|
22
22
|
params = {}
|
|
23
23
|
params[:page] = page unless page.nil?
|
|
@@ -33,17 +33,21 @@ module Tomba
|
|
|
33
33
|
# Creates a new flag for an email address.
|
|
34
34
|
#
|
|
35
35
|
# @see https://docs.tomba.io/api/flag#create-flag
|
|
36
|
-
# @param
|
|
37
|
-
# @param
|
|
36
|
+
# @param flag_type [String] the type of flag
|
|
37
|
+
# @param value [String] the value to flag
|
|
38
|
+
# @param reason [String] the reason for the flag
|
|
39
|
+
# @param comment [String, nil] optional comment for the flag
|
|
38
40
|
# @return [Hash] API response containing the created flag
|
|
39
41
|
# @raise [Tomba::Exception]
|
|
40
|
-
def create_flag(
|
|
41
|
-
raise Tomba::Exception, 'Missing required parameter: "
|
|
42
|
+
def create_flag(flag_type:, value:, reason:, comment: nil)
|
|
43
|
+
raise Tomba::Exception, 'Missing required parameter: "flag_type"' if flag_type.nil?
|
|
44
|
+
raise Tomba::Exception, 'Missing required parameter: "value"' if value.nil?
|
|
45
|
+
raise Tomba::Exception, 'Missing required parameter: "reason"' if reason.nil?
|
|
42
46
|
|
|
43
|
-
path = '/
|
|
47
|
+
path = '/flag'
|
|
44
48
|
|
|
45
|
-
params = {
|
|
46
|
-
params[:
|
|
49
|
+
params = { flag_type: flag_type, value: value, reason: reason }
|
|
50
|
+
params[:comment] = comment unless comment.nil?
|
|
47
51
|
|
|
48
52
|
@client.call('post', path, {
|
|
49
53
|
'content-type' => 'application/json'
|
|
@@ -15,7 +15,7 @@ module Tomba
|
|
|
15
15
|
# @return [Hash] API response containing the attributes
|
|
16
16
|
# @raise [Tomba::Exception]
|
|
17
17
|
def get_lead_attributes
|
|
18
|
-
path = '/
|
|
18
|
+
path = '/attributes'
|
|
19
19
|
|
|
20
20
|
params = {}
|
|
21
21
|
|
|
@@ -35,7 +35,7 @@ module Tomba
|
|
|
35
35
|
def delete_lead_attribute(id:)
|
|
36
36
|
raise Tomba::Exception, 'Missing required parameter: "id"' if id.nil?
|
|
37
37
|
|
|
38
|
-
path = "/
|
|
38
|
+
path = "/attributes/#{id}"
|
|
39
39
|
|
|
40
40
|
params = {}
|
|
41
41
|
|
|
@@ -52,7 +52,7 @@ module Tomba
|
|
|
52
52
|
# @return [Hash] API response containing the new attribute
|
|
53
53
|
# @raise [Tomba::Exception]
|
|
54
54
|
def create_lead_attribute
|
|
55
|
-
path = '/
|
|
55
|
+
path = '/attributes'
|
|
56
56
|
|
|
57
57
|
params = {}
|
|
58
58
|
|
|
@@ -72,7 +72,7 @@ module Tomba
|
|
|
72
72
|
def update_lead_attribute(id:)
|
|
73
73
|
raise Tomba::Exception, 'Missing required parameter: "id"' if id.nil?
|
|
74
74
|
|
|
75
|
-
path = "/
|
|
75
|
+
path = "/attributes/#{id}"
|
|
76
76
|
|
|
77
77
|
params = {}
|
|
78
78
|
|
|
@@ -49,12 +49,15 @@ module Tomba
|
|
|
49
49
|
# Creates a new leads list for organizing leads.
|
|
50
50
|
#
|
|
51
51
|
# @see https://docs.tomba.io/api/leads-lists#create-leads-list
|
|
52
|
+
# @param name [String] the name of the list
|
|
52
53
|
# @return [Hash] API response containing the new list
|
|
53
54
|
# @raise [Tomba::Exception]
|
|
54
|
-
def create_list
|
|
55
|
+
def create_list(name:)
|
|
56
|
+
raise Tomba::Exception, 'Missing required parameter: "name"' if name.nil?
|
|
57
|
+
|
|
55
58
|
path = '/leads_lists'
|
|
56
59
|
|
|
57
|
-
params = {}
|
|
60
|
+
params = { name: name }
|
|
58
61
|
|
|
59
62
|
@client.call('post', path, {
|
|
60
63
|
'content-type' => 'application/json'
|
|
@@ -67,14 +70,16 @@ module Tomba
|
|
|
67
70
|
#
|
|
68
71
|
# @see https://docs.tomba.io/api/leads-lists#update-leads-list
|
|
69
72
|
# @param id [String] the list ID to update
|
|
73
|
+
# @param name [String] the new name of the list
|
|
70
74
|
# @return [Hash] API response
|
|
71
75
|
# @raise [Tomba::Exception]
|
|
72
|
-
def update_list_id(id:)
|
|
76
|
+
def update_list_id(id:, name:)
|
|
73
77
|
raise Tomba::Exception, 'Missing required parameter: "id"' if id.nil?
|
|
78
|
+
raise Tomba::Exception, 'Missing required parameter: "name"' if name.nil?
|
|
74
79
|
|
|
75
80
|
path = "/leads_lists/#{id}"
|
|
76
81
|
|
|
77
|
-
params = {}
|
|
82
|
+
params = { name: name }
|
|
78
83
|
|
|
79
84
|
@client.call('put', path, {
|
|
80
85
|
'content-type' => 'application/json'
|
|
@@ -18,9 +18,9 @@ module Tomba
|
|
|
18
18
|
def companies_search(params)
|
|
19
19
|
raise Tomba::Exception, 'Missing required parameter: "params"' if params.nil? || params.empty?
|
|
20
20
|
|
|
21
|
-
path = '/reveal'
|
|
21
|
+
path = '/reveal/search'
|
|
22
22
|
|
|
23
|
-
@client.call('
|
|
23
|
+
@client.call('post', path, {
|
|
24
24
|
'content-type' => 'application/json'
|
|
25
25
|
}, params)
|
|
26
26
|
end
|
data/lib/tomba/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: tomba
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.1.
|
|
4
|
+
version: 1.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Mohamed Ben rebia
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2026-
|
|
12
|
+
date: 2026-09-30 00:00:00.000000000 Z
|
|
13
13
|
dependencies: []
|
|
14
14
|
description: official Ruby library for Tomba
|
|
15
15
|
email:
|