verifalia 1.1.0 → 2.0.0
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 +5 -5
- data/Gemfile +5 -5
- data/LICENSE +3 -4
- data/README.md +329 -78
- data/Rakefile +4 -0
- data/lib/verifalia/client.rb +60 -0
- data/lib/verifalia/credits/balance.rb +30 -0
- data/lib/verifalia/credits/client.rb +25 -0
- data/lib/verifalia/email_validation/client.rb +207 -0
- data/lib/verifalia/email_validation/completion_callback.rb +15 -0
- data/lib/verifalia/email_validation/entry.rb +89 -0
- data/lib/verifalia/email_validation/job.rb +75 -0
- data/lib/verifalia/email_validation/overview.rb +76 -0
- data/lib/verifalia/email_validation/progress.rb +19 -0
- data/lib/verifalia/email_validation/request.rb +19 -0
- data/lib/verifalia/email_validation/request_entry.rb +14 -0
- data/lib/verifalia/email_validation/wait_options.rb +53 -0
- data/lib/verifalia/rest/client.rb +82 -0
- data/lib/verifalia/security/certificate_authenticator.rb +21 -0
- data/lib/verifalia/security/username_password_authenticator.rb +22 -0
- data/lib/verifalia.rb +8 -23
- data/sig/completion_callback.rbs +5 -0
- data/sig/verifalia/client.rbs +11 -0
- data/sig/verifalia/credits/balance.rbs +11 -0
- data/sig/verifalia/credits/client.rbs +7 -0
- data/sig/verifalia/email_validations/client.rbs +24 -0
- data/sig/verifalia/email_validations/entry.rbs +22 -0
- data/sig/verifalia/email_validations/job.rbs +13 -0
- data/sig/verifalia/email_validations/overview.rbs +20 -0
- data/sig/verifalia/email_validations/progress.rbs +8 -0
- data/sig/verifalia/email_validations/request.rbs +13 -0
- data/sig/verifalia/email_validations/request_entry.rbs +8 -0
- data/sig/verifalia/email_validations/wait_options.rbs +20 -0
- data/sig/verifalia/rest/client.rbs +12 -0
- data/sig/verifalia/rest.rbs +6 -0
- data/sig/verifalia/security/username_password_authenticator.rbs +10 -0
- data/verifalia.gemspec +27 -18
- metadata +56 -54
- data/.gitignore +0 -23
- data/lib/rest/client.rb +0 -75
- data/lib/rest/email_validations.rb +0 -143
- data/lib/verifalia/util/configuration.rb +0 -7
- data/lib/verifalia/version.rb +0 -3
- data/spec/rest/client_spec.rb +0 -88
- data/spec/rest/email_validations_spec.rb +0 -263
- data/spec/spec_helper.rb +0 -21
- data/spec/util/configuration_spec.rb +0 -15
- data/spec/verifalia_spec.rb +0 -17
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Verifalia
|
4
|
+
module Security
|
5
|
+
# Allows to authenticate to Verifalia with a username and password pair.
|
6
|
+
class UsernamePasswordAuthenticator
|
7
|
+
def initialize(username, password = nil)
|
8
|
+
if username.nil? || username.strip.length == 0
|
9
|
+
raise ArgumentError, 'username is nil or empty: please visit https://verifalia.com/client-area to set up a new user, if you don\'t have one.'
|
10
|
+
end
|
11
|
+
|
12
|
+
@username = username
|
13
|
+
@password = password || ''
|
14
|
+
end
|
15
|
+
|
16
|
+
def authenticate(connection, request)
|
17
|
+
header = Faraday::Utils.basic_header_from(@username, @password)
|
18
|
+
request.headers[Faraday::Request::Authorization::KEY] = header
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
data/lib/verifalia.rb
CHANGED
@@ -1,27 +1,12 @@
|
|
1
|
-
|
2
|
-
require 'forwardable'
|
1
|
+
# frozen_string_literal: true
|
3
2
|
|
4
|
-
|
5
|
-
require 'verifalia/util/configuration'
|
3
|
+
require_relative 'verifalia/client'
|
6
4
|
|
7
|
-
|
5
|
+
require_relative 'verifalia/security/username_password_authenticator'
|
6
|
+
require_relative 'verifalia/security/certificate_authenticator'
|
8
7
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
def_delegators :configuration, :account_sid, :auth_token
|
8
|
+
require_relative 'verifalia/email_validation/client'
|
9
|
+
require_relative 'verifalia/credits/client'
|
13
10
|
|
14
|
-
|
15
|
-
|
16
|
-
# pass them to various initializers each time.
|
17
|
-
def self.configure(&block)
|
18
|
-
yield configuration
|
19
|
-
end
|
20
|
-
|
21
|
-
##
|
22
|
-
# Returns an existing or instantiates a new configuration object.
|
23
|
-
def self.configuration
|
24
|
-
@configuration ||= Util::Configuration.new
|
25
|
-
end
|
26
|
-
private_class_method :configuration
|
27
|
-
end
|
11
|
+
module Verifalia
|
12
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module Verifalia
|
2
|
+
module Credits
|
3
|
+
class Balance
|
4
|
+
def self.from_json: (Hash[String, untyped]) -> Balance
|
5
|
+
|
6
|
+
attr_reader credit_packs: BigDecimal
|
7
|
+
attr_reader free_credits: BigDecimal | nil
|
8
|
+
attr_reader free_credits_reset_in: String | nil
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Verifalia
|
2
|
+
module EmailValidations
|
3
|
+
class Client
|
4
|
+
@rest_client: Rest::Client
|
5
|
+
|
6
|
+
def delete: (String) -> void
|
7
|
+
def export: (String, String) -> String
|
8
|
+
def get: (String, wait_options: WaitOptions) -> (Job | nil)
|
9
|
+
def submit: ((String | Array[String] | Array[RequestEntry] | Array[Hash[String, untyped]] | RequestEntry | Request),
|
10
|
+
quality: String,
|
11
|
+
priority: (Integer | nil),
|
12
|
+
deduplication: String,
|
13
|
+
name: String,
|
14
|
+
retention: String,
|
15
|
+
completion_callback: CompletionCallback | Hash[String, untyped] | nil,
|
16
|
+
wait_options: WaitOptions) -> (Job | nil)
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def build_job: -> Job
|
21
|
+
def wait_for_completion: (Job, WaitOptions) -> (Job | nil)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Verifalia
|
2
|
+
module EmailValidations
|
3
|
+
class Entry
|
4
|
+
attr_reader completed_on: DateTime
|
5
|
+
attr_reader custom: String | nil
|
6
|
+
attr_reader duplicate_of: Integer | nil
|
7
|
+
attr_reader email_address: String | nil
|
8
|
+
attr_reader email_address_domain_part: String | nil
|
9
|
+
attr_reader email_address_local_part: String | nil
|
10
|
+
attr_reader has_international_domain_name: bool | nil
|
11
|
+
attr_reader has_international_mailbox_name: bool | nil
|
12
|
+
attr_reader index: Integer
|
13
|
+
attr_reader input_data: String
|
14
|
+
attr_reader classification: String
|
15
|
+
attr_reader is_disposable_email_address: bool | nil
|
16
|
+
attr_reader is_free_email_address: bool | nil
|
17
|
+
attr_reader is_role_account: bool | nil
|
18
|
+
attr_reader status: String
|
19
|
+
attr_reader syntax_failure_index: Integer | nil
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Verifalia
|
2
|
+
module EmailValidations
|
3
|
+
class Overview
|
4
|
+
attr_reader client_ip: IPAddr
|
5
|
+
attr_reader completed_on: (DateTime | nil)
|
6
|
+
attr_reader created_on: DateTime
|
7
|
+
attr_reader deduplication: String
|
8
|
+
attr_reader id: String
|
9
|
+
attr_reader name: String
|
10
|
+
attr_reader no_of_entries: Integer
|
11
|
+
attr_reader owner: String
|
12
|
+
attr_reader priority: (Integer | nil)
|
13
|
+
attr_reader progress: (Progress | nil)
|
14
|
+
attr_reader quality: String
|
15
|
+
attr_reader retention: String
|
16
|
+
attr_reader status: String
|
17
|
+
attr_reader submitted_on: DateTime
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Verifalia
|
2
|
+
module EmailValidations
|
3
|
+
class Request
|
4
|
+
attr_accessor callback: CompletionCallback | nil
|
5
|
+
attr_accessor deduplication: String | nil
|
6
|
+
attr_accessor entries: Array[RequestEntry]
|
7
|
+
attr_accessor name: String | nil
|
8
|
+
attr_accessor priority: Integer | nil
|
9
|
+
attr_accessor quality: String | nil
|
10
|
+
attr_accessor retention: String | nil
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Verifalia
|
2
|
+
module EmailValidations
|
3
|
+
class WaitOptions
|
4
|
+
@@default: WaitOptions
|
5
|
+
@@no_wait: WaitOptions
|
6
|
+
@submission_wait_time: Integer
|
7
|
+
@poll_wait_time: Integer
|
8
|
+
|
9
|
+
def self.default: -> WaitOptions
|
10
|
+
def self.no_wait: -> WaitOptions
|
11
|
+
|
12
|
+
attr_reader poll_wait_time: Integer
|
13
|
+
attr_reader progress: (^(Overview) -> void) | nil
|
14
|
+
attr_reader submission_wait_time: Integer
|
15
|
+
|
16
|
+
def initialize: (Integer, Integer) -> WaitOptions
|
17
|
+
def wait_for_next_poll: (Job) -> void
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/verifalia.gemspec
CHANGED
@@ -1,29 +1,38 @@
|
|
1
1
|
# coding: utf-8
|
2
|
+
|
2
3
|
lib = File.expand_path('../lib', __FILE__)
|
3
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'verifalia/
|
5
|
+
require 'verifalia/client'
|
5
6
|
|
6
7
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name =
|
8
|
-
spec.version = Verifalia::VERSION
|
9
|
-
spec.authors = [
|
10
|
-
spec.email = [
|
11
|
-
spec.summary =
|
12
|
-
spec.description =
|
13
|
-
spec.homepage =
|
14
|
-
spec.license =
|
8
|
+
spec.name = 'verifalia'
|
9
|
+
spec.version = Verifalia::Client::VERSION
|
10
|
+
spec.authors = ['Verifalia', 'Efran Cobisi', 'Guido Tersilli', 'Rudy Chiappetta', 'Germano Mosconi']
|
11
|
+
spec.email = ['support@verifalia.com']
|
12
|
+
spec.summary = 'Verifalia - Ruby SDK and helper library'
|
13
|
+
spec.description = 'Verifalia provides a simple API for validating email addresses and checking whether they are deliverable or not. This library allows to easily integrate with Verifalia and verify email addresses in real-time.'
|
14
|
+
spec.homepage = 'https://verifalia.com/'
|
15
|
+
spec.license = 'MIT'
|
16
|
+
spec.required_ruby_version = '>= 2.6.0'
|
17
|
+
|
18
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
19
|
+
spec.metadata['source_code_uri'] = 'https://github.com/verifalia/verifalia-ruby-sdk.git'
|
15
20
|
|
16
|
-
|
17
|
-
|
18
|
-
spec.
|
19
|
-
|
21
|
+
# Specify which files should be added to the gem when it is released.
|
22
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
23
|
+
spec.files = Dir.chdir(__dir__) do
|
24
|
+
`git ls-files -z`.split("\x0").reject do |f|
|
25
|
+
(File.expand_path(f) == __FILE__) || f.start_with?(*%w[bin/ test/ spec/ features/ .git .circleci appveyor])
|
26
|
+
end
|
27
|
+
end
|
28
|
+
spec.bindir = 'exe'
|
29
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
30
|
+
spec.require_paths = ['lib']
|
20
31
|
|
21
32
|
spec.extra_rdoc_files = ['README.md']
|
22
|
-
spec.rdoc_options = ['--line-numbers', '--inline-source', '--title', '--main', 'README.md']
|
23
33
|
|
24
|
-
spec.add_dependency('
|
25
|
-
spec.add_dependency('rest-client', '> 1.8.0')
|
34
|
+
spec.add_dependency('faraday', '~> 2.7')
|
26
35
|
|
27
|
-
spec.add_development_dependency
|
28
|
-
spec.add_development_dependency
|
36
|
+
spec.add_development_dependency 'bundler', '~> 2.4.8'
|
37
|
+
spec.add_development_dependency 'rake'
|
29
38
|
end
|
metadata
CHANGED
@@ -1,57 +1,47 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: verifalia
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Verifalia
|
8
|
+
- Efran Cobisi
|
9
|
+
- Guido Tersilli
|
10
|
+
- Rudy Chiappetta
|
11
|
+
- Germano Mosconi
|
8
12
|
autorequire:
|
9
|
-
bindir:
|
13
|
+
bindir: exe
|
10
14
|
cert_chain: []
|
11
|
-
date:
|
15
|
+
date: 2023-03-12 00:00:00.000000000 Z
|
12
16
|
dependencies:
|
13
17
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
18
|
+
name: faraday
|
15
19
|
requirement: !ruby/object:Gem::Requirement
|
16
20
|
requirements:
|
17
|
-
- - "
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: 2.1.2
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: 2.1.2
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: rest-client
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">"
|
21
|
+
- - "~>"
|
32
22
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
23
|
+
version: '2.7'
|
34
24
|
type: :runtime
|
35
25
|
prerelease: false
|
36
26
|
version_requirements: !ruby/object:Gem::Requirement
|
37
27
|
requirements:
|
38
|
-
- - "
|
28
|
+
- - "~>"
|
39
29
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
30
|
+
version: '2.7'
|
41
31
|
- !ruby/object:Gem::Dependency
|
42
32
|
name: bundler
|
43
33
|
requirement: !ruby/object:Gem::Requirement
|
44
34
|
requirements:
|
45
35
|
- - "~>"
|
46
36
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
37
|
+
version: 2.4.8
|
48
38
|
type: :development
|
49
39
|
prerelease: false
|
50
40
|
version_requirements: !ruby/object:Gem::Requirement
|
51
41
|
requirements:
|
52
42
|
- - "~>"
|
53
43
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
44
|
+
version: 2.4.8
|
55
45
|
- !ruby/object:Gem::Dependency
|
56
46
|
name: rake
|
57
47
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,8 +56,9 @@ dependencies:
|
|
66
56
|
- - ">="
|
67
57
|
- !ruby/object:Gem::Version
|
68
58
|
version: '0'
|
69
|
-
description:
|
70
|
-
|
59
|
+
description: Verifalia provides a simple API for validating email addresses and checking
|
60
|
+
whether they are deliverable or not. This library allows to easily integrate with
|
61
|
+
Verifalia and verify email addresses in real-time.
|
71
62
|
email:
|
72
63
|
- support@verifalia.com
|
73
64
|
executables: []
|
@@ -75,54 +66,65 @@ extensions: []
|
|
75
66
|
extra_rdoc_files:
|
76
67
|
- README.md
|
77
68
|
files:
|
78
|
-
- ".gitignore"
|
79
69
|
- Gemfile
|
80
70
|
- LICENSE
|
81
71
|
- README.md
|
82
72
|
- Rakefile
|
83
|
-
- lib/rest/client.rb
|
84
|
-
- lib/rest/email_validations.rb
|
85
73
|
- lib/verifalia.rb
|
86
|
-
- lib/verifalia/
|
87
|
-
- lib/verifalia/
|
88
|
-
-
|
89
|
-
-
|
90
|
-
-
|
91
|
-
-
|
92
|
-
-
|
74
|
+
- lib/verifalia/client.rb
|
75
|
+
- lib/verifalia/credits/balance.rb
|
76
|
+
- lib/verifalia/credits/client.rb
|
77
|
+
- lib/verifalia/email_validation/client.rb
|
78
|
+
- lib/verifalia/email_validation/completion_callback.rb
|
79
|
+
- lib/verifalia/email_validation/entry.rb
|
80
|
+
- lib/verifalia/email_validation/job.rb
|
81
|
+
- lib/verifalia/email_validation/overview.rb
|
82
|
+
- lib/verifalia/email_validation/progress.rb
|
83
|
+
- lib/verifalia/email_validation/request.rb
|
84
|
+
- lib/verifalia/email_validation/request_entry.rb
|
85
|
+
- lib/verifalia/email_validation/wait_options.rb
|
86
|
+
- lib/verifalia/rest/client.rb
|
87
|
+
- lib/verifalia/security/certificate_authenticator.rb
|
88
|
+
- lib/verifalia/security/username_password_authenticator.rb
|
89
|
+
- sig/completion_callback.rbs
|
90
|
+
- sig/verifalia/client.rbs
|
91
|
+
- sig/verifalia/credits/balance.rbs
|
92
|
+
- sig/verifalia/credits/client.rbs
|
93
|
+
- sig/verifalia/email_validations/client.rbs
|
94
|
+
- sig/verifalia/email_validations/entry.rbs
|
95
|
+
- sig/verifalia/email_validations/job.rbs
|
96
|
+
- sig/verifalia/email_validations/overview.rbs
|
97
|
+
- sig/verifalia/email_validations/progress.rbs
|
98
|
+
- sig/verifalia/email_validations/request.rbs
|
99
|
+
- sig/verifalia/email_validations/request_entry.rbs
|
100
|
+
- sig/verifalia/email_validations/wait_options.rbs
|
101
|
+
- sig/verifalia/rest.rbs
|
102
|
+
- sig/verifalia/rest/client.rbs
|
103
|
+
- sig/verifalia/security/username_password_authenticator.rbs
|
93
104
|
- verifalia.gemspec
|
94
|
-
homepage:
|
105
|
+
homepage: https://verifalia.com/
|
95
106
|
licenses:
|
96
107
|
- MIT
|
97
|
-
metadata:
|
108
|
+
metadata:
|
109
|
+
homepage_uri: https://verifalia.com/
|
110
|
+
source_code_uri: https://github.com/verifalia/verifalia-ruby-sdk.git
|
98
111
|
post_install_message:
|
99
|
-
rdoc_options:
|
100
|
-
- "--line-numbers"
|
101
|
-
- "--inline-source"
|
102
|
-
- "--title"
|
103
|
-
- "--main"
|
104
|
-
- README.md
|
112
|
+
rdoc_options: []
|
105
113
|
require_paths:
|
106
114
|
- lib
|
107
115
|
required_ruby_version: !ruby/object:Gem::Requirement
|
108
116
|
requirements:
|
109
117
|
- - ">="
|
110
118
|
- !ruby/object:Gem::Version
|
111
|
-
version:
|
119
|
+
version: 2.6.0
|
112
120
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
113
121
|
requirements:
|
114
122
|
- - ">="
|
115
123
|
- !ruby/object:Gem::Version
|
116
124
|
version: '0'
|
117
125
|
requirements: []
|
118
|
-
|
119
|
-
rubygems_version: 2.4.8
|
126
|
+
rubygems_version: 3.3.5
|
120
127
|
signing_key:
|
121
128
|
specification_version: 4
|
122
|
-
summary: Verifalia
|
123
|
-
test_files:
|
124
|
-
- spec/rest/client_spec.rb
|
125
|
-
- spec/rest/email_validations_spec.rb
|
126
|
-
- spec/spec_helper.rb
|
127
|
-
- spec/util/configuration_spec.rb
|
128
|
-
- spec/verifalia_spec.rb
|
129
|
+
summary: Verifalia - Ruby SDK and helper library
|
130
|
+
test_files: []
|
data/.gitignore
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
*.gem
|
2
|
-
*.rbc
|
3
|
-
.bundle
|
4
|
-
.config
|
5
|
-
.yardoc
|
6
|
-
Gemfile.lock
|
7
|
-
InstalledFiles
|
8
|
-
_yardoc
|
9
|
-
coverage
|
10
|
-
doc/
|
11
|
-
lib/bundler/man
|
12
|
-
pkg
|
13
|
-
rdoc
|
14
|
-
spec/reports
|
15
|
-
test/tmp
|
16
|
-
test/version_tmp
|
17
|
-
tmp
|
18
|
-
*.bundle
|
19
|
-
*.so
|
20
|
-
*.o
|
21
|
-
*.a
|
22
|
-
mkmf.log
|
23
|
-
.rvmrc
|
data/lib/rest/client.rb
DELETED
@@ -1,75 +0,0 @@
|
|
1
|
-
require 'rest/email_validations'
|
2
|
-
|
3
|
-
module Verifalia
|
4
|
-
module REST
|
5
|
-
##
|
6
|
-
# The Verifalia::REST::Client class caches authentication parameters and
|
7
|
-
# exposes methods to make HTTP requests to Verifalia's REST API. However, you
|
8
|
-
# should never really need to call these methods yourself since you can
|
9
|
-
# work with the more pleasant wrapper objects like Verifalia::REST::EmailValidations
|
10
|
-
#
|
11
|
-
# Instantiate a client like so:
|
12
|
-
#
|
13
|
-
# @client = Verifalia::REST::Client.new account_sid, auth_token
|
14
|
-
#
|
15
|
-
|
16
|
-
# Once you have a client object you can use it to do fun things. Every
|
17
|
-
# client object exposes a wrapper for a specific API. For example:
|
18
|
-
#
|
19
|
-
# ==== @client.email_validations
|
20
|
-
#
|
21
|
-
class Client
|
22
|
-
|
23
|
-
attr_reader :account_sid, :account_token
|
24
|
-
|
25
|
-
API_VERSION = 'v1.4'
|
26
|
-
|
27
|
-
DEFAULTS = {
|
28
|
-
host: 'https://api.verifalia.com',
|
29
|
-
api_version: 'v1.4'
|
30
|
-
}
|
31
|
-
|
32
|
-
##
|
33
|
-
# Instantiate a new HTTP client to talk to Verifalia. The parameters
|
34
|
-
# +account_sid+ and +auth_token+ are required, unless you have configured
|
35
|
-
# them already using the block configure syntax, and used to generate the
|
36
|
-
# HTTP basic auth header in each request. The +args+ parameter is a
|
37
|
-
# hash of connection configuration options. the following keys are
|
38
|
-
# supported:
|
39
|
-
#
|
40
|
-
# === <tt>host: 'https://api.verifalia.com'</tt>
|
41
|
-
#
|
42
|
-
# === <tt>api_version: 'v1.1'</tt>
|
43
|
-
#
|
44
|
-
def initialize(*args)
|
45
|
-
options = args.last.is_a?(Hash) ? args.pop : {}
|
46
|
-
@config = DEFAULTS.merge! options
|
47
|
-
@account_sid = args[0] || Verifalia.account_sid
|
48
|
-
@auth_token = args[1] || Verifalia.auth_token
|
49
|
-
|
50
|
-
if @account_sid.nil? || @auth_token.nil?
|
51
|
-
raise ArgumentError, 'Account SID and auth token are required'
|
52
|
-
end
|
53
|
-
|
54
|
-
end
|
55
|
-
|
56
|
-
##
|
57
|
-
# Instantiate a new HTTP client to talk to Verifalia Email Validation Api.
|
58
|
-
# The +args+ parameter is a hash of configuration
|
59
|
-
# The following keys are supported:
|
60
|
-
#
|
61
|
-
# === <tt>unique_id: 'example-example'</tt>
|
62
|
-
#
|
63
|
-
# The unique if of the Verifalia Email Validation resource
|
64
|
-
#
|
65
|
-
def email_validations(args = {})
|
66
|
-
if (args.empty?)
|
67
|
-
@email_validations ||= EmailValidations.new @config, @account_sid, @auth_token
|
68
|
-
else
|
69
|
-
EmailValidations.new @config, @account_sid, @auth_token, args
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|