neverbounce-api 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2683e539fe60e6a73a4da51b6bb67c07adbe59b3
4
- data.tar.gz: 48ed5a308179dbafdb7399ce6d4d92fd45df4b3a
3
+ metadata.gz: cf9fa5763f319e8fc240af66e7be1809b427ac5e
4
+ data.tar.gz: d960426232862d34bdd040d444627059fa63217a
5
5
  SHA512:
6
- metadata.gz: 443a8f1543281ee8857de7cf129785e146dbbf6f6b9ed6c79aef3ca9dd97beb9ae3d9fa3fdf1719ddae4225aa88d602a996accb39ecf5d383edcac144529d1ce
7
- data.tar.gz: 974b1aa515a03cf31b20899cbce77c3a2131bdd448dc98793c9a9cee9d4255fb1c3e51aad7858fe43cfc1b76e68d6b2621efe2456b6fab2c0908838276213ee9
6
+ metadata.gz: 7536bf00e5a1fd3fe82e139be0e361eb2adcc2e9729ec810b4fad6174fc40dac12ed56faa5e7b2a9ba2ebe52578a6269e1b134e83b8c81b497150293441cc019
7
+ data.tar.gz: 2a30f1057d9e26ea5785f992cc37edd17d560367998085a158ad204d79f4ac9a113f2c1eea17b763ccc0ae718b8e50eb0c30cb406e64933d09988e204f96c70f
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- neverbounce-api (1.0.0)
4
+ neverbounce-api (1.0.1)
5
5
  httparty (~> 0.15)
6
6
 
7
7
  GEM
@@ -45,4 +45,4 @@ DEPENDENCIES
45
45
  yard
46
46
 
47
47
  BUNDLED WITH
48
- 1.15.3
48
+ 1.15.4
data/README.md CHANGED
@@ -2,6 +2,7 @@
2
2
  <p align="center"><img src="https://neverbounce-marketing.s3.amazonaws.com/neverbounce_color_600px.png"></p>
3
3
 
4
4
  <p align="center">
5
+ <a href="https://badge.fury.io/rb/neverbounce-api"><img src="https://badge.fury.io/rb/neverbounce-api.svg" alt="Gem Version"></a>
5
6
  <a href="https://travis-ci.org/NeverBounce/NeverBounceApi-Ruby"><img src="https://travis-ci.org/NeverBounce/NeverBounceApi-Ruby.svg" alt="Build Status"></a>
6
7
  <a href="https://codeclimate.com/github/NeverBounce/NeverBounceApi-Ruby/coverage"><img src="https://codeclimate.com/github/NeverBounce/NeverBounceApi-Ruby/badges/coverage.svg" /></a>
7
8
  <a href="https://codeclimate.com/github/NeverBounce/NeverBounceApi-Ruby"><img src="https://codeclimate.com/github/NeverBounce/NeverBounceApi-Ruby/badges/gpa.svg" /></a>
@@ -14,15 +15,21 @@ This is the official NeverBounce V4 API for Ruby. See also:
14
15
 
15
16
  * Our full RubyDoc documentation: http://rubydoc.info/github/NeverBounce/NeverBounceApi-Ruby.
16
17
  * Our full REST API documentation: https://developers.neverbounce.com/v4.0/.
18
+ * RubyGems CLI: https://github.com/NeverBounce/NeverBounceCli-Ruby.
17
19
 
18
20
  ## Installation
19
21
 
20
22
  In your `Gemfile`, add:
21
23
 
22
24
  ```ruby
23
- gem "neverbounce-api", git: "https://github.com/NeverBounce/NeverBounceApi-Ruby.git"
25
+ gem "neverbounce-api"
24
26
  ```
25
27
 
28
+ > For **edge version,** fetch the gem directly:
29
+ > ```ruby
30
+ > gem "neverbounce-api", git: "https://github.com/NeverBounce/NeverBounceApi-Ruby.git"
31
+ > ```
32
+
26
33
  Install bundle:
27
34
 
28
35
  ```sh
@@ -100,6 +107,12 @@ resp = client.single_check(email: "alice@isp.com")
100
107
  resp = client.single_check(email: "alice@isp.com", address_info: true, credits_info: true, timeout: 3)
101
108
  ```
102
109
 
110
+ ### Confirm frontend (Javascript Widget) verification
111
+
112
+ ```ruby
113
+ resp = client.poe_confirm(email: "alice@isp.com", transaction_id: "NBTRNS-abcdefg123456", confirmation_token: "abcdefg123456", result: "valid")
114
+ ```
115
+
103
116
  See also: [method](http://rubydoc.info/github/NeverBounce/NeverBounceApi-Ruby/NeverBounce/API/Client.html#single_check-instance_method), [REST](https://developers.neverbounce.com/v4.0/reference#single-check).
104
117
 
105
118
  ### Create a bulk job
@@ -248,6 +248,27 @@ module NeverBounce; module API
248
248
  timeout: timeout,
249
249
  }))
250
250
  end
