neverbounce-api 1.0.4 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -5
- data/Gemfile.lock +2 -2
- data/lib/never_bounce/api/client.rb +22 -3
- data/lib/never_bounce/api/request/base.rb +11 -5
- data/lib/never_bounce/api/request/jobs_create.rb +11 -0
- data/lib/never_bounce/api/request/single_check.rb +11 -0
- data/lib/never_bounce/api/version.rb +1 -1
- data/spec/lib/never_bounce/api/client_spec.rb +10 -0
- data/spec/lib/never_bounce/api/request/account_info_spec.rb +1 -1
- data/spec/lib/never_bounce/api/request/jobs_create_spec.rb +33 -1
- data/spec/lib/never_bounce/api/request/jobs_delete_spec.rb +1 -1
- data/spec/lib/never_bounce/api/request/jobs_download_spec.rb +1 -1
- data/spec/lib/never_bounce/api/request/jobs_parse_spec.rb +1 -1
- data/spec/lib/never_bounce/api/request/jobs_results_spec.rb +1 -1
- data/spec/lib/never_bounce/api/request/jobs_search_spec.rb +1 -1
- data/spec/lib/never_bounce/api/request/jobs_start_spec.rb +1 -1
- data/spec/lib/never_bounce/api/request/jobs_status_spec.rb +1 -1
- data/spec/lib/never_bounce/api/request/poe_confirm_spec.rb +1 -1
- data/spec/lib/never_bounce/api/request/single_check_spec.rb +27 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a4914041f3d0851a7bc008ad8ae7a93d788d9722
|
4
|
+
data.tar.gz: 9bfb58a3ef4662106c64160cbeae2edbdce1edc8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8fc8a9fc1608a38a5f5eab79fe7941e36310d22c0391b9e338f20a05b318e1d972e64bf498adf2dbb638a05f7f0846b9ab915456e96f750e3d31a8de6f27458f
|
7
|
+
data.tar.gz: 380320a15db88c0e2b995e95e8d5b0ffb209ca8d043f81bcace0ee5501a6159bdeb86f029e2653e002a6aa0c9a489dfbf3576ddb9d84520a66119431d0585a22
|
data/.travis.yml
CHANGED
@@ -6,10 +6,10 @@ env:
|
|
6
6
|
- CC_TEST_REPORTER_ID=9300cb7898e254e78099399acbb2796471fde0e5c1873899273a583d56c9d740
|
7
7
|
|
8
8
|
before_install:
|
9
|
-
- gem update --system
|
10
9
|
- gem install bundler
|
11
10
|
|
12
11
|
install:
|
12
|
+
- bundle update --bundler
|
13
13
|
- bundle install --path ~/bundle
|
14
14
|
|
15
15
|
before_script:
|
@@ -24,9 +24,7 @@ after_script:
|
|
24
24
|
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
|
25
25
|
|
26
26
|
rvm:
|
27
|
-
- 2.0
|
28
|
-
- 2.1
|
29
|
-
- 2.2
|
30
|
-
- 2.3
|
31
27
|
- 2.4
|
32
28
|
- 2.5
|
29
|
+
- 2.6
|
30
|
+
- 2.7
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
neverbounce-api (1.0
|
4
|
+
neverbounce-api (1.1.0)
|
5
5
|
httparty (~> 0.15)
|
6
6
|
|
7
7
|
GEM
|
@@ -9,7 +9,7 @@ GEM
|
|
9
9
|
specs:
|
10
10
|
diff-lcs (1.3)
|
11
11
|
docile (1.1.5)
|
12
|
-
httparty (0.
|
12
|
+
httparty (0.16.2)
|
13
13
|
multi_xml (>= 0.5.2)
|
14
14
|
json (2.1.0)
|
15
15
|
multi_xml (0.6.0)
|
@@ -37,7 +37,7 @@ module NeverBounce; module API
|
|
37
37
|
Feature::BasicInitialize.load(self)
|
38
38
|
Feature::RequireAttr.load(self)
|
39
39
|
|
40
|
-
attr_writer :api_key
|
40
|
+
attr_writer :api_key, :api_version
|
41
41
|
|
42
42
|
# API key.
|
43
43
|
# @return [String]
|
@@ -45,6 +45,12 @@ module NeverBounce; module API
|
|
45
45
|
@api_key or raise AttributeError, "Attribute must be set: api_key"
|
46
46
|
end
|
47
47
|
|
48
|
+
# API version.
|
49
|
+
# @return [String]
|
50
|
+
def api_version
|
51
|
+
@api_version
|
52
|
+
end
|
53
|
+
|
48
54
|
#--------------------------------------- Misc
|
49
55
|
|
50
56
|
# Wrap request in a session, return response.
|
@@ -67,6 +73,7 @@ module NeverBounce; module API
|
|
67
73
|
def account_info
|
68
74
|
response_to(Request::AccountInfo.new({
|
69
75
|
api_key: api_key,
|
76
|
+
api_version: api_version,
|
70
77
|
}))
|
71
78
|
end
|
72
79
|
|
@@ -83,7 +90,7 @@ module NeverBounce; module API
|
|
83
90
|
# @raise [StandardError]
|
84
91
|
# @see Request::JobsCreate
|
85
92
|
# @see https://developers.neverbounce.com/v4.0/reference#jobs-create
|
86
|
-
def jobs_create(auto_parse: false, auto_start: false, filename: nil, remote_input: nil, run_sample: false, supplied_input: nil)
|
93
|
+
def jobs_create(auto_parse: false, auto_start: false, filename: nil, remote_input: nil, run_sample: false, supplied_input: nil, historical: nil)
|
87
94
|
raise ArgumentError, "`remote_input` and `supplied_input` can't both be given" if remote_input && supplied_input
|
88
95
|
|
89
96
|
input_location = if (v = remote_input)
|
@@ -102,12 +109,14 @@ module NeverBounce; module API
|
|
102
109
|
|
103
110
|
response_to(API::Request::JobsCreate.new({
|
104
111
|
api_key: api_key,
|
112
|
+
api_version: api_version,
|
105
113
|
auto_parse: auto_parse,
|
106
114
|
auto_start: auto_start,
|
107
115
|
filename: filename,
|
108
116
|
input: input,
|
109
117
|
input_location: input_location,
|
110
118
|
run_sample: run_sample,
|
119
|
+
historical: historical,
|
111
120
|
}))
|
112
121
|
end
|
113
122
|
|
@@ -122,6 +131,7 @@ module NeverBounce; module API
|
|
122
131
|
def jobs_delete(job_id: nil)
|
123
132
|
response_to(Request::JobsDelete.new({
|
124
133
|
api_key: api_key,
|
134
|
+
api_version: api_version,
|
125
135
|
job_id: job_id,
|
126
136
|
}))
|
127
137
|
end
|
@@ -137,6 +147,7 @@ module NeverBounce; module API
|
|
137
147
|
def jobs_download(job_id: nil)
|
138
148
|
response_to(Request::JobsDownload.new({
|
139
149
|
api_key: api_key,
|
150
|
+
api_version: api_version,
|
140
151
|
job_id: job_id,
|
141
152
|
}))
|
142
153
|
end
|
@@ -153,6 +164,7 @@ module NeverBounce; module API
|
|
153
164
|
def jobs_parse(auto_start: nil, job_id: nil)
|
154
165
|
response_to(Request::JobsParse.new({
|
155
166
|
api_key: api_key,
|
167
|
+
api_version: api_version,
|
156
168
|
auto_start: auto_start,
|
157
169
|
job_id: job_id,
|
158
170
|
}))
|
@@ -171,6 +183,7 @@ module NeverBounce; module API
|
|
171
183
|
def jobs_results(job_id: nil, page: 1, per_page: nil)
|
172
184
|
response_to(Request::JobsResults.new({
|
173
185
|
api_key: api_key,
|
186
|
+
api_version: api_version,
|
174
187
|
job_id: job_id,
|
175
188
|
page: page,
|
176
189
|
per_page: per_page,
|
@@ -190,6 +203,7 @@ module NeverBounce; module API
|
|
190
203
|
def jobs_search(job_id: nil, page: 1, per_page: nil)
|
191
204
|
response_to(Request::JobsSearch.new({
|
192
205
|
api_key: api_key,
|
206
|
+
api_version: api_version,
|
193
207
|
job_id: job_id,
|
194
208
|
page: page,
|
195
209
|
per_page: per_page,
|
@@ -208,6 +222,7 @@ module NeverBounce; module API
|
|
208
222
|
def jobs_start(job_id: nil, run_sample: nil)
|
209
223
|
response_to(Request::JobsStart.new({
|
210
224
|
api_key: api_key,
|
225
|
+
api_version: api_version,
|
211
226
|
job_id: job_id,
|
212
227
|
run_sample: run_sample,
|
213
228
|
}))
|
@@ -224,6 +239,7 @@ module NeverBounce; module API
|
|
224
239
|
def jobs_status(job_id: nil)
|
225
240
|
response_to(Request::JobsStatus.new({
|
226
241
|
api_key: api_key,
|
242
|
+
api_version: api_version,
|
227
243
|
job_id: job_id,
|
228
244
|
}))
|
229
245
|
end
|
@@ -239,13 +255,15 @@ module NeverBounce; module API
|
|
239
255
|
# @raise [StandardError]
|
240
256
|
# @see Request::SingleCheck
|
241
257
|
# @see https://developers.neverbounce.com/v4.0/reference#single-check
|
242
|
-
def single_check(address_info: nil, credits_info: nil, email: nil, timeout: nil)
|
258
|
+
def single_check(address_info: nil, credits_info: nil, email: nil, timeout: nil, historical: nil)
|
243
259
|
response_to(Request::SingleCheck.new({
|
244
260
|
address_info: address_info,
|
245
261
|
api_key: api_key,
|
262
|
+
api_version: api_version,
|
246
263
|
credits_info: credits_info,
|
247
264
|
email: email,
|
248
265
|
timeout: timeout,
|
266
|
+
historical: historical,
|
249
267
|
}))
|
250
268
|
end
|
251
269
|
|
@@ -263,6 +281,7 @@ module NeverBounce; module API
|
|
263
281
|
def poe_confirm(email: nil, transaction_id: nil, confirmation_token: nil, result: nil)
|
264
282
|
response_to(Request::POEConfirm.new({
|
265
283
|
api_key: api_key,
|
284
|
+
api_version: api_version,
|
266
285
|
email: email,
|
267
286
|
transaction_id: transaction_id,
|
268
287
|
confirmation_token: confirmation_token,
|
@@ -12,12 +12,18 @@ module NeverBounce; module API; module Request
|
|
12
12
|
# User's API key.
|
13
13
|
# @return [String]
|
14
14
|
attr_accessor :api_key
|
15
|
-
attr_writer :api_url, :headers, :user_agent
|
15
|
+
attr_writer :api_url, :headers, :user_agent, :api_version
|
16
16
|
|
17
|
-
# Custom API URL. Default is <tt>https://api.neverbounce.com
|
17
|
+
# Custom API URL. Default is <tt>https://api.neverbounce.com</tt>.
|
18
18
|
# @return [String]
|
19
19
|
def api_url
|
20
|
-
@api_url ||= "https://api.neverbounce.com
|
20
|
+
@api_url ||= "https://api.neverbounce.com"
|
21
|
+
end
|
22
|
+
|
23
|
+
# Custom API URL. Default is <tt>https://api.neverbounce.com</tt>.
|
24
|
+
# @return [String]
|
25
|
+
def api_version
|
26
|
+
@api_version ||= "v4.1"
|
21
27
|
end
|
22
28
|
|
23
29
|
# @!attribute headers
|
@@ -57,7 +63,7 @@ module NeverBounce; module API; module Request
|
|
57
63
|
@curl ||= begin
|
58
64
|
ar = [
|
59
65
|
"--request", self.class.http_method.to_s.upcase,
|
60
|
-
"--url", "#{api_url}/#{self.class.path}",
|
66
|
+
"--url", "#{api_url}/#{api_version}/#{self.class.path}",
|
61
67
|
]
|
62
68
|
|
63
69
|
ar += headers.reject { |k,| k == "User-Agent" }.flat_map do |k, v|
|
@@ -82,7 +88,7 @@ module NeverBounce; module API; module Request
|
|
82
88
|
def to_httparty
|
83
89
|
[
|
84
90
|
self.class.http_method, # E.g. `:get`.
|
85
|
-
"#{api_url}/#{self.class.path}",
|
91
|
+
"#{api_url}/#{api_version}/#{self.class.path}",
|
86
92
|
{
|
87
93
|
body: to_h.to_json,
|
88
94
|
headers: headers,
|
@@ -23,6 +23,13 @@ module NeverBounce; module API; module Request
|
|
23
23
|
# @return [Boolean]
|
24
24
|
attr_accessor :run_sample
|
25
25
|
|
26
|
+
# @return [Boolean]
|
27
|
+
attr_accessor :historical
|
28
|
+
|
29
|
+
def leverage_historical
|
30
|
+
defined?(@historical) ? @historical : true
|
31
|
+
end
|
32
|
+
|
26
33
|
# @return [Symbol]
|
27
34
|
def self.http_method
|
28
35
|
:post
|
@@ -53,6 +60,10 @@ module NeverBounce; module API; module Request
|
|
53
60
|
unless (v = run_sample).nil?
|
54
61
|
_[:run_sample] = v
|
55
62
|
end
|
63
|
+
|
64
|
+
unless historical.nil?
|
65
|
+
_[:request_meta_data] = {leverage_historical_data: leverage_historical}
|
66
|
+
end
|
56
67
|
end
|
57
68
|
end
|
58
69
|
|
@@ -17,6 +17,13 @@ module NeverBounce; module API; module Request
|
|
17
17
|
# @return [Integer]
|
18
18
|
attr_accessor :timeout
|
19
19
|
|
20
|
+
# @return [Boolean]
|
21
|
+
attr_accessor :historical
|
22
|
+
|
23
|
+
def leverage_historical
|
24
|
+
defined?(@historical) ? @historical : true
|
25
|
+
end
|
26
|
+
|
20
27
|
# @return [Symbol]
|
21
28
|
def self.http_method
|
22
29
|
:get
|
@@ -47,6 +54,10 @@ module NeverBounce; module API; module Request
|
|
47
54
|
unless (v = timeout).nil?
|
48
55
|
_[:timeout] = v
|
49
56
|
end
|
57
|
+
|
58
|
+
unless historical.nil?
|
59
|
+
_[:request_meta_data] = {leverage_historical_data: leverage_historical}
|
60
|
+
end
|
50
61
|
end
|
51
62
|
end
|
52
63
|
|
@@ -14,6 +14,16 @@ module NeverBounce; module API
|
|
14
14
|
expect(r.api_key).to eq "api_key"
|
15
15
|
end
|
16
16
|
end
|
17
|
+
|
18
|
+
describe "#api_version" do
|
19
|
+
it "generally works" do
|
20
|
+
r = newo
|
21
|
+
r.api_key = "api_key"
|
22
|
+
expect(r.api_version).to eq nil
|
23
|
+
r.api_version = "api_version"
|
24
|
+
expect(r.api_version).to eq "api_version"
|
25
|
+
end
|
26
|
+
end
|
17
27
|
end # describe "attributes"
|
18
28
|
|
19
29
|
describe "requests" do
|
@@ -19,7 +19,7 @@ module NeverBounce; module API; module Request
|
|
19
19
|
expect(res).to be_a Array
|
20
20
|
method, url, data = res
|
21
21
|
expect(method).to eq :get
|
22
|
-
expect(url).to eq "https://api.neverbounce.com/v4/account/info"
|
22
|
+
expect(url).to eq "https://api.neverbounce.com/v4.1/account/info"
|
23
23
|
expect(data).to include(:body, :headers)
|
24
24
|
expect(data.fetch(:body)).to eq "{\"key\":\"api_key\"}"
|
25
25
|
expect(data.fetch(:headers)).to include("Content-Type", "User-Agent")
|
@@ -15,6 +15,10 @@ module NeverBounce; module API; module Request
|
|
15
15
|
expect(r.mode_h).to eq({auto_start: false, auto_parse: false, run_sample: false})
|
16
16
|
r = newo(auto_start: true, auto_parse: true, run_sample: true)
|
17
17
|
expect(r.mode_h).to eq({auto_start: true, auto_parse: true, run_sample: true})
|
18
|
+
r = newo(historical: true)
|
19
|
+
expect(r.mode_h).to eq({request_meta_data: {leverage_historical_data: true}})
|
20
|
+
r = newo(historical: false)
|
21
|
+
expect(r.mode_h).to eq({request_meta_data: {leverage_historical_data: false}})
|
18
22
|
end
|
19
23
|
end
|
20
24
|
|
@@ -79,11 +83,39 @@ module NeverBounce; module API; module Request
|
|
79
83
|
expect(res).to be_a Array
|
80
84
|
method, url, data = res
|
81
85
|
expect(method).to eq :post
|
82
|
-
expect(url).to eq "https://api.neverbounce.com/v4/jobs/create"
|
86
|
+
expect(url).to eq "https://api.neverbounce.com/v4.1/jobs/create"
|
83
87
|
expect(data).to include(:body, :headers)
|
84
88
|
expect(data.fetch(:body)).to eq "{\"input\":\"input\",\"input_location\":\"remote_url\",\"filename\":\"filename\",\"key\":\"api_key\"}"
|
85
89
|
expect(data.fetch(:headers)).to include("Content-Type", "User-Agent")
|
86
90
|
end
|
91
|
+
|
92
|
+
it "allows historical to be disabled" do
|
93
|
+
r = newo
|
94
|
+
r.input = "input"
|
95
|
+
r.input_location = "remote_url"
|
96
|
+
r.filename = "filename"
|
97
|
+
r.api_key = "api_key"
|
98
|
+
r.historical = false
|
99
|
+
|
100
|
+
res = r.to_httparty
|
101
|
+
expect(res).to be_a Array
|
102
|
+
method, url, data = res
|
103
|
+
expect(data.fetch(:body)).to eq "{\"input\":\"input\",\"input_location\":\"remote_url\",\"filename\":\"filename\",\"key\":\"api_key\",\"request_meta_data\":{\"leverage_historical_data\":false}}"
|
104
|
+
end
|
105
|
+
|
106
|
+
it "allows historical to be explicitly enabled" do
|
107
|
+
r = newo
|
108
|
+
r.input = "input"
|
109
|
+
r.input_location = "remote_url"
|
110
|
+
r.filename = "filename"
|
111
|
+
r.api_key = "api_key"
|
112
|
+
r.historical = true
|
113
|
+
|
114
|
+
res = r.to_httparty
|
115
|
+
expect(res).to be_a Array
|
116
|
+
method, url, data = res
|
117
|
+
expect(data.fetch(:body)).to eq "{\"input\":\"input\",\"input_location\":\"remote_url\",\"filename\":\"filename\",\"key\":\"api_key\",\"request_meta_data\":{\"leverage_historical_data\":true}}"
|
118
|
+
end
|
87
119
|
end
|
88
120
|
end
|
89
121
|
end; end; end
|
@@ -21,7 +21,7 @@ module NeverBounce; module API; module Request
|
|
21
21
|
expect(res).to be_a Array
|
22
22
|
method, url, data = res
|
23
23
|
expect(method).to eq :post
|
24
|
-
expect(url).to eq "https://api.neverbounce.com/v4/jobs/delete"
|
24
|
+
expect(url).to eq "https://api.neverbounce.com/v4.1/jobs/delete"
|
25
25
|
expect(data).to include(:body, :headers)
|
26
26
|
expect(data.fetch(:body)).to eq("{\"job_id\":\"123\",\"key\":\"api_key\"}")
|
27
27
|
expect(data.fetch(:headers)).to include("Content-Type", "User-Agent")
|
@@ -21,7 +21,7 @@ module NeverBounce; module API; module Request
|
|
21
21
|
expect(res).to be_a Array
|
22
22
|
method, url, data = res
|
23
23
|
expect(method).to eq :get
|
24
|
-
expect(url).to eq "https://api.neverbounce.com/v4/jobs/download"
|
24
|
+
expect(url).to eq "https://api.neverbounce.com/v4.1/jobs/download"
|
25
25
|
expect(data).to include(:body, :headers)
|
26
26
|
expect(data.fetch(:body)).to eq("{\"job_id\":\"123\",\"key\":\"api_key\"}")
|
27
27
|
expect(data.fetch(:headers)).to include("Content-Type", "User-Agent")
|
@@ -34,7 +34,7 @@ module NeverBounce; module API; module Request
|
|
34
34
|
expect(res).to be_a Array
|
35
35
|
method, url, data = res
|
36
36
|
expect(method).to eq :post
|
37
|
-
expect(url).to eq "https://api.neverbounce.com/v4/jobs/parse"
|
37
|
+
expect(url).to eq "https://api.neverbounce.com/v4.1/jobs/parse"
|
38
38
|
expect(data).to include(:body, :headers)
|
39
39
|
expect(data.fetch(:body)).to eq("{\"job_id\":\"123\",\"key\":\"api_key\"}")
|
40
40
|
expect(data.fetch(:headers)).to include("Content-Type", "User-Agent")
|
@@ -32,7 +32,7 @@ module NeverBounce; module API; module Request
|
|
32
32
|
expect(res).to be_a Array
|
33
33
|
method, url, data = res
|
34
34
|
expect(method).to eq :get
|
35
|
-
expect(url).to eq "https://api.neverbounce.com/v4/jobs/results"
|
35
|
+
expect(url).to eq "https://api.neverbounce.com/v4.1/jobs/results"
|
36
36
|
expect(data).to include(:body, :headers)
|
37
37
|
expect(data.fetch(:body)).to eq "{\"job_id\":\"123\",\"key\":\"api_key\"}"
|
38
38
|
expect(data.fetch(:headers)).to include("Content-Type", "User-Agent")
|
@@ -30,7 +30,7 @@ module NeverBounce; module API; module Request
|
|
30
30
|
expect(res).to be_a Array
|
31
31
|
method, url, data = res
|
32
32
|
expect(method).to eq :get
|
33
|
-
expect(url).to eq "https://api.neverbounce.com/v4/jobs/search"
|
33
|
+
expect(url).to eq "https://api.neverbounce.com/v4.1/jobs/search"
|
34
34
|
expect(data).to include(:body, :headers)
|
35
35
|
expect(data.fetch(:body)).to eq "{\"key\":\"api_key\",\"job_id\":\"abc\",\"page\":12,\"items_per_page\":34}"
|
36
36
|
expect(data.fetch(:headers)).to include("Content-Type", "User-Agent")
|
@@ -34,7 +34,7 @@ module NeverBounce; module API; module Request
|
|
34
34
|
expect(res).to be_a Array
|
35
35
|
method, url, data = res
|
36
36
|
expect(method).to eq :post
|
37
|
-
expect(url).to eq "https://api.neverbounce.com/v4/jobs/start"
|
37
|
+
expect(url).to eq "https://api.neverbounce.com/v4.1/jobs/start"
|
38
38
|
expect(data).to include(:body, :headers)
|
39
39
|
expect(data.fetch(:body)).to eq("{\"job_id\":\"123\",\"key\":\"api_key\"}")
|
40
40
|
expect(data.fetch(:headers)).to include("Content-Type", "User-Agent")
|
@@ -21,7 +21,7 @@ module NeverBounce; module API; module Request
|
|
21
21
|
expect(res).to be_a Array
|
22
22
|
method, url, data = res
|
23
23
|
expect(method).to eq :get
|
24
|
-
expect(url).to eq "https://api.neverbounce.com/v4/jobs/status"
|
24
|
+
expect(url).to eq "https://api.neverbounce.com/v4.1/jobs/status"
|
25
25
|
expect(data).to include(:body, :headers)
|
26
26
|
expect(data.fetch(:body)).to eq "{\"job_id\":\"123\",\"key\":\"api_key\"}"
|
27
27
|
expect(data.fetch(:headers)).to include("Content-Type", "User-Agent")
|
@@ -27,7 +27,7 @@ module NeverBounce; module API; module Request
|
|
27
27
|
expect(res).to be_a Array
|
28
28
|
method, url, data = res
|
29
29
|
expect(method).to eq :get
|
30
|
-
expect(url).to eq "https://api.neverbounce.com/v4/poe/confirm"
|
30
|
+
expect(url).to eq "https://api.neverbounce.com/v4.1/poe/confirm"
|
31
31
|
expect(data).to include(:body, :headers)
|
32
32
|
expect(data.fetch(:body)).to eq "{\"email\":\"email\",\"transaction_id\":\"NBTRNS-abcdefg\",\"confirmation_token\":\"abcdefg123456\",\"result\":\"valid\",\"key\":\"api_key\"}"
|
33
33
|
expect(data.fetch(:headers)).to include("Content-Type", "User-Agent")
|
@@ -15,6 +15,10 @@ module NeverBounce; module API; module Request
|
|
15
15
|
expect(r.mode_h).to eq({address_info: false, credits_info: false})
|
16
16
|
r = newo(address_info: true, credits_info: true, timeout: 12)
|
17
17
|
expect(r.mode_h).to eq({address_info: true, credits_info: true, timeout: 12})
|
18
|
+
r = newo(historical: true)
|
19
|
+
expect(r.mode_h).to eq({request_meta_data: {leverage_historical_data: true}})
|
20
|
+
r = newo(historical: false)
|
21
|
+
expect(r.mode_h).to eq({request_meta_data: {leverage_historical_data: false}})
|
18
22
|
end
|
19
23
|
end
|
20
24
|
|
@@ -34,11 +38,33 @@ module NeverBounce; module API; module Request
|
|
34
38
|
expect(res).to be_a Array
|
35
39
|
method, url, data = res
|
36
40
|
expect(method).to eq :get
|
37
|
-
expect(url).to eq "https://api.neverbounce.com/v4/single/check"
|
41
|
+
expect(url).to eq "https://api.neverbounce.com/v4.1/single/check"
|
38
42
|
expect(data).to include(:body, :headers)
|
39
43
|
expect(data.fetch(:body)).to eq "{\"email\":\"email\",\"key\":\"api_key\",\"address_info\":true,\"credits_info\":true,\"timeout\":12}"
|
40
44
|
expect(data.fetch(:headers)).to include("Content-Type", "User-Agent")
|
41
45
|
end
|
46
|
+
|
47
|
+
it "allows historical to be disabled" do
|
48
|
+
r = newo(address_info: true, credits_info: true, timeout: 12, historical: false)
|
49
|
+
r.email = "email"
|
50
|
+
r.api_key = "api_key"
|
51
|
+
|
52
|
+
res = r.to_httparty
|
53
|
+
expect(res).to be_a Array
|
54
|
+
method, url, data = res
|
55
|
+
expect(data.fetch(:body)).to eq "{\"email\":\"email\",\"key\":\"api_key\",\"address_info\":true,\"credits_info\":true,\"timeout\":12,\"request_meta_data\":{\"leverage_historical_data\":false}}"
|
56
|
+
end
|
57
|
+
|
58
|
+
it "allows historical to be explicitly enabled" do
|
59
|
+
r = newo(address_info: true, credits_info: true, timeout: 12, historical: true)
|
60
|
+
r.email = "email"
|
61
|
+
r.api_key = "api_key"
|
62
|
+
|
63
|
+
res = r.to_httparty
|
64
|
+
expect(res).to be_a Array
|
65
|
+
method, url, data = res
|
66
|
+
expect(data.fetch(:body)).to eq "{\"email\":\"email\",\"key\":\"api_key\",\"address_info\":true,\"credits_info\":true,\"timeout\":12,\"request_meta_data\":{\"leverage_historical_data\":true}}"
|
67
|
+
end
|
42
68
|
end
|
43
69
|
end
|
44
70
|
end; end; end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: neverbounce-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- NeverBounce
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-02-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|