blazeverify 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +8 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +7 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +50 -0
- data/LICENSE.txt +21 -0
- data/README.md +109 -0
- data/Rakefile +10 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/blazeverify.gemspec +33 -0
- data/lib/blazeverify.rb +40 -0
- data/lib/blazeverify/batch.rb +42 -0
- data/lib/blazeverify/client.rb +87 -0
- data/lib/blazeverify/resources/account.rb +5 -0
- data/lib/blazeverify/resources/api_resource.rb +11 -0
- data/lib/blazeverify/resources/batch_status.rb +9 -0
- data/lib/blazeverify/resources/verification.rb +12 -0
- data/lib/blazeverify/version.rb +3 -0
- data/test/blazeverify/batch_test.rb +32 -0
- data/test/blazeverify_test.rb +59 -0
- data/test/test_helper.rb +10 -0
- metadata +196 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: fc15269fe855612aa7527f3e597d55ff7a59696f1dd1664c8e2035f893b31086
|
4
|
+
data.tar.gz: febc96b7c5a95b30e846b4741c96d25d1a826d454e83e27cb6ef15759167ece9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 16f4ee6a1eb89a09108122ea409a4dff029ec9ce0934f31443a84f8c35e63fd8f27a29c1e9cf99cdf06ba4e37f021e2c95157bb57db6185dd35ec8b6821a191b
|
7
|
+
data.tar.gz: 63a9bb0fbd4a81f31b6a7ed4f949ed33c33847ae9491c37e3a01f6bc81d43df114346232e35cfb6d93ba9300f58a94818f68241d9fc0923db95222beef59b2c8
|
data/.gitignore
ADDED
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
blazeverify-ruby
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.6.3
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
blazeverify (0.1.0)
|
5
|
+
faraday (~> 0.13)
|
6
|
+
faraday_middleware
|
7
|
+
net-http-persistent
|
8
|
+
|
9
|
+
GEM
|
10
|
+
remote: https://rubygems.org/
|
11
|
+
specs:
|
12
|
+
ansi (1.5.0)
|
13
|
+
awesome_print (1.8.0)
|
14
|
+
builder (3.2.3)
|
15
|
+
coderay (1.1.2)
|
16
|
+
connection_pool (2.2.2)
|
17
|
+
faraday (0.15.4)
|
18
|
+
multipart-post (>= 1.2, < 3)
|
19
|
+
faraday_middleware (0.13.1)
|
20
|
+
faraday (>= 0.7.4, < 1.0)
|
21
|
+
method_source (0.9.2)
|
22
|
+
minitest (5.11.3)
|
23
|
+
minitest-reporters (1.3.6)
|
24
|
+
ansi
|
25
|
+
builder
|
26
|
+
minitest (>= 5.0)
|
27
|
+
ruby-progressbar
|
28
|
+
multipart-post (2.1.1)
|
29
|
+
net-http-persistent (3.0.1)
|
30
|
+
connection_pool (~> 2.2)
|
31
|
+
pry (0.12.2)
|
32
|
+
coderay (~> 1.1.0)
|
33
|
+
method_source (~> 0.9.0)
|
34
|
+
rake (10.5.0)
|
35
|
+
ruby-progressbar (1.10.1)
|
36
|
+
|
37
|
+
PLATFORMS
|
38
|
+
ruby
|
39
|
+
|
40
|
+
DEPENDENCIES
|
41
|
+
awesome_print
|
42
|
+
blazeverify!
|
43
|
+
bundler
|
44
|
+
minitest (~> 5.0)
|
45
|
+
minitest-reporters
|
46
|
+
pry
|
47
|
+
rake (~> 10.0)
|
48
|
+
|
49
|
+
BUNDLED WITH
|
50
|
+
1.17.3
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2019 Blaze Verify. https://blazeverify.com
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,109 @@
|
|
1
|
+
# Blaze Verify Ruby Library
|
2
|
+
|
3
|
+
[![Build Status](https://travis-ci.com/blazeverify/blazeverify-ruby.svg)](https://travis-ci.com/blazeverify/blazeverify-ruby)
|
4
|
+
[![Maintainability](https://api.codeclimate.com/v1/badges/2d74c69a9155109058a7/maintainability)](https://codeclimate.com/github/blazeverify/blazeverify-ruby/maintainability)
|
5
|
+
|
6
|
+
This is the official ruby wrapper for the Blaze Verify API.
|
7
|
+
|
8
|
+
## Documentation
|
9
|
+
|
10
|
+
See the [Ruby API docs](https://blazeverify.com/docs/api).
|
11
|
+
|
12
|
+
## Installation
|
13
|
+
|
14
|
+
Add this line to your application's Gemfile:
|
15
|
+
|
16
|
+
```ruby
|
17
|
+
gem 'blazeverify'
|
18
|
+
```
|
19
|
+
|
20
|
+
And then execute:
|
21
|
+
|
22
|
+
$ bundle
|
23
|
+
|
24
|
+
Or install it yourself as:
|
25
|
+
|
26
|
+
$ gem install blazeverify
|
27
|
+
|
28
|
+
## Usage
|
29
|
+
|
30
|
+
The library needs to be configured with your account's API key which is available in your [Blaze Verify Dashboard](https://app.blazeverify.com/api). Set `BlazeVerify.api_key` to its value:
|
31
|
+
|
32
|
+
### Setup
|
33
|
+
|
34
|
+
```ruby
|
35
|
+
require 'blazeverify'
|
36
|
+
|
37
|
+
# set api key
|
38
|
+
BlazeVerify.api_key = 'live_...'
|
39
|
+
```
|
40
|
+
|
41
|
+
### Verification
|
42
|
+
|
43
|
+
```ruby
|
44
|
+
# verify an email address
|
45
|
+
BlazeVerify.verify('jarrett@blazeverify.com')
|
46
|
+
```
|
47
|
+
|
48
|
+
#### Slow Email Server Handling
|
49
|
+
|
50
|
+
Some email servers are slow to respond. As a result the timeout may be reached
|
51
|
+
before we are able to complete the verification process. If this happens, the
|
52
|
+
verification will continue in the background on our servers. We recommend
|
53
|
+
sleeping for at least one second and trying your request again. Re-requesting
|
54
|
+
the same verification with the same options will not impact your credit
|
55
|
+
allocation within a 5 minute window.
|
56
|
+
|
57
|
+
```ruby
|
58
|
+
{
|
59
|
+
"message" => "Your request is taking longer than normal. Please send your request again."
|
60
|
+
}
|
61
|
+
```
|
62
|
+
|
63
|
+
### Batch Verification
|
64
|
+
|
65
|
+
#### Start a batch
|
66
|
+
|
67
|
+
```ruby
|
68
|
+
emails = ['jarrett@blazeverify.com', 'support@blazeverify.com', ...]
|
69
|
+
batch = BlazeVerify::Batch.new(emails)
|
70
|
+
|
71
|
+
# you can optionally pass in a callback url that we'll POST to when the
|
72
|
+
# batch is complete.
|
73
|
+
batch = BlazeVerify::Batch.new(emails, callback: 'https://blazeverify.com/')
|
74
|
+
|
75
|
+
# start verifying the batch
|
76
|
+
batch.verify
|
77
|
+
```
|
78
|
+
|
79
|
+
#### Get the status / results of a batch
|
80
|
+
|
81
|
+
Calling `status` on a batch will return the status. It will contain the results as well once complete. You can also `results` to get just the results.
|
82
|
+
|
83
|
+
```ruby
|
84
|
+
id = '5cfcbfdeede34200693c4319'
|
85
|
+
batch = BlazeVerify::Batch.new(id)
|
86
|
+
|
87
|
+
# get status of batch
|
88
|
+
batch.status
|
89
|
+
|
90
|
+
# gets the results
|
91
|
+
batch.status.emails
|
92
|
+
|
93
|
+
# get the counts
|
94
|
+
batch.status.total_counts
|
95
|
+
batch.status.reason_counts
|
96
|
+
|
97
|
+
# returns true / false
|
98
|
+
batch.complete?
|
99
|
+
```
|
100
|
+
|
101
|
+
## Development
|
102
|
+
|
103
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
104
|
+
|
105
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
106
|
+
|
107
|
+
## Contributing
|
108
|
+
|
109
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/blazeverify/blazeverify-ruby.
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "blazeverify/ruby"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/blazeverify.gemspec
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
$LOAD_PATH.unshift(::File.join(::File.dirname(__FILE__), 'lib'))
|
4
|
+
|
5
|
+
require 'blazeverify/version'
|
6
|
+
|
7
|
+
Gem::Specification.new do |s|
|
8
|
+
s.name = 'blazeverify'
|
9
|
+
s.version = BlazeVerify::VERSION
|
10
|
+
s.summary = 'Ruby bindings for the Blaze Verify API'
|
11
|
+
s.description = 'Email Verification that’s astonishingly easy and low-cost.'
|
12
|
+
s.homepage = 'https://blazeverify.com'
|
13
|
+
s.author = 'Blaze Verify'
|
14
|
+
s.email = 'support@blazeverify.com'
|
15
|
+
s.license = 'MIT'
|
16
|
+
|
17
|
+
s.files = `git ls-files`.split("\n")
|
18
|
+
s.test_files = `git ls-files -- test/*`.split("\n")
|
19
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map do |f|
|
20
|
+
::File.basename(f)
|
21
|
+
end
|
22
|
+
s.require_paths = ['lib']
|
23
|
+
|
24
|
+
s.add_dependency 'faraday', '~> 0.13'
|
25
|
+
s.add_dependency 'faraday_middleware'
|
26
|
+
s.add_dependency 'net-http-persistent'
|
27
|
+
s.add_development_dependency 'bundler'
|
28
|
+
s.add_development_dependency 'rake', '~> 10.0'
|
29
|
+
s.add_development_dependency 'pry'
|
30
|
+
s.add_development_dependency 'awesome_print'
|
31
|
+
s.add_development_dependency 'minitest', '~> 5.0'
|
32
|
+
s.add_development_dependency 'minitest-reporters'
|
33
|
+
end
|
data/lib/blazeverify.rb
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'faraday'
|
2
|
+
require 'faraday_middleware'
|
3
|
+
require 'blazeverify/version'
|
4
|
+
require 'blazeverify/client'
|
5
|
+
require 'blazeverify/batch'
|
6
|
+
require 'blazeverify/resources/api_resource'
|
7
|
+
require 'blazeverify/resources/account'
|
8
|
+
require 'blazeverify/resources/batch_status'
|
9
|
+
require 'blazeverify/resources/verification'
|
10
|
+
|
11
|
+
module BlazeVerify
|
12
|
+
@max_network_retries = 1
|
13
|
+
|
14
|
+
class << self
|
15
|
+
attr_accessor :api_key, :max_network_retries
|
16
|
+
end
|
17
|
+
|
18
|
+
module_function
|
19
|
+
|
20
|
+
def verify(email, smtp: nil, accept_all: nil, timeout: nil)
|
21
|
+
opts = {
|
22
|
+
email: email, smtp: smtp, accept_all: accept_all, timeout: timeout
|
23
|
+
}
|
24
|
+
|
25
|
+
client = BlazeVerify::Client.new
|
26
|
+
response = client.request(:get, 'verify', opts)
|
27
|
+
|
28
|
+
if response.status == 249
|
29
|
+
response.body
|
30
|
+
else
|
31
|
+
Verification.new(response.body)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def account
|
36
|
+
client = BlazeVerify::Client.new
|
37
|
+
response = client.request(:get, 'account')
|
38
|
+
Account.new(response.body)
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module BlazeVerify
|
2
|
+
class Batch
|
3
|
+
attr_accessor :id
|
4
|
+
|
5
|
+
def initialize(id_or_emails, callback: nil)
|
6
|
+
if id_or_emails.is_a?(Array)
|
7
|
+
@emails = id_or_emails
|
8
|
+
@callback = callback
|
9
|
+
elsif id_or_emails.is_a?(String)
|
10
|
+
@id = id_or_emails
|
11
|
+
else
|
12
|
+
raise ArgumentError, 'expected an array of emails or batch id'
|
13
|
+
end
|
14
|
+
|
15
|
+
@client = BlazeVerify::Client.new
|
16
|
+
end
|
17
|
+
|
18
|
+
def verify
|
19
|
+
return @id unless @id.nil?
|
20
|
+
|
21
|
+
opts = { emails: @emails.join(','), url: @callback }
|
22
|
+
response = @client.request(:post, 'batch', opts)
|
23
|
+
|
24
|
+
@id = response.body['id']
|
25
|
+
end
|
26
|
+
|
27
|
+
def status
|
28
|
+
return nil unless @id
|
29
|
+
return @status if @status
|
30
|
+
|
31
|
+
response = @client.request(:get, 'batch', { id: @id })
|
32
|
+
bs = BatchStatus.new(response.body)
|
33
|
+
@status = bs if bs.complete?
|
34
|
+
|
35
|
+
bs
|
36
|
+
end
|
37
|
+
|
38
|
+
def complete?
|
39
|
+
!status.complete?
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,87 @@
|
|
1
|
+
module BlazeVerify
|
2
|
+
class Client
|
3
|
+
|
4
|
+
def initialize
|
5
|
+
@client = Faraday.new('https://api.blazeverify.com/v1') do |f|
|
6
|
+
f.request :url_encoded
|
7
|
+
f.response :json, content_type: /\bjson$/
|
8
|
+
f.adapter :net_http_persistent
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def request(method, endpoint, opts = {})
|
13
|
+
begin
|
14
|
+
tries ||= 0
|
15
|
+
|
16
|
+
@client.params[:api_key] = BlazeVerify.api_key
|
17
|
+
|
18
|
+
response =
|
19
|
+
if method == :get
|
20
|
+
@client.get(endpoint, opts)
|
21
|
+
elsif method == :post
|
22
|
+
@client.post(endpoint, opts)
|
23
|
+
end
|
24
|
+
rescue => e
|
25
|
+
retry if self.class.should_retry?(e, tries)
|
26
|
+
|
27
|
+
raise e
|
28
|
+
end
|
29
|
+
|
30
|
+
status = response.status
|
31
|
+
return response if status.between?(200, 299)
|
32
|
+
|
33
|
+
error_attributes = {
|
34
|
+
message: response.body['message'],
|
35
|
+
code: status
|
36
|
+
}
|
37
|
+
error_map = {
|
38
|
+
'400' => BadRequestError,
|
39
|
+
'401' => UnauthorizedError,
|
40
|
+
'402' => PaymentRequiredError,
|
41
|
+
'403' => ForbiddenError,
|
42
|
+
'404' => NotFoundError,
|
43
|
+
'429' => TooManyRequestsError,
|
44
|
+
'500' => InternalServerError,
|
45
|
+
'503' => ServiceUnavailableError
|
46
|
+
}
|
47
|
+
|
48
|
+
raise error_map[status.to_s].new(error_attributes)
|
49
|
+
end
|
50
|
+
|
51
|
+
def self.should_retry?(error, num_retries)
|
52
|
+
return false if num_retries >= BlazeVerify.max_network_retries
|
53
|
+
|
54
|
+
# Retry on timeout-related problems (either on open or read).
|
55
|
+
return true if error.is_a?(Faraday::TimeoutError)
|
56
|
+
|
57
|
+
# Destination refused the connection, the connection was reset, or a
|
58
|
+
# variety of other connection failures. This could occur from a single
|
59
|
+
# saturated server, so retry in case it's intermittent.
|
60
|
+
return true if error.is_a?(Faraday::ConnectionFailed)
|
61
|
+
|
62
|
+
if error.is_a?(Faraday::ClientError) && error.response
|
63
|
+
# 409 conflict
|
64
|
+
return true if error.response[:status] == 409
|
65
|
+
end
|
66
|
+
|
67
|
+
false
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
class Error < StandardError
|
72
|
+
attr_accessor :code, :message
|
73
|
+
|
74
|
+
def initialize(code: nil, message: nil)
|
75
|
+
@code = code
|
76
|
+
@message = message
|
77
|
+
end
|
78
|
+
end
|
79
|
+
class BadRequestError < Error; end
|
80
|
+
class UnauthorizedError < Error; end
|
81
|
+
class PaymentRequiredError < Error; end
|
82
|
+
class ForbiddenError < Error; end
|
83
|
+
class NotFoundError < Error; end
|
84
|
+
class TooManyRequestsError < Error; end
|
85
|
+
class InternalServerError < Error; end
|
86
|
+
class ServiceUnavailableError < Error; end
|
87
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module BlazeVerify
|
2
|
+
class Verification < APIResource
|
3
|
+
attr_accessor :accept_all, :did_you_mean, :disposable, :domain, :email,
|
4
|
+
:free, :reason, :role, :score, :state, :tag, :user
|
5
|
+
|
6
|
+
%w(accept_all disposable free role).each do |method|
|
7
|
+
define_method("#{method}?") do
|
8
|
+
instance_variable_get "@#{method}"
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
### BATCH ENDPOINT DOES NOT SUPPORT TEST KEYS YET ###
|
2
|
+
#
|
3
|
+
# require 'test_helper'
|
4
|
+
#
|
5
|
+
# module BlazeVerfiy
|
6
|
+
# class BatchTest < Minitest::Test
|
7
|
+
#
|
8
|
+
# def setup
|
9
|
+
# sleep(1)
|
10
|
+
# BlazeVerify.api_key = 'test_7aff7fc0142c65f86a00'
|
11
|
+
# @emails = ['jarrett@blazeverify.com', 'support@blazeverify.com']
|
12
|
+
# @batch = BlazeVerify::Batch.new(@emails)
|
13
|
+
# @batch_id ||= @batch.verify
|
14
|
+
# sleep(1)
|
15
|
+
# end
|
16
|
+
#
|
17
|
+
# def test_start_batch
|
18
|
+
# refute_nil @batch_id
|
19
|
+
# end
|
20
|
+
#
|
21
|
+
# def test_batch_status
|
22
|
+
# status = @batch.status
|
23
|
+
# refute_nil status.message
|
24
|
+
# end
|
25
|
+
#
|
26
|
+
# def test_batch_complete
|
27
|
+
# complete = @batch.complete?
|
28
|
+
# assert complete == true || complete == false
|
29
|
+
# end
|
30
|
+
#
|
31
|
+
# end
|
32
|
+
# end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class BlazeVerifyTest < Minitest::Test
|
4
|
+
|
5
|
+
def setup
|
6
|
+
BlazeVerify.api_key = 'test_7aff7fc0142c65f86a00'
|
7
|
+
@result ||= BlazeVerify.verify('jarrett@blazeverify.com')
|
8
|
+
sleep(0.25)
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_verification
|
12
|
+
refute_nil @result.domain
|
13
|
+
refute_nil @result.email
|
14
|
+
refute_nil @result.reason
|
15
|
+
refute_nil @result.score
|
16
|
+
refute_nil @result.state
|
17
|
+
refute_nil @result.user
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_verification_state
|
21
|
+
assert %w(deliverable undeliverable risky unknown).include?(@result.state)
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_verification_free
|
25
|
+
result = BlazeVerify.verify('jarrett@gmail.com')
|
26
|
+
assert result.free?
|
27
|
+
refute @result.free?
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_verification_role
|
31
|
+
result = BlazeVerify.verify('support@blazeverify.com')
|
32
|
+
assert result.role?
|
33
|
+
refute @result.role?
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_verification_did_you_mean
|
37
|
+
result = BlazeVerify.verify('jarrett@gmali.com')
|
38
|
+
assert result.did_you_mean, 'jarrett@gmail.com'
|
39
|
+
assert_nil @result.did_you_mean
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_verification_score
|
43
|
+
assert @result.score.is_a?(Integer)
|
44
|
+
end
|
45
|
+
|
46
|
+
def test_verification_tag
|
47
|
+
result = BlazeVerify.verify('jarrett+marketing@blazeverify.com')
|
48
|
+
assert result.tag == 'marketing'
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_account
|
52
|
+
BlazeVerify.api_key = 'test_7aff7fc0142c65f86a00'
|
53
|
+
account = BlazeVerify.account
|
54
|
+
|
55
|
+
refute_nil account.owner_email
|
56
|
+
refute_nil account.available_credits
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
$LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
|
2
|
+
require 'blazeverify'
|
3
|
+
|
4
|
+
require 'minitest/autorun'
|
5
|
+
require 'minitest/reporters'
|
6
|
+
Minitest::Reporters.use! [
|
7
|
+
Minitest::Reporters::ProgressReporter.new(color: true)
|
8
|
+
]
|
9
|
+
Minitest.load_plugins
|
10
|
+
Minitest::PrideIO.pride!
|
metadata
ADDED
@@ -0,0 +1,196 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: blazeverify
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Blaze Verify
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-06-11 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: faraday
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.13'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.13'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: faraday_middleware
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: net-http-persistent
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: bundler
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rake
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '10.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '10.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: pry
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: awesome_print
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: minitest
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '5.0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '5.0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: minitest-reporters
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
description: Email Verification that’s astonishingly easy and low-cost.
|
140
|
+
email: support@blazeverify.com
|
141
|
+
executables:
|
142
|
+
- console
|
143
|
+
- setup
|
144
|
+
extensions: []
|
145
|
+
extra_rdoc_files: []
|
146
|
+
files:
|
147
|
+
- ".gitignore"
|
148
|
+
- ".ruby-gemset"
|
149
|
+
- ".ruby-version"
|
150
|
+
- ".travis.yml"
|
151
|
+
- Gemfile
|
152
|
+
- Gemfile.lock
|
153
|
+
- LICENSE.txt
|
154
|
+
- README.md
|
155
|
+
- Rakefile
|
156
|
+
- bin/console
|
157
|
+
- bin/setup
|
158
|
+
- blazeverify.gemspec
|
159
|
+
- lib/blazeverify.rb
|
160
|
+
- lib/blazeverify/batch.rb
|
161
|
+
- lib/blazeverify/client.rb
|
162
|
+
- lib/blazeverify/resources/account.rb
|
163
|
+
- lib/blazeverify/resources/api_resource.rb
|
164
|
+
- lib/blazeverify/resources/batch_status.rb
|
165
|
+
- lib/blazeverify/resources/verification.rb
|
166
|
+
- lib/blazeverify/version.rb
|
167
|
+
- test/blazeverify/batch_test.rb
|
168
|
+
- test/blazeverify_test.rb
|
169
|
+
- test/test_helper.rb
|
170
|
+
homepage: https://blazeverify.com
|
171
|
+
licenses:
|
172
|
+
- MIT
|
173
|
+
metadata: {}
|
174
|
+
post_install_message:
|
175
|
+
rdoc_options: []
|
176
|
+
require_paths:
|
177
|
+
- lib
|
178
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
179
|
+
requirements:
|
180
|
+
- - ">="
|
181
|
+
- !ruby/object:Gem::Version
|
182
|
+
version: '0'
|
183
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
184
|
+
requirements:
|
185
|
+
- - ">="
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: '0'
|
188
|
+
requirements: []
|
189
|
+
rubygems_version: 3.0.3
|
190
|
+
signing_key:
|
191
|
+
specification_version: 4
|
192
|
+
summary: Ruby bindings for the Blaze Verify API
|
193
|
+
test_files:
|
194
|
+
- test/blazeverify/batch_test.rb
|
195
|
+
- test/blazeverify_test.rb
|
196
|
+
- test/test_helper.rb
|