251
+
252
+ # Make a <tt>poe/confirm</tt> request.
253
+ # @param email [String]
254
+ # @param transaction_id [String]
255
+ # @param confirmation_token [String]
256
+ # @param result [String]
257
+ # @return [Response::POEConfirm]
258
+ # @return [Response::ErrorMessage]
259
+ # @raise [API::Error]
260
+ # @raise [StandardError]
261
+ # @see Request::POEConfirm
262
+ # @see https://developers.neverbounce.com/v4.0/reference#poe-confirm
263
+ def poe_confirm(email: nil, transaction_id: nil, confirmation_token: nil, result: nil)
264
+ response_to(Request::POEConfirm.new({
265
+ api_key: api_key,
266
+ email: email,
267
+ transaction_id: transaction_id,
268
+ confirmation_token: confirmation_token,
269
+ result: result,
270
+ }))
271
+ end
251
272
  end
252
273
  end; end
253
274
 
@@ -0,0 +1,46 @@
1
+
2
+ require "never_bounce/api/response/poe_confirm"
3
+
4
+ require_relative "base"
5
+
6
+ module NeverBounce; module API; module Request
7
+ class POEConfirm < Base
8
+ # @return [String]
9
+ attr_accessor :email
10
+
11
+ # @return [String]
12
+ attr_accessor :transaction_id
13
+
14
+ # @return [String]
15
+ attr_accessor :confirmation_token
16
+
17
+ # @return [String]
18
+ attr_accessor :result
19
+
20
+ # @return [Symbol]
21
+ def self.http_method
22
+ :get
23
+ end
24
+
25
+ # @return [String]
26
+ def self.path
27
+ "poe/confirm"
28
+ end
29
+
30
+ # @return [Response::POEConfirm]
31
+ def self.response_klass
32
+ Response::POEConfirm
33
+ end
34
+
35
+ # @return [Hash]
36
+ def to_h
37
+ {
38
+ email: require_attr(:email),
39
+ transaction_id: require_attr(:transaction_id),
40
+ confirmation_token: require_attr(:confirmation_token),
41
+ result: require_attr(:result),
42
+ key: require_attr(:api_key),
43
+ }
44
+ end
45
+ end
46
+ end; end; end
@@ -0,0 +1,9 @@
1
+ require_relative "success_message"
2
+
3
+ module NeverBounce; module API; module Response;
4
+ class POEConfirm < SuccessMessage
5
+ # @!attribute token_confirmed
6
+ # @return [Bool]
7
+ oattr :token_confirmed, :scalar
8
+ end
9
+ end; end; end
@@ -1,4 +1,4 @@
1
1
 
2
2
  module NeverBounce; module API
3
- VERSION = "1.0.0"
3
+ VERSION = "1.0.1"
4
4
  end; end
@@ -194,6 +194,21 @@ module NeverBounce; module API
194
194
  expect(request.timeout).to eq 12
195
195
  end
196
196
  end
197
+
198
+ describe "#poe_confirm" do
199
+ it "generally works" do
200
+ sc = goodo.poe_confirm(email: "alice@isp.com", transaction_id: "NBTRNS-123456", confirmation_token: "abcdefg123456", result: "valid")
201
+ expect(sc).to be_a Array
202
+ signature, request = sc
203
+ expect(signature).to eq :response_to
204
+ expect(request).to be_a Request::POEConfirm
205
+ expect(request.to_httparty).to be_a Array
206
+ expect(request.email).to eq "alice@isp.com"
207
+ expect(request.transaction_id).to eq "NBTRNS-123456"
208
+ expect(request.confirmation_token).to eq "abcdefg123456"
209
+ expect(request.result).to eq "valid"
210
+ end
211
+ end
197
212
  end
198
213
  end
199
214
  end; end
@@ -0,0 +1,37 @@
1
+
2
+ module NeverBounce; module API; module Request
3
+ describe POEConfirm do
4
+ include_dir_context __dir__
5
+
6
+ it_behaves_like "instantiatable"
7
+
8
+ describe ".response_klass" do
9
+ it { expect(described_class.response_klass).to eq Response::POEConfirm }
10
+ end
11
+
12
+ describe "#to_httparty" do
13
+ it "generally works" do
14
+ r = newo()
15
+ expect { r.to_httparty }.to raise_error(AttributeError, "Attribute must be set: email")
16
+ r.email = "email"
17
+ expect { r.to_httparty }.to raise_error(AttributeError, "Attribute must be set: transaction_id")
18
+ r.transaction_id = "NBTRNS-abcdefg"
19
+ expect { r.to_httparty }.to raise_error(AttributeError, "Attribute must be set: confirmation_token")
20
+ r.confirmation_token = "abcdefg123456"
21
+ expect { r.to_httparty }.to raise_error(AttributeError, "Attribute must be set: result")
22
+ r.result = "valid"
23
+ expect { r.to_httparty }.to raise_error(AttributeError, "Attribute must be set: api_key")
24
+ r.api_key = "api_key"
25
+
26
+ res = r.to_httparty
27
+ expect(res).to be_a Array
28
+ method, url, data = res
29
+ expect(method).to eq :get
30
+ expect(url).to eq "https://api.neverbounce.com/v4/poe/confirm"
31
+ expect(data).to include(:body, :headers)
32
+ expect(data.fetch(:body)).to eq "{\"email\":\"email\",\"transaction_id\":\"NBTRNS-abcdefg\",\"confirmation_token\":\"abcdefg123456\",\"result\":\"valid\",\"key\":\"api_key\"}"
33
+ expect(data.fetch(:headers)).to include("Content-Type", "User-Agent")
34
+ end
35
+ end
36
+ end
37
+ end; end; end
@@ -0,0 +1,7 @@
1
+
2
+ describe NeverBounce::API::Response::POEConfirm do
3
+ include_dir_context __dir__
4
+
5
+ it_behaves_like "instantiatable"
6
+ it_behaves_like "properly inherited"
7
+ end
@@ -3,6 +3,6 @@ require "never_bounce/api/version"
3
3
 
