baruwa 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/Gemfile +1 -0
- data/README.md +4 -4
- data/baruwa.gemspec +1 -1
- data/lib/baruwa.rb +61 -21
- data/lib/baruwa/version.rb +1 -1
- data/spec/baruwa_authservers_spec.rb +13 -0
- data/spec/baruwa_deliveryservers_spec.rb +13 -0
- data/spec/baruwa_domainalias_spec.rb +13 -0
- data/spec/baruwa_domains_spec.rb +12 -0
- data/spec/baruwa_fallbackservers_spec.rb +13 -0
- data/spec/baruwa_organizations_spec.rb +12 -0
- data/spec/baruwa_orgsmarthosts_spec.rb +13 -0
- data/spec/baruwa_smarthosts_spec.rb +13 -0
- data/spec/{baruwa_user_deliveryservers.rb → baruwa_user_deliveryservers_spec.rb} +13 -0
- data/spec/baruwa_users_spec.rb +12 -0
- metadata +5 -6
- data/.codeclimate.yml +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 98a49c3c355263fa0b34c06735cf84cacab2177d87cba109096e4e2ed2e42d18
|
4
|
+
data.tar.gz: bbbe3376f70e9503519f865c153f39903f85d3726445c68ca5e14634b801f2d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e7169056fba40e26ab2f04a4c9107c4d31064762a601ed5dd4cca730362ad2f84affd7b0fcbc8fcc4498412be9db24b6f770e659c48bcd9310bf1654e041c4ef
|
7
|
+
data.tar.gz: f5a65a3aff8ca33291c20c101aa518bc6af27caf2cc82d28584611e36da04b6156c5d3c41701ca3e85505d15832f16dedde6689c81a7fbbf57728f10389d201e
|
data/.gitignore
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
This gem provides bindings for the [Baruwa](https://www.baruwa.com/) [REST API](https://www.baruwa.com/docs/api/)
|
4
4
|
|
5
|
-
[![Build Status](https://travis-ci.org/
|
6
|
-
[![codecov](https://codecov.io/gh/
|
5
|
+
[![Build Status](https://travis-ci.org/baruwa-enterprise/baruwa-ruby.svg?branch=master)](https://travis-ci.org/baruwa-enterprise/baruwa-ruby)
|
6
|
+
[![codecov](https://codecov.io/gh/baruwa-enterprise/baruwa-ruby/branch/master/graph/badge.svg)](https://codecov.io/gh/baruwa-enterprise/baruwa-ruby)
|
7
7
|
[![Gem Version](https://badge.fury.io/rb/baruwa.svg)](https://badge.fury.io/rb/baruwa)
|
8
8
|
[![MPLv2 License](https://img.shields.io/badge/license-MPLv2-blue.svg?style=flat-square)](https://www.mozilla.org/MPL/2.0/)
|
9
9
|
|
@@ -25,7 +25,7 @@ Or install it yourself as:
|
|
25
25
|
|
26
26
|
## Contributing
|
27
27
|
|
28
|
-
1. Fork it (https://github.com/
|
28
|
+
1. Fork it (https://github.com/baruwa-enterprise/baruwa-ruby/fork)
|
29
29
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
30
30
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
31
31
|
4. Push to the branch (`git push origin my-new-feature`)
|
@@ -35,4 +35,4 @@ Or install it yourself as:
|
|
35
35
|
## License
|
36
36
|
|
37
37
|
All code is licensed under the
|
38
|
-
[MPLv2 License](https://github.com/
|
38
|
+
[MPLv2 License](https://github.com/baruwa-enterprise/baruwa-ruby/blob/master/LICENSE)
|
data/baruwa.gemspec
CHANGED
@@ -14,7 +14,7 @@ Gem::Specification.new do |s|
|
|
14
14
|
s.version = Baruwa::VERSION
|
15
15
|
s.authors = ["Andrew Colin Kissa"]
|
16
16
|
s.email = ["andrew@topdog.za.net"]
|
17
|
-
s.homepage = "https://github.com/
|
17
|
+
s.homepage = "https://github.com/baruwa-enterprise/baruwa-ruby"
|
18
18
|
s.summary = %q{Ruby bindings for the Baruwa REST API}
|
19
19
|
s.description = %q{Gem to access the Baruwa REST API in ruby and ruby on rails applications.}
|
20
20
|
s.license = "MPL-2.0"
|
data/lib/baruwa.rb
CHANGED
@@ -121,9 +121,13 @@ class BaruwaAPI
|
|
121
121
|
@ssl_verify = ssl_verify
|
122
122
|
end
|
123
123
|
|
124
|
-
def get_users
|
124
|
+
def get_users(page=nil)
|
125
125
|
# get users
|
126
|
-
|
126
|
+
params = {}
|
127
|
+
if page.is_a? Integer then
|
128
|
+
params[:page] = page
|
129
|
+
end
|
130
|
+
call_api(ENDPOINTS[:users][:list], [], false, params)
|
127
131
|
end
|
128
132
|
|
129
133
|
def get_user(userid)
|
@@ -171,9 +175,13 @@ class BaruwaAPI
|
|
171
175
|
call_api(ENDPOINTS[:aliases][:delete], [addressid], data)
|
172
176
|
end
|
173
177
|
|
174
|
-
def get_domains
|
178
|
+
def get_domains(page=nil)
|
175
179
|
# get domains
|
176
|
-
|
180
|
+
params = {}
|
181
|
+
if page.is_a? Integer then
|
182
|
+
params[:page] = page
|
183
|
+
end
|
184
|
+
call_api(ENDPOINTS[:domains][:list], [], false, params)
|
177
185
|
end
|
178
186
|
|
179
187
|
def get_domain(domainid)
|
@@ -201,9 +209,13 @@ class BaruwaAPI
|
|
201
209
|
call_api(ENDPOINTS[:domains][:delete], [domainid])
|
202
210
|
end
|
203
211
|
|
204
|
-
def get_domainaliases(domainid)
|
212
|
+
def get_domainaliases(domainid, page=nil)
|
205
213
|
# get domain aliases
|
206
|
-
|
214
|
+
params = {}
|
215
|
+
if page.is_a? Integer then
|
216
|
+
params[:page] = page
|
217
|
+
end
|
218
|
+
call_api(ENDPOINTS[:domainaliases][:list], [domainid], false, params)
|
207
219
|
end
|
208
220
|
|
209
221
|
def get_domainalias(domainid, aliasid)
|
@@ -226,9 +238,13 @@ class BaruwaAPI
|
|
226
238
|
call_api(ENDPOINTS[:domainaliases][:delete], [domainid, aliasid], data)
|
227
239
|
end
|
228
240
|
|
229
|
-
def get_domain_smarthosts(domainid)
|
241
|
+
def get_domain_smarthosts(domainid, page=nil)
|
230
242
|
# get domain smarthosts
|
231
|
-
|
243
|
+
params = {}
|
244
|
+
if page.is_a? Integer then
|
245
|
+
params[:page] = page
|
246
|
+
end
|
247
|
+
call_api(ENDPOINTS[:domainsmarthosts][:list], [domainid], false, params)
|
232
248
|
end
|
233
249
|
|
234
250
|
def get_domain_smarthost(domainid, smarthostid)
|
@@ -251,9 +267,13 @@ class BaruwaAPI
|
|
251
267
|
call_api(ENDPOINTS[:domainsmarthosts][:delete], [domainid, smarthostid], data)
|
252
268
|
end
|
253
269
|
|
254
|
-
def get_deliveryservers(domainid)
|
270
|
+
def get_deliveryservers(domainid, page=nil)
|
255
271
|
# get delivery servers
|
256
|
-
|
272
|
+
params = {}
|
273
|
+
if page.is_a? Integer then
|
274
|
+
params[:page] = page
|
275
|
+
end
|
276
|
+
call_api(ENDPOINTS[:deliveryservers][:list], [domainid], false, params)
|
257
277
|
end
|
258
278
|
|
259
279
|
def get_deliveryserver(domainid, serverid)
|
@@ -276,9 +296,13 @@ class BaruwaAPI
|
|
276
296
|
call_api(ENDPOINTS[:deliveryservers][:delete], [domainid, serverid], data)
|
277
297
|
end
|
278
298
|
|
279
|
-
def get_user_deliveryservers(domainid)
|
299
|
+
def get_user_deliveryservers(domainid, page=nil)
|
280
300
|
# get delivery servers
|
281
|
-
|
301
|
+
params = {}
|
302
|
+
if page.is_a? Integer then
|
303
|
+
params[:page] = page
|
304
|
+
end
|
305
|
+
call_api(ENDPOINTS[:userdeliveryservers][:list], [domainid], false, params)
|
282
306
|
end
|
283
307
|
|
284
308
|
def get_user_deliveryserver(domainid, serverid)
|
@@ -301,9 +325,13 @@ class BaruwaAPI
|
|
301
325
|
call_api(ENDPOINTS[:userdeliveryservers][:delete], [domainid, serverid], data)
|
302
326
|
end
|
303
327
|
|
304
|
-
def get_authservers(domainid)
|
328
|
+
def get_authservers(domainid, page=nil)
|
305
329
|
# get auth servers
|
306
|
-
|
330
|
+
params = {}
|
331
|
+
if page.is_a? Integer then
|
332
|
+
params[:page] = page
|
333
|
+
end
|
334
|
+
call_api(ENDPOINTS[:authservers][:list], [domainid], false, params)
|
307
335
|
end
|
308
336
|
|
309
337
|
def get_authserver(domainid, serverid)
|
@@ -366,9 +394,13 @@ class BaruwaAPI
|
|
366
394
|
call_api(ENDPOINTS[:radiussettings][:delete], [domainid, serverid, settingsid], data)
|
367
395
|
end
|
368
396
|
|
369
|
-
def get_organizations
|
397
|
+
def get_organizations(page=nil)
|
370
398
|
# get organizations
|
371
|
-
|
399
|
+
params = {}
|
400
|
+
if page.is_a? Integer then
|
401
|
+
params[:page] = page
|
402
|
+
end
|
403
|
+
call_api(ENDPOINTS[:organizations][:list], [], false, params)
|
372
404
|
end
|
373
405
|
|
374
406
|
def get_organization(orgid)
|
@@ -411,9 +443,13 @@ class BaruwaAPI
|
|
411
443
|
call_api(ENDPOINTS[:relays][:delete], [relayid], data)
|
412
444
|
end
|
413
445
|
|
414
|
-
def get_fallbackservers(orgid)
|
446
|
+
def get_fallbackservers(orgid, page=nil)
|
415
447
|
# get fallback servers
|
416
|
-
|
448
|
+
params = {}
|
449
|
+
if page.is_a? Integer then
|
450
|
+
params[:page] = page
|
451
|
+
end
|
452
|
+
call_api(ENDPOINTS[:fallbackservers][:list], [orgid], false, params)
|
417
453
|
end
|
418
454
|
|
419
455
|
def get_fallbackserver(serverid)
|
@@ -436,9 +472,13 @@ class BaruwaAPI
|
|
436
472
|
call_api(ENDPOINTS[:fallbackservers][:delete], [serverid], data)
|
437
473
|
end
|
438
474
|
|
439
|
-
def get_org_smarthosts(orgid)
|
475
|
+
def get_org_smarthosts(orgid, page=nil)
|
440
476
|
# get organization smarthosts
|
441
|
-
|
477
|
+
params = {}
|
478
|
+
if page.is_a? Integer then
|
479
|
+
params[:page] = page
|
480
|
+
end
|
481
|
+
call_api(ENDPOINTS[:orgsmarthosts][:list], [orgid], false, params)
|
442
482
|
end
|
443
483
|
|
444
484
|
def get_org_smarthost(orgid, smarthostid)
|
@@ -482,7 +522,7 @@ class BaruwaAPI
|
|
482
522
|
endpoint_string = endpoint[:name]
|
483
523
|
end
|
484
524
|
url_string = @baruwa_url + endpoint_string
|
485
|
-
url_string
|
525
|
+
url_string = url_string + '?' + get_params(params) if params
|
486
526
|
uri = URI.parse(url_string)
|
487
527
|
return uri
|
488
528
|
end
|
data/lib/baruwa/version.rb
CHANGED
@@ -21,6 +21,19 @@ describe 'Test Authentication Settings' do
|
|
21
21
|
expect(WebMock).to have_requested(:get, "#{@baruwapi.instance_variable_get(:@baruwa_url)}/authservers/#{domainid}")
|
22
22
|
end
|
23
23
|
|
24
|
+
it 'should get auth servers with pagination' do
|
25
|
+
page = 1
|
26
|
+
domainid = 10
|
27
|
+
stub_request(:get, "https://testbaruwa.com/api/v1/authservers/#{domainid}?page=#{page}").
|
28
|
+
with(:body => false,
|
29
|
+
:headers => {'Accept'=>'*/*',
|
30
|
+
'User-Agent'=>'BaruwaAPI-Ruby',
|
31
|
+
'Authorization'=>'Bearer 6e2347bc-278e-42f6-a84b-fa1766140cbd'}).
|
32
|
+
to_return(:status => 200, :body => "", :headers => {})
|
33
|
+
@baruwapi.get_authservers(domainid, page)
|
34
|
+
expect(WebMock).to have_requested(:get, "#{@baruwapi.instance_variable_get(:@baruwa_url)}/authservers/#{domainid}?page=#{page}")
|
35
|
+
end
|
36
|
+
|
24
37
|
it 'should get auth server' do
|
25
38
|
domainid = 10
|
26
39
|
serverid = 10
|
@@ -21,6 +21,19 @@ describe 'Test Delivery servers' do
|
|
21
21
|
expect(WebMock).to have_requested(:get, "#{@baruwapi.instance_variable_get(:@baruwa_url)}/deliveryservers/#{domainid}")
|
22
22
|
end
|
23
23
|
|
24
|
+
it 'should get delivery servers with pagination' do
|
25
|
+
page = 1
|
26
|
+
domainid = 10
|
27
|
+
stub_request(:get, "https://testbaruwa.com/api/v1/deliveryservers/#{domainid}?page=#{page}").
|
28
|
+
with(:body => false,
|
29
|
+
:headers => {'Accept'=>'*/*',
|
30
|
+
'User-Agent'=>'BaruwaAPI-Ruby',
|
31
|
+
'Authorization'=>'Bearer 6e2347bc-278e-42f6-a84b-fa1766140cbd'}).
|
32
|
+
to_return(:status => 200, :body => "", :headers => {})
|
33
|
+
@baruwapi.get_deliveryservers(domainid, page)
|
34
|
+
expect(WebMock).to have_requested(:get, "#{@baruwapi.instance_variable_get(:@baruwa_url)}/deliveryservers/#{domainid}?page=#{page}")
|
35
|
+
end
|
36
|
+
|
24
37
|
it 'should get a delivery server' do
|
25
38
|
domainid = 10
|
26
39
|
serverid = 10
|
@@ -21,6 +21,19 @@ describe 'Test Domain Aliases' do
|
|
21
21
|
expect(WebMock).to have_requested(:get, "#{@baruwapi.instance_variable_get(:@baruwa_url)}/domainaliases/#{domainid}")
|
22
22
|
end
|
23
23
|
|
24
|
+
it 'should get domain aliases with pagination' do
|
25
|
+
page = 1
|
26
|
+
domainid = 10
|
27
|
+
stub_request(:get, "https://testbaruwa.com/api/v1/domainaliases/#{domainid}?page=#{page}").
|
28
|
+
with(:body => false,
|
29
|
+
:headers => {'Accept'=>'*/*',
|
30
|
+
'User-Agent'=>'BaruwaAPI-Ruby',
|
31
|
+
'Authorization'=>'Bearer 6e2347bc-278e-42f6-a84b-fa1766140cbd'}).
|
32
|
+
to_return(:status => 200, :body => "", :headers => {})
|
33
|
+
@baruwapi.get_domainaliases(domainid, page)
|
34
|
+
expect(WebMock).to have_requested(:get, "#{@baruwapi.instance_variable_get(:@baruwa_url)}/domainaliases/#{domainid}?page=#{page}")
|
35
|
+
end
|
36
|
+
|
24
37
|
it 'should get a domain alias' do
|
25
38
|
domainid = 10
|
26
39
|
aliasid = 1
|
data/spec/baruwa_domains_spec.rb
CHANGED
@@ -40,6 +40,18 @@ describe 'Test Domains' do
|
|
40
40
|
expect(WebMock).to have_requested(:get, "#{@baruwapi.instance_variable_get(:@baruwa_url)}/domains")
|
41
41
|
end
|
42
42
|
|
43
|
+
it 'should get domains with pagination' do
|
44
|
+
page = 1
|
45
|
+
stub_request(:get, "https://testbaruwa.com/api/v1/domains?page=#{page}").
|
46
|
+
with(:body => false,
|
47
|
+
:headers => {'Accept'=>'*/*',
|
48
|
+
'User-Agent'=>'BaruwaAPI-Ruby',
|
49
|
+
'Authorization'=>'Bearer 6e2347bc-278e-42f6-a84b-fa1766140cbd'}).
|
50
|
+
to_return(:status => 200, :body => "", :headers => {})
|
51
|
+
@baruwapi.get_domains(page)
|
52
|
+
expect(WebMock).to have_requested(:get, "#{@baruwapi.instance_variable_get(:@baruwa_url)}/domains?page=#{page}")
|
53
|
+
end
|
54
|
+
|
43
55
|
it 'should get a domain' do
|
44
56
|
domainid = 10
|
45
57
|
stub_request(:get, "https://testbaruwa.com/api/v1/domains/#{domainid}").
|
@@ -21,6 +21,19 @@ describe 'Test Fallback servers' do
|
|
21
21
|
expect(WebMock).to have_requested(:get, "#{@baruwapi.instance_variable_get(:@baruwa_url)}/fallbackservers/list/#{orgid}")
|
22
22
|
end
|
23
23
|
|
24
|
+
it 'should get Fallback servers with pagination' do
|
25
|
+
page = 1
|
26
|
+
orgid = 10
|
27
|
+
stub_request(:get, "https://testbaruwa.com/api/v1/fallbackservers/list/#{orgid}?page=#{page}").
|
28
|
+
with(:body => false,
|
29
|
+
:headers => {'Accept'=>'*/*',
|
30
|
+
'User-Agent'=>'BaruwaAPI-Ruby',
|
31
|
+
'Authorization'=>'Bearer 6e2347bc-278e-42f6-a84b-fa1766140cbd'}).
|
32
|
+
to_return(:status => 200, :body => "", :headers => {})
|
33
|
+
@baruwapi.get_fallbackservers(orgid, page)
|
34
|
+
expect(WebMock).to have_requested(:get, "#{@baruwapi.instance_variable_get(:@baruwa_url)}/fallbackservers/list/#{orgid}?page=#{page}")
|
35
|
+
end
|
36
|
+
|
24
37
|
it 'should get a Fallback server' do
|
25
38
|
serverid = 10
|
26
39
|
stub_request(:get, "https://testbaruwa.com/api/v1/fallbackservers/#{serverid}").
|
@@ -20,6 +20,18 @@ describe 'Test Organizations' do
|
|
20
20
|
expect(WebMock).to have_requested(:get, "#{@baruwapi.instance_variable_get(:@baruwa_url)}/organizations")
|
21
21
|
end
|
22
22
|
|
23
|
+
it 'should get organizations with pagination' do
|
24
|
+
page = 1
|
25
|
+
stub_request(:get, "https://testbaruwa.com/api/v1/organizations?page=#{page}").
|
26
|
+
with(:body => false,
|
27
|
+
:headers => {'Accept'=>'*/*',
|
28
|
+
'User-Agent'=>'BaruwaAPI-Ruby',
|
29
|
+
'Authorization'=>'Bearer 6e2347bc-278e-42f6-a84b-fa1766140cbd'}).
|
30
|
+
to_return(:status => 200, :body => "", :headers => {})
|
31
|
+
@baruwapi.get_organizations(page)
|
32
|
+
expect(WebMock).to have_requested(:get, "#{@baruwapi.instance_variable_get(:@baruwa_url)}/organizations?page=#{page}")
|
33
|
+
end
|
34
|
+
|
23
35
|
it 'should get an organization' do
|
24
36
|
orgid = 10
|
25
37
|
stub_request(:get, "https://testbaruwa.com/api/v1/organizations/#{orgid}").
|
@@ -21,6 +21,19 @@ describe 'Test Organization Smarthosts' do
|
|
21
21
|
expect(WebMock).to have_requested(:get, "#{@baruwapi.instance_variable_get(:@baruwa_url)}/organizations/smarthosts/#{orgid}")
|
22
22
|
end
|
23
23
|
|
24
|
+
it 'should get organization smarthosts with pagination' do
|
25
|
+
page = 1
|
26
|
+
orgid = 10
|
27
|
+
stub_request(:get, "https://testbaruwa.com/api/v1/organizations/smarthosts/#{orgid}?page=#{page}").
|
28
|
+
with(:body => false,
|
29
|
+
:headers => {'Accept'=>'*/*',
|
30
|
+
'User-Agent'=>'BaruwaAPI-Ruby',
|
31
|
+
'Authorization'=>'Bearer 6e2347bc-278e-42f6-a84b-fa1766140cbd'}).
|
32
|
+
to_return(:status => 200, :body => "", :headers => {})
|
33
|
+
@baruwapi.get_org_smarthosts(orgid, page)
|
34
|
+
expect(WebMock).to have_requested(:get, "#{@baruwapi.instance_variable_get(:@baruwa_url)}/organizations/smarthosts/#{orgid}?page=#{page}")
|
35
|
+
end
|
36
|
+
|
24
37
|
it 'should get a organization smarthost' do
|
25
38
|
orgid = 10
|
26
39
|
smarthostid = 1
|
@@ -21,6 +21,19 @@ describe 'Test Domain Smarthosts' do
|
|
21
21
|
expect(WebMock).to have_requested(:get, "#{@baruwapi.instance_variable_get(:@baruwa_url)}/domains/smarthosts/#{domainid}")
|
22
22
|
end
|
23
23
|
|
24
|
+
it 'should get domain smarthosts with pagination' do
|
25
|
+
page = 1
|
26
|
+
domainid = 10
|
27
|
+
stub_request(:get, "https://testbaruwa.com/api/v1/domains/smarthosts/#{domainid}?page=#{page}").
|
28
|
+
with(:body => false,
|
29
|
+
:headers => {'Accept'=>'*/*',
|
30
|
+
'User-Agent'=>'BaruwaAPI-Ruby',
|
31
|
+
'Authorization'=>'Bearer 6e2347bc-278e-42f6-a84b-fa1766140cbd'}).
|
32
|
+
to_return(:status => 200, :body => "", :headers => {})
|
33
|
+
@baruwapi.get_domain_smarthosts(domainid, page)
|
34
|
+
expect(WebMock).to have_requested(:get, "#{@baruwapi.instance_variable_get(:@baruwa_url)}/domains/smarthosts/#{domainid}?page=#{page}")
|
35
|
+
end
|
36
|
+
|
24
37
|
it 'should get a domain smarthost' do
|
25
38
|
domainid = 10
|
26
39
|
smarthostid = 1
|
@@ -21,6 +21,19 @@ describe 'Test User Delivery servers' do
|
|
21
21
|
expect(WebMock).to have_requested(:get, "#{@baruwapi.instance_variable_get(:@baruwa_url)}/userdeliveryservers/#{domainid}")
|
22
22
|
end
|
23
23
|
|
24
|
+
it 'should get user delivery servers with pagination' do
|
25
|
+
page = 1
|
26
|
+
domainid = 10
|
27
|
+
stub_request(:get, "https://testbaruwa.com/api/v1/userdeliveryservers/#{domainid}?page=#{page}").
|
28
|
+
with(:body => false,
|
29
|
+
:headers => {'Accept'=>'*/*',
|
30
|
+
'User-Agent'=>'BaruwaAPI-Ruby',
|
31
|
+
'Authorization'=>'Bearer 6e2347bc-278e-42f6-a84b-fa1766140cbd'}).
|
32
|
+
to_return(:status => 200, :body => "", :headers => {})
|
33
|
+
@baruwapi.get_user_deliveryservers(domainid, page)
|
34
|
+
expect(WebMock).to have_requested(:get, "#{@baruwapi.instance_variable_get(:@baruwa_url)}/userdeliveryservers/#{domainid}?page=#{page}")
|
35
|
+
end
|
36
|
+
|
24
37
|
it 'should get a user delivery server' do
|
25
38
|
domainid = 10
|
26
39
|
serverid = 10
|
data/spec/baruwa_users_spec.rb
CHANGED
@@ -36,6 +36,18 @@ describe 'Test Users' do
|
|
36
36
|
expect(WebMock).to have_requested(:get, "#{@baruwapi.instance_variable_get(:@baruwa_url)}/users")
|
37
37
|
end
|
38
38
|
|
39
|
+
it 'should get users with pagination' do
|
40
|
+
page = 1
|
41
|
+
stub_request(:get, "https://testbaruwa.com/api/v1/users?page=#{page}").
|
42
|
+
with(:body => false,
|
43
|
+
:headers => {'Accept'=>'*/*',
|
44
|
+
'User-Agent'=>'BaruwaAPI-Ruby',
|
45
|
+
'Authorization'=>'Bearer 6e2347bc-278e-42f6-a84b-fa1766140cbd'}).
|
46
|
+
to_return(:status => 200, :body => "", :headers => {})
|
47
|
+
@baruwapi.get_users(page)
|
48
|
+
expect(WebMock).to have_requested(:get, "#{@baruwapi.instance_variable_get(:@baruwa_url)}/users?page=#{page}")
|
49
|
+
end
|
50
|
+
|
39
51
|
it 'should get a user' do
|
40
52
|
userid = 20
|
41
53
|
stub_request(:get, "https://testbaruwa.com/api/v1/users/#{userid}").
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: baruwa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Colin Kissa
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-02-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -73,7 +73,6 @@ executables: []
|
|
73
73
|
extensions: []
|
74
74
|
extra_rdoc_files: []
|
75
75
|
files:
|
76
|
-
- ".codeclimate.yml"
|
77
76
|
- ".gitignore"
|
78
77
|
- ".rspec"
|
79
78
|
- ".rubocop.yml"
|
@@ -99,10 +98,10 @@ files:
|
|
99
98
|
- spec/baruwa_relays_spec.rb
|
100
99
|
- spec/baruwa_smarthosts_spec.rb
|
101
100
|
- spec/baruwa_status_spec.rb
|
102
|
-
- spec/
|
101
|
+
- spec/baruwa_user_deliveryservers_spec.rb
|
103
102
|
- spec/baruwa_users_spec.rb
|
104
103
|
- spec/spec_helper.rb
|
105
|
-
homepage: https://github.com/
|
104
|
+
homepage: https://github.com/baruwa-enterprise/baruwa-ruby
|
106
105
|
licenses:
|
107
106
|
- MPL-2.0
|
108
107
|
metadata: {}
|
@@ -140,6 +139,6 @@ test_files:
|
|
140
139
|
- spec/baruwa_relays_spec.rb
|
141
140
|
- spec/baruwa_smarthosts_spec.rb
|
142
141
|
- spec/baruwa_status_spec.rb
|
143
|
-
- spec/
|
142
|
+
- spec/baruwa_user_deliveryservers_spec.rb
|
144
143
|
- spec/baruwa_users_spec.rb
|
145
144
|
- spec/spec_helper.rb
|