verifalia 1.2.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 +328 -82
- 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 -57
- data/.gitignore +0 -24
- data/lib/rest/account_balance.rb +0 -93
- data/lib/rest/client.rb +0 -83
- data/lib/rest/email_validations.rb +0 -195
- data/lib/verifalia/util/configuration.rb +0 -7
- data/lib/verifalia/version.rb +0 -3
- data/spec/rest/account_balance_spec.rb +0 -93
- data/spec/rest/client_spec.rb +0 -105
- data/spec/rest/email_validations_spec.rb +0 -322
- data/spec/spec_helper.rb +0 -21
- data/spec/util/configuration_spec.rb +0 -15
- data/spec/verifalia_spec.rb +0 -17
data/lib/rest/client.rb
DELETED
@@ -1,83 +0,0 @@
|
|
1
|
-
require 'rest/email_validations'
|
2
|
-
require 'rest/account_balance'
|
3
|
-
|
4
|
-
module Verifalia
|
5
|
-
module REST
|
6
|
-
##
|
7
|
-
# The Verifalia::REST::Client class caches authentication parameters and
|
8
|
-
# exposes methods to make HTTP requests to Verifalia's REST API. However, you
|
9
|
-
# should never really need to call these methods yourself since you can
|
10
|
-
# work with the more pleasant wrapper objects like Verifalia::REST::EmailValidations
|
11
|
-
#
|
12
|
-
# Instantiate a client like so:
|
13
|
-
#
|
14
|
-
# @client = Verifalia::REST::Client.new account_sid, auth_token
|
15
|
-
#
|
16
|
-
|
17
|
-
# Once you have a client object you can use it to do fun things. Every
|
18
|
-
# client object exposes a wrapper for a specific API. For example:
|
19
|
-
#
|
20
|
-
# ==== @client.email_validations
|
21
|
-
#
|
22
|
-
class Client
|
23
|
-
|
24
|
-
attr_reader :account_sid, :account_token
|
25
|
-
|
26
|
-
API_VERSION = 'v1.4'
|
27
|
-
|
28
|
-
DEFAULTS = {
|
29
|
-
hosts: ['https://api-1.verifalia.com', 'https://api-2.verifalia.com'],
|
30
|
-
api_version: 'v1.4'
|
31
|
-
}
|
32
|
-
|
33
|
-
##
|
34
|
-
# Instantiate a new HTTP client to talk to Verifalia. The parameters
|
35
|
-
# +account_sid+ and +auth_token+ are required, unless you have configured
|
36
|
-
# them already using the block configure syntax, and used to generate the
|
37
|
-
# HTTP basic auth header in each request. The +args+ parameter is a
|
38
|
-
# hash of connection configuration options. the following keys are
|
39
|
-
# supported:
|
40
|
-
#
|
41
|
-
# === <tt>host: 'https://api.verifalia.com'</tt>
|
42
|
-
#
|
43
|
-
# === <tt>api_version: 'v1.1'</tt>
|
44
|
-
#
|
45
|
-
def initialize(*args)
|
46
|
-
options = args.last.is_a?(Hash) ? args.pop : {}
|
47
|
-
@config = DEFAULTS.merge! options
|
48
|
-
@account_sid = args[0] || Verifalia.account_sid
|
49
|
-
@auth_token = args[1] || Verifalia.auth_token
|
50
|
-
|
51
|
-
if @account_sid.nil? || @auth_token.nil?
|
52
|
-
raise ArgumentError, 'Account SID and auth token are required'
|
53
|
-
end
|
54
|
-
|
55
|
-
end
|
56
|
-
|
57
|
-
##
|
58
|
-
# Instantiate a new HTTP client to talk to Verifalia Email Validation Api.
|
59
|
-
# The +args+ parameter is a hash of configuration
|
60
|
-
# The following keys are supported:
|
61
|
-
#
|
62
|
-
# === <tt>unique_id: 'example-example'</tt>
|
63
|
-
#
|
64
|
-
# The unique if of the Verifalia Email Validation resource
|
65
|
-
#
|
66
|
-
def email_validations(args = {})
|
67
|
-
if (args.empty?)
|
68
|
-
@email_validations ||= EmailValidations.new @config, @account_sid, @auth_token
|
69
|
-
else
|
70
|
-
EmailValidations.new @config, @account_sid, @auth_token, args
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
##
|
75
|
-
# Instantiate a new HTTP client to talk to Verifalia Account Balance Api.
|
76
|
-
#
|
77
|
-
def account_balance()
|
78
|
-
@account_balance ||= AccountBalance.new @config, @account_sid, @auth_token
|
79
|
-
end
|
80
|
-
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|
@@ -1,195 +0,0 @@
|
|
1
|
-
require 'rest_client'
|
2
|
-
require 'json'
|
3
|
-
module Verifalia
|
4
|
-
module REST
|
5
|
-
class EmailValidations
|
6
|
-
|
7
|
-
COMPLETION_MAX_RETRY = 5
|
8
|
-
COMPLETION_INTERVAL = 1
|
9
|
-
##
|
10
|
-
# The Verifalia::REST::EmailValidations class allow you to comminucate
|
11
|
-
# with Email Validations Api. You don't need to instantiate this class, but
|
12
|
-
# use the client for autoconfiguration. # The +args+ parameter is a hash of configuration
|
13
|
-
# The following keys are supported:
|
14
|
-
#
|
15
|
-
# === <tt>unique_id: 'example-example'</tt>
|
16
|
-
#
|
17
|
-
# The unique if of the Verifalia Email Validation resource
|
18
|
-
#
|
19
|
-
def initialize(config, account_sid, account_token, args = {})
|
20
|
-
@resources = build_resources(config, account_sid, account_token)
|
21
|
-
@unique_id = args[:unique_id] if args[:unique_id]
|
22
|
-
end
|
23
|
-
|
24
|
-
##
|
25
|
-
# Query the Email Validations Api with:
|
26
|
-
#
|
27
|
-
# === <tt> inputs: ['test@test.com']
|
28
|
-
# === <tt> inputs: data = [{ inputData: 'first@first.it' }, { inputData: 'first@first.it' } ]
|
29
|
-
# === <tt> options: { quality: 'high', priority: 100, deduplication: 'safe' } view verifalia API documentation
|
30
|
-
#
|
31
|
-
# An array of emails to validate
|
32
|
-
#
|
33
|
-
def verify(inputs, options = {})
|
34
|
-
raise ArgumentError, 'inputs must be not empty' if (inputs.nil? || inputs.empty?)
|
35
|
-
raise ArgumentError, 'options must be hash' if (!options.is_a?(Hash))
|
36
|
-
data = inputs.map do |input|
|
37
|
-
if (input.is_a? String)
|
38
|
-
{ inputData: input }
|
39
|
-
elsif (input.is_a? Hash)
|
40
|
-
raise ArgumentError, 'if inputs content is a Hash you need to supply :inputData as key' if (!input.has_key?(:inputData))
|
41
|
-
input
|
42
|
-
else
|
43
|
-
raise ArgumentError, 'inputs content must be a String or a Hash'
|
44
|
-
end
|
45
|
-
end
|
46
|
-
content = ({ entries: data }.merge(options)).to_json
|
47
|
-
begin
|
48
|
-
@response = multiplex_request do |resource|
|
49
|
-
resource.post content
|
50
|
-
end
|
51
|
-
@query_result = JSON.parse(@response)
|
52
|
-
@unique_id = @query_result["uniqueID"]
|
53
|
-
@error = nil
|
54
|
-
@unique_id
|
55
|
-
rescue => e
|
56
|
-
compute_error(e)
|
57
|
-
false
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
##
|
62
|
-
# Query the Email Validations Api for specific result. In order to use
|
63
|
-
# this method you need to supply unique_id uring initialization or call verify first. If request fail,
|
64
|
-
# you can call <tt>error</tt> to receive detailed information
|
65
|
-
#
|
66
|
-
# === <tt> options: { wait_for_completion: true, completion_max_retry: 5, completion_interval: 1(seconds) }
|
67
|
-
def query(options = {})
|
68
|
-
raise ArgumentError, 'You must call verify first or supply and uniqueId' unless @unique_id
|
69
|
-
opts = {
|
70
|
-
wait_for_completion: false,
|
71
|
-
completion_max_retry: COMPLETION_MAX_RETRY,
|
72
|
-
completion_interval: COMPLETION_INTERVAL,
|
73
|
-
}
|
74
|
-
.merge! options
|
75
|
-
if @query_result == nil || !completed?
|
76
|
-
begin
|
77
|
-
loop_count = 0
|
78
|
-
loop do
|
79
|
-
@response = multiplex_request do |resource|
|
80
|
-
resource[@unique_id].get
|
81
|
-
end
|
82
|
-
@query_result = JSON.parse(@response)
|
83
|
-
@error = nil
|
84
|
-
loop_count += 1
|
85
|
-
sleep opts[:completion_interval] if opts[:wait_for_completion]
|
86
|
-
break if !opts[:wait_for_completion] || (completed? || loop_count >= opts[:completion_max_retry])
|
87
|
-
end
|
88
|
-
rescue => e
|
89
|
-
compute_error(e)
|
90
|
-
return false
|
91
|
-
end
|
92
|
-
end
|
93
|
-
if (opts[:wait_for_completion] && !completed?)
|
94
|
-
@error = :not_completed
|
95
|
-
false
|
96
|
-
else
|
97
|
-
@query_result
|
98
|
-
end
|
99
|
-
end
|
100
|
-
|
101
|
-
##
|
102
|
-
# Destroy an Email Validations entity. In order to use
|
103
|
-
# this method you need to supply unique_id during initialization or call verify first. If request fail,
|
104
|
-
# you can call <tt>error</tt> to receive detailed information
|
105
|
-
#
|
106
|
-
def destroy
|
107
|
-
raise ArgumentError, 'You must call verify first or supply and uniqueId' unless @unique_id
|
108
|
-
begin
|
109
|
-
r = multiplex_request do |resource|
|
110
|
-
resource[@unique_id].delete
|
111
|
-
end
|
112
|
-
@error = nil
|
113
|
-
@response = nil
|
114
|
-
@query_result = nil
|
115
|
-
@unique_id = nil
|
116
|
-
true
|
117
|
-
rescue => e
|
118
|
-
return true if (e.is_a? RestClient::Exception && e.http_code == 410)
|
119
|
-
compute_error(e)
|
120
|
-
return false
|
121
|
-
end
|
122
|
-
end
|
123
|
-
|
124
|
-
##
|
125
|
-
# Check if the Email validation entity is completed processed. In order to use
|
126
|
-
# this method you need to supply unique_id during initialization or call verify first.
|
127
|
-
#
|
128
|
-
def completed?
|
129
|
-
@response.code == 200
|
130
|
-
end
|
131
|
-
|
132
|
-
def error
|
133
|
-
@error
|
134
|
-
end
|
135
|
-
|
136
|
-
private
|
137
|
-
|
138
|
-
def multiplex_request
|
139
|
-
@resources.shuffle.each do |resource|
|
140
|
-
begin
|
141
|
-
response = yield(resource)
|
142
|
-
return response
|
143
|
-
rescue => e
|
144
|
-
if ((e.is_a? RestClient::Exception) && (e.http_code != 500))
|
145
|
-
raise e
|
146
|
-
end
|
147
|
-
end
|
148
|
-
end
|
149
|
-
raise RestClient::Exception.new(nil, 500)
|
150
|
-
end
|
151
|
-
|
152
|
-
def compute_error(e)
|
153
|
-
unless e.is_a? RestClient::Exception
|
154
|
-
@error = :internal_server_error
|
155
|
-
end
|
156
|
-
|
157
|
-
case e.http_code
|
158
|
-
when 400
|
159
|
-
@error = :bad_request
|
160
|
-
when 401
|
161
|
-
@error = :unauthorized
|
162
|
-
when 402
|
163
|
-
@error = :payment_required
|
164
|
-
when 403
|
165
|
-
@error = :forbidden
|
166
|
-
when 404
|
167
|
-
@error = :not_found
|
168
|
-
when 406
|
169
|
-
@error = :not_acceptable
|
170
|
-
when 410
|
171
|
-
@error = :gone
|
172
|
-
when 429
|
173
|
-
@error = :too_many_request
|
174
|
-
else
|
175
|
-
@error = :internal_server_error
|
176
|
-
end
|
177
|
-
end
|
178
|
-
|
179
|
-
def build_resources(config, account_sid, account_token)
|
180
|
-
opts = {
|
181
|
-
user: account_sid,
|
182
|
-
password: account_token,
|
183
|
-
headers: {
|
184
|
-
content_type: :json,
|
185
|
-
user_agent: "verifalia-rest-client/ruby/#{Verifalia::VERSION}"
|
186
|
-
}
|
187
|
-
}
|
188
|
-
config[:hosts].map do |host|
|
189
|
-
api_url = "#{host}/#{config[:api_version]}/email-validations"
|
190
|
-
RestClient::Resource.new api_url, opts
|
191
|
-
end
|
192
|
-
end
|
193
|
-
end
|
194
|
-
end
|
195
|
-
end
|
data/lib/verifalia/version.rb
DELETED
@@ -1,93 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Verifalia::REST::AccountBalance do
|
4
|
-
let(:config) { { hosts: ["https://api.fake.com", "https://api-2.fake.com"], api_version: "v" } }
|
5
|
-
|
6
|
-
describe '#initialize' do
|
7
|
-
|
8
|
-
it 'create RestClient::Resource with correct parameters' do
|
9
|
-
opts = {
|
10
|
-
user: 'someSid',
|
11
|
-
password: 'someToken',
|
12
|
-
headers: { content_type: :json, user_agent: "verifalia-rest-client/ruby/#{Verifalia::VERSION}" }
|
13
|
-
}
|
14
|
-
config[:hosts].each do |host|
|
15
|
-
api_url = "#{host}/#{config[:api_version]}/account-balance"
|
16
|
-
expect(RestClient::Resource).to receive(:new).with(api_url, opts)
|
17
|
-
end
|
18
|
-
Verifalia::REST::AccountBalance.new(config, 'someSid', 'someToken')
|
19
|
-
end
|
20
|
-
|
21
|
-
it 'associate RestClient::Resource to @resources' do
|
22
|
-
resource = double()
|
23
|
-
allow(RestClient::Resource).to receive(:new).and_return(resource)
|
24
|
-
account_balance = Verifalia::REST::AccountBalance.new(config, 'someSid', 'someToken')
|
25
|
-
expect(account_balance.instance_variable_get('@resources')).to include(resource)
|
26
|
-
expect(account_balance.instance_variable_get('@resources').size).to eq(config[:hosts].size)
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
context 'initialized' do
|
31
|
-
let(:resources) { [ double().as_null_object, double().as_null_object ] }
|
32
|
-
let(:response) { double().as_null_object }
|
33
|
-
let(:response_json) { double().as_null_object }
|
34
|
-
|
35
|
-
before(:each) do
|
36
|
-
@account_balance = Verifalia::REST::AccountBalance.new(config, 'someSid', 'someToken')
|
37
|
-
@account_balance.instance_variable_set('@resources', resources)
|
38
|
-
end
|
39
|
-
|
40
|
-
describe '#balance' do
|
41
|
-
|
42
|
-
context 'without errors' do
|
43
|
-
it 'call #get on @resources' do
|
44
|
-
resources.each { |resource| allow(resource).to receive(:get).and_return(response) }
|
45
|
-
expect(JSON).to receive(:parse).with(response).and_return(response_json)
|
46
|
-
@account_balance.balance
|
47
|
-
end
|
48
|
-
|
49
|
-
it 'return parsed json' do
|
50
|
-
parsed = double()
|
51
|
-
resources.each { |resource| allow(resource).to receive(:get).and_return(response) }
|
52
|
-
expect(JSON).to receive(:parse).and_return(parsed)
|
53
|
-
result = @account_balance.balance
|
54
|
-
expect(result).to eq(parsed)
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
context 'request failed' do
|
59
|
-
|
60
|
-
before(:each) do
|
61
|
-
resources.each { |resource| allow(resource).to receive(:get).and_raise(RestClient::Exception.new(nil, 402))}
|
62
|
-
end
|
63
|
-
|
64
|
-
it 'raise exception, call #compute_error and return false' do
|
65
|
-
result = @account_balance.balance
|
66
|
-
expect(result).to eq(false)
|
67
|
-
end
|
68
|
-
|
69
|
-
it 'raise exception, call #compute_error and return correct error' do
|
70
|
-
result = @account_balance.balance
|
71
|
-
expect(result).to eq(false)
|
72
|
-
expect(@account_balance.error).to eq(:payment_required)
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
context 'with one request failed with 500' do
|
77
|
-
before(:each) do
|
78
|
-
expect(resources).to receive(:shuffle).and_return([resources[0], resources[1]])
|
79
|
-
expect(resources[0]).to receive(:get).and_raise(RestClient::Exception.new(nil, 500))
|
80
|
-
expect(resources[1]).to receive(:get).and_return(response)
|
81
|
-
end
|
82
|
-
|
83
|
-
it 'return parsed json' do
|
84
|
-
parsed = double()
|
85
|
-
expect(JSON).to receive(:parse).and_return(parsed)
|
86
|
-
result = @account_balance.balance
|
87
|
-
expect(result).to eq(parsed)
|
88
|
-
end
|
89
|
-
end
|
90
|
-
end
|
91
|
-
end
|
92
|
-
|
93
|
-
end
|
data/spec/rest/client_spec.rb
DELETED
@@ -1,105 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Verifalia::REST::Client do
|
4
|
-
describe 'config at class level' do
|
5
|
-
after(:each) do
|
6
|
-
Verifalia.instance_variable_set('@configuration', nil)
|
7
|
-
end
|
8
|
-
|
9
|
-
it 'should set the account sid and auth token with a config block' do
|
10
|
-
Verifalia.configure do |config|
|
11
|
-
config.account_sid = 'someSid'
|
12
|
-
config.auth_token = 'someToken'
|
13
|
-
end
|
14
|
-
|
15
|
-
client = Verifalia::REST::Client.new
|
16
|
-
expect(client.account_sid).to eq('someSid')
|
17
|
-
expect(client.instance_variable_get('@auth_token')).to eq('someToken')
|
18
|
-
end
|
19
|
-
|
20
|
-
it 'should overwrite account sid and auth token if passed to initializer' do
|
21
|
-
Verifalia.configure do |config|
|
22
|
-
config.account_sid = 'someSid'
|
23
|
-
config.auth_token = 'someToken'
|
24
|
-
end
|
25
|
-
|
26
|
-
client = Verifalia::REST::Client.new 'otherSid', 'otherToken'
|
27
|
-
expect(client.account_sid).to eq('otherSid')
|
28
|
-
expect(client.instance_variable_get('@auth_token')).to eq('otherToken')
|
29
|
-
end
|
30
|
-
|
31
|
-
it 'should overwrite the account sid if only the sid is given' do
|
32
|
-
Verifalia.configure do |config|
|
33
|
-
config.account_sid = 'someSid'
|
34
|
-
config.auth_token = 'someToken'
|
35
|
-
end
|
36
|
-
|
37
|
-
client = Verifalia::REST::Client.new 'otherSid'
|
38
|
-
expect(client.account_sid).to eq('otherSid')
|
39
|
-
expect(client.instance_variable_get('@auth_token')).to eq('someToken')
|
40
|
-
end
|
41
|
-
|
42
|
-
it 'should allow options after setting up auth with config' do
|
43
|
-
Verifalia.configure do |config|
|
44
|
-
config.account_sid = 'someSid'
|
45
|
-
config.auth_token = 'someToken'
|
46
|
-
end
|
47
|
-
|
48
|
-
client = Verifalia::REST::Client.new :hosts => ['api.fake.com']
|
49
|
-
|
50
|
-
config = client.instance_variable_get('@config')
|
51
|
-
expect(config[:hosts]).to eq(['api.fake.com'])
|
52
|
-
end
|
53
|
-
|
54
|
-
it 'should throw an argument error if the sid and token isn\'t set' do
|
55
|
-
expect { Verifalia::REST::Client.new }.to raise_error(ArgumentError)
|
56
|
-
end
|
57
|
-
|
58
|
-
it 'should throw an argument error if only the account_sid is set' do
|
59
|
-
expect { Verifalia::REST::Client.new 'someSid' }.to raise_error(ArgumentError)
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
describe '#email_validations' do
|
64
|
-
before(:each) do
|
65
|
-
Verifalia.configure do |config|
|
66
|
-
config.account_sid = 'someSid'
|
67
|
-
config.auth_token = 'someToken'
|
68
|
-
end
|
69
|
-
@client = Verifalia::REST::Client.new
|
70
|
-
end
|
71
|
-
|
72
|
-
context 'without parameters' do
|
73
|
-
it 'call #new on Verifalia::REST::EmailValidations with correct paramenters' do
|
74
|
-
config = @client.instance_variable_get('@config')
|
75
|
-
expect(Verifalia::REST::EmailValidations).to receive(:new).with(config, 'someSid', 'someToken')
|
76
|
-
@client.email_validations
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
context 'with parameter' do
|
81
|
-
it 'call #new on Verifalia::REST::EmailValidations with correct paramenters' do
|
82
|
-
config = @client.instance_variable_get('@config')
|
83
|
-
expect(Verifalia::REST::EmailValidations).to receive(:new).with(config, 'someSid', 'someToken', :unique_id => 'fake')
|
84
|
-
@client.email_validations(:unique_id => 'fake')
|
85
|
-
end
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
|
90
|
-
describe '#account_balance' do
|
91
|
-
before(:each) do
|
92
|
-
Verifalia.configure do |config|
|
93
|
-
config.account_sid = 'someSid'
|
94
|
-
config.auth_token = 'someToken'
|
95
|
-
end
|
96
|
-
@client = Verifalia::REST::Client.new
|
97
|
-
end
|
98
|
-
|
99
|
-
it 'call #new on Verifalia::REST::AccountBalance with correct paramenters' do
|
100
|
-
config = @client.instance_variable_get('@config')
|
101
|
-
expect(Verifalia::REST::AccountBalance).to receive(:new).with(config, 'someSid', 'someToken')
|
102
|
-
@client.account_balance
|
103
|
-
end
|
104
|
-
end
|
105
|
-
end
|