4
4
  describe NeverBounce::API do
5
5
  describe "VERSION" do
6
- it { expect(described_class::VERSION).to eq "1.0.0" }
6
+ it { expect(described_class::VERSION).to eq "1.0.1" }
7
7
  end
8
8
  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.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - NeverBounce
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-19 00:00:00.000000000 Z
11
+ date: 2017-10-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -58,6 +58,7 @@ files:
58
58
  - lib/never_bounce/api/request/jobs_search.rb
59
59
  - lib/never_bounce/api/request/jobs_start.rb
60
60
  - lib/never_bounce/api/request/jobs_status.rb
61
+ - lib/never_bounce/api/request/poe_confirm.rb
61
62
  - lib/never_bounce/api/request/single_check.rb
62
63
  - lib/never_bounce/api/response/account_info.rb
63
64
  - lib/never_bounce/api/response/account_info/job_counts.rb
@@ -83,6 +84,7 @@ files:
83
84
  - lib/never_bounce/api/response/jobs_start.rb
84
85
  - lib/never_bounce/api/response/jobs_status.rb
85
86
  - lib/never_bounce/api/response/message.rb
87
+ - lib/never_bounce/api/response/poe_confirm.rb
86
88
  - lib/never_bounce/api/response/single_check.rb
87
89
  - lib/never_bounce/api/response/status_message.rb
88
90
  - lib/never_bounce/api/response/success_message.rb
@@ -107,6 +109,7 @@ files:
107
109
  - spec/lib/never_bounce/api/request/jobs_search_spec.rb
108
110
  - spec/lib/never_bounce/api/request/jobs_start_spec.rb
109
111
  - spec/lib/never_bounce/api/request/jobs_status_spec.rb
112
+ - spec/lib/never_bounce/api/request/poe_confirm_spec.rb
110
113
  - spec/lib/never_bounce/api/request/single_check_spec.rb
111
114
  - spec/lib/never_bounce/api/response/account_info/job_counts_spec.rb
112
115
  - spec/lib/never_bounce/api/response/account_info_spec.rb
@@ -130,6 +133,7 @@ files:
130
133
  - spec/lib/never_bounce/api/response/jobs_search_spec.rb
131
134
  - spec/lib/never_bounce/api/response/jobs_start_spec.rb
132
135
  - spec/lib/never_bounce/api/response/jobs_status_spec.rb
136
+ - spec/lib/never_bounce/api/response/poe_confirm_spec.rb
133
137
  - spec/lib/never_bounce/api/response/single_check_spec.rb
134
138
  - spec/lib/never_bounce/api/response/spec_helper.rb
135
139
  - spec/lib/never_bounce/api/session_spec.rb
@@ -178,6 +182,7 @@ test_files:
178
182
  - spec/lib/never_bounce/api/request/jobs_search_spec.rb
179
183
  - spec/lib/never_bounce/api/request/jobs_start_spec.rb
180
184
  - spec/lib/never_bounce/api/request/jobs_status_spec.rb
185
+ - spec/lib/never_bounce/api/request/poe_confirm_spec.rb
181
186
  - spec/lib/never_bounce/api/request/single_check_spec.rb
182
187
  - spec/lib/never_bounce/api/response/account_info/job_counts_spec.rb
183
188
  - spec/lib/never_bounce/api/response/account_info_spec.rb
@@ -201,6 +206,7 @@ test_files:
201
206
  - spec/lib/never_bounce/api/response/jobs_search_spec.rb
202
207
  - spec/lib/never_bounce/api/response/jobs_start_spec.rb
203
208
  - spec/lib/never_bounce/api/response/jobs_status_spec.rb
209
+ - spec/lib/never_bounce/api/response/poe_confirm_spec.rb
204
210
  - spec/lib/never_bounce/api/response/single_check_spec.rb
205
211
  - spec/lib/never_bounce/api/response/spec_helper.rb
206
212
  - spec/lib/never_bounce/api/session_spec.rb