neverbounce-cli 1.0.0 → 1.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 202a7ded299c4761089c26e09d03b252b811d9d8
4
- data.tar.gz: 311bd68352a8b8f2bea857fef0dc50e10c7196ab
3
+ metadata.gz: de530e60fa6e4110955d29a0c975a0365b937bb8
4
+ data.tar.gz: dff27632c5de34e9621b43497e313d1fc6a9b952
5
5
  SHA512:
6
- metadata.gz: 55ed5e3dd94804598bb0d4512249b70e7eaab1f7e3260a6e07003375945d445066daf7435700e5763a6dc7f3d3eab2f0f49e668216b57a8cf1d0efd75e153426
7
- data.tar.gz: 362647aab0c2e7d77361a91caf2c8dd9138a0298e3277e1cba700f8a8f2c024e8a9ff346f5b2cf437cda11d6e1d85cc75c46bc88ade35c45ef12c0c28c36a000
6
+ metadata.gz: 73bea0d0c19c223d9b9d7e36b71606a29cb47cd0b6e1747a5213ae34ce1a21abfe3f4ca362178fafafafe286e5e4cec150cc5d2f835c9880a6ddcf8f163c0647
7
+ data.tar.gz: b37a8e309a058329ce282c63c9150ad39df3bbde4460063b65f44ab133347f8489326b8cb14e63918b5c8f3eaf0e3b39475cb67e7316e643e22ae0d89beb128b
data/.gitignore CHANGED
@@ -8,6 +8,7 @@
8
8
  /tmp/*
9
9
  /vendor/bundle/
10
10
  /.yardoc/
11
+ *.gem
11
12
 
12
13
  # Project-specific.
13
14
  /lib/lib_local.rb
data/Gemfile.lock CHANGED
@@ -1,14 +1,14 @@
1
1
  GIT
2
2
  remote: https://github.com/NeverBounce/NeverBounceApi-Ruby.git
3
- revision: f7ecf950759aa61b818089cd1a1554bb93cb3851
3
+ revision: e1760adf5e4431fbaae811ceb3d0d383db6bc181
4
4
  specs:
5
- neverbounce-api (1.0.0)
5
+ neverbounce-api (1.0.1)
6
6
  httparty (~> 0.15)
7
7
 
8
8
  PATH
9
9
  remote: .
10
10
  specs:
11
- neverbounce-cli (1.0.0)
11
+ neverbounce-cli (1.0.1)
12
12
  neverbounce-api (~> 1.0.0)
13
13
  terminal-table (~> 1.8.0)
14
14
 
@@ -57,4 +57,4 @@ DEPENDENCIES
57
57
  yard
58
58
 
59
59
  BUNDLED WITH
60
- 1.15.3
60
+ 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-cli"><img src="https://badge.fury.io/rb/neverbounce-cli.svg" alt="Gem Version"></a>
5
6
  <a href="https://travis-ci.org/NeverBounce/NeverBounceCli-Ruby"><img src="https://travis-ci.org/NeverBounce/NeverBounceCli-Ruby.svg" alt="Build Status"></a>
6
7
  <a href="https://codeclimate.com/github/NeverBounce/NeverBounceCli-Ruby/coverage"><img src="https://codeclimate.com/github/NeverBounce/NeverBounceCli-Ruby/badges/coverage.svg" /></a>
7
8
  <a href="https://codeclimate.com/github/NeverBounce/NeverBounceCli-Ruby"><img src="https://codeclimate.com/github/NeverBounce/NeverBounceCli-Ruby/badges/gpa.svg" /></a>
@@ -20,10 +21,16 @@ This is the official NeverBounce V4 CLI written in Ruby. See also:
20
21
  In your `Gemfile`, add:
21
22
 
22
23
  ```ruby
23
- gem "neverbounce-api", git: "https://github.com/NeverBounce/NeverBounceApi-Ruby.git"
24
- gem "neverbounce-cli", git: "https://github.com/NeverBounce/NeverBounceCli-Ruby.git"
24
+ gem "neverbounce-cli"
25
25
  ```
26
26
 
27
+ > For **edge versions** of both, fetch gems directly:
28
+ >
29
+ > ```ruby
30
+ > gem "neverbounce-api", git: "https://github.com/NeverBounce/NeverBounceApi-Ruby.git"
31
+ > gem "neverbounce-cli", git: "https://github.com/NeverBounce/NeverBounceCli-Ruby.git"
32
+ > ```
33
+
27
34
  Install bundle, generate binstubs:
28
35
 
29
36
  ```sh
@@ -31,8 +38,8 @@ $ bundle install
31
38
  $ bundle binstub neverbounce-cli
32
39
 
33
40
  $ ls bin
34
- nb-account-info nb-jobs-delete nb-jobs-parse nb-jobs-search nb-jobs-status
35
- nb-jobs-create nb-jobs-download nb-jobs-results nb-jobs-start nb-single-check
41
+ nb-account-info nb-jobs-delete nb-jobs-parse nb-jobs-search nb-jobs-status nb-single-check
42
+ nb-jobs-create nb-jobs-download nb-jobs-results nb-jobs-start nb-poe-confirm
36
43
  ```
37
44
 
38
45
  Create `~/.neverbounce.yml`, add your API key there:
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "neverbounce-cli"
4
+
5
+ exit NeverBounce::CLI::Script::POEConfirm.new.main
@@ -0,0 +1,80 @@
1
+
2
+ require "neverbounce"
3
+
4
+ require_relative "request_maker"
5
+
6
+ module NeverBounce; module CLI; module Script
7
+ class POEConfirm < RequestMaker
8
+
9
+ attr_writer :email, :transaction_id, :confirmation_token, :result
10
+
11
+ envar "EMAIL*", "The email that was verified ", ["alice@isp.com", "bob.smith+1@domain.com"]
12
+ envar "TRANSACTION_ID*", "The transaction id returned by the public verification", ["NBTRNS-123456"]
13
+ envar "CONFIRMATION_TOKEN*", "The confirmation_token returned by the public verification", ["abcdefg123456"]
14
+ envar "RESULT*", "The result returned by the public verification", ["valid", "invalid", "catchall", "disposable", "unknown"]
15
+
16
+ def email
17
+ @email ||= env[k = "EMAIL"] or raise UsageError, "E-mail address not given, use `#{k}=`"
18
+ end
19
+
20
+ def transaction_id
21
+ @transaction_id ||= env[k = "TRANSACTION_ID"] or raise UsageError, "Transaction ID was not given, use `#{k}=`"
22
+ end
23
+
24
+ def confirmation_token
25
+ @confirmation_token ||= env[k = "CONFIRMATION_TOKEN"] or raise UsageError, "Confirmation Token was not given, use `#{k}=`"
26
+ end
27
+
28
+ def result
29
+ @result ||= env[k = "RESULT"] or raise UsageError, "Result was not given, use `#{k}=`"
30
+ end
31
+
32
+ # An <tt>API::Request::POEConfirm</tt>.
33
+ # @!attribute request
34
+ # @return [Object]
35
+ def request
36
+ @request ||= API::Request::POEConfirm.new({
37
+ api_key: api_key,
38
+ email: email,
39
+ transaction_id: transaction_id,
40
+ confirmation_token: confirmation_token,
41
+ result: result,
42
+ })
43
+ end
44
+
45
+ #--------------------------------------- Manifest
46
+
47
+ # @!attribute manifest
48
+ # @return [Manifest]
49
+ def manifest
50
+ @manifest ||= Manifest.new(
51
+ name: "nb-poe-confirm",
52
+ function: "Verify a verification performed on the frontend with the Javascript Wdiget",
53
+ cmdline: "[options] [VAR1=value] [VAR2=value] ...",
54
+ )
55
+ end
56
+
57
+ #--------------------------------------- Main
58
+
59
+ # @return [Integer]
60
+ def slim_main
61
+ "Response".tap do |label|
62
+ headings = [
63
+ ["TokenConfirmed", :token_confirmed],
64
+
65
+ ["ExecTime", :execution_time, :right],
66
+ ]
67
+
68
+ table = Table.new(
69
+ headings: headings.map { |ar| ar[0] },
70
+ rows: [headings.map { |ar| get_table_value(response, ar) }],
71
+ ).align!(headings)
72
+
73
+ stdout.puts "\n#{label}:"
74
+ stdout.puts table
75
+ end
76
+
77
+ 0
78
+ end
79
+ end
80
+ end; end; end
@@ -1,4 +1,4 @@
1
1
 
2
2
  module NeverBounce; module CLI
3
- VERSION = "1.0.0"
3
+ VERSION = "1.0.1"
4
4
  end; end
@@ -0,0 +1,36 @@
1
+
2
+ module NeverBounce; module CLI; module Script
3
+ describe POEConfirm do
4
+ include_dir_context __dir__
5
+
6
+ def margv(*args)
7
+ ["API_KEY=abc", "EMAIL=alice@isp.com", "TRANSACTION_ID=NBTRNS-123456", "CONFIRMATION_TOKEN=abcdefg123456", "RESULT=valid"] + args
8
+ end
9
+
10
+ it_behaves_like "instantiatable"
11
+ it_behaves_like "a script supporting `--help`", signatures: [/nb-poe-confirm/, /EMAIL/, /TRANSACTION_ID/, /CONFIRMATION_TOKEN/, /RESULT/]
12
+
13
+ describe "#request_curl" do
14
+ it "generally works" do
15
+ r = goodo(argv: margv())
16
+ expect(r.request_curl).to eq ["--request", "GET", "--url", "https://api.neverbounce.com/v4/poe/confirm", "--header", "Content-Type: application/json", "--data-binary", "{\"email\":\"alice@isp.com\",\"transaction_id\":\"NBTRNS-123456\",\"confirmation_token\":\"abcdefg123456\",\"result\":\"valid\",\"key\":\"abc\"}"]
17
+ end
18
+ end
19
+
20
+
21
+
22
+ describe "output" do
23
+ it "generally works" do
24
+ r = goodo(argv: margv).tap do |_|
25
+ _.session.server_content_type = "application/json"
26
+ _.session.server_raw = '{"status":"success","token_confirmed":true,"execution_time":25}'
27
+ end
28
+ expect { r.main }.not_to raise_error
29
+ lines = r.stdout.tap(&:rewind).to_a
30
+ expect(lines).to be_any { |s| s =~ /Response:/ }
31
+ expect(lines).to be_any { |s| s =~ cell("TokenConfirmed") }
32
+ expect(lines).to be_any { |s| s =~ cell("ExecTime") }
33
+ end
34
+ end
35
+ end
36
+ end; end; end
@@ -1,6 +1,6 @@
1
1
 
2
2
  describe NeverBounce::CLI do
3
3
  describe "VERSION" do
4
- it { expect(described_class::VERSION).to eq "1.0.0" }
4
+ it { expect(described_class::VERSION).to eq "1.0.1" }
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: neverbounce-cli
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: exe
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: neverbounce-api
@@ -51,6 +51,7 @@ executables:
51
51
  - nb-jobs-search
52
52
  - nb-jobs-start
53
53
  - nb-jobs-status
54
+ - nb-poe-confirm
54
55
  - nb-single-check
55
56
  extensions: []
56
57
  extra_rdoc_files: []
@@ -74,6 +75,7 @@ files:
74
75
  - exe/nb-jobs-search
75
76
  - exe/nb-jobs-start
76
77
  - exe/nb-jobs-status
78
+ - exe/nb-poe-confirm
77
79
  - exe/nb-single-check
78
80
  - lib/never_bounce/cli/feature/basic_initialize.rb
79
81
  - lib/never_bounce/cli/feature/eigencache.rb
@@ -98,6 +100,7 @@ files:
98
100
  - lib/never_bounce/cli/script/jobs_status.rb
99
101
  - lib/never_bounce/cli/script/manifest.rb
100
102
  - lib/never_bounce/cli/script/meaningful.rb
103
+ - lib/never_bounce/cli/script/poe_confirm.rb
101
104
  - lib/never_bounce/cli/script/request_maker.rb
102
105
  - lib/never_bounce/cli/script/single_check.rb
103
106
  - lib/never_bounce/cli/script/table.rb
@@ -128,6 +131,7 @@ files:
128
131
  - spec/lib/never_bounce/cli/script/jobs_status_spec.rb
129
132
  - spec/lib/never_bounce/cli/script/manifest_spec.rb
130
133
  - spec/lib/never_bounce/cli/script/meaningful_spec.rb
134
+ - spec/lib/never_bounce/cli/script/poe_confirm_spec.rb
131
135
  - spec/lib/never_bounce/cli/script/request_maker_spec.rb
132
136
  - spec/lib/never_bounce/cli/script/single_check_spec.rb
133
137
  - spec/lib/never_bounce/cli/script/spec_helper.rb
@@ -183,6 +187,7 @@ test_files:
183
187
  - spec/lib/never_bounce/cli/script/jobs_status_spec.rb
184
188
  - spec/lib/never_bounce/cli/script/manifest_spec.rb
185
189
  - spec/lib/never_bounce/cli/script/meaningful_spec.rb
190
+ - spec/lib/never_bounce/cli/script/poe_confirm_spec.rb
186
191
  - spec/lib/never_bounce/cli/script/request_maker_spec.rb
187
192
  - spec/lib/never_bounce/cli/script/single_check_spec.rb
188
193
  - spec/lib/never_bounce/cli/script/spec_helper.rb