baruwa 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +1 -1
- data/baruwa.gemspec +1 -1
- data/lib/baruwa.rb +97 -1
- data/lib/baruwa/version.rb +2 -2
- data/spec/baruwa_orgsmarthosts_spec.rb +74 -0
- data/spec/baruwa_smarthosts_spec.rb +74 -0
- data/spec/baruwa_user_deliveryservers.rb +74 -0
- data/spec/spec_helper.rb +1 -5
- metadata +9 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 9754572f342b11ecffd0ac8ed4d695982ca4ec3657dc187d0be0a3755f1816d2
|
4
|
+
data.tar.gz: 61114a2dc74e23b12233fa9fea07526aa86639637eb362dd03c43b7306777ff3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d64692fe0278e33ecbf9cb8b108c7ff6a49e610ed85cd29d29b2bfe390fc9aca7f52cab011e5669f227909ebcdcf71a4aa3766a8b65f20ca9c7e7a945e168d45
|
7
|
+
data.tar.gz: acefdb6ec00a76ce5f06bc47e98e1b76a81f824f2be6c62d65ec521665ad7043339697be8b7311f149ccd5145b48141bee1c280aedce3b5422a7790bcc7339cc
|
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
|
-
[![Test Coverage](https://codeclimate.com/github/akissa/baruwa-ruby/badges/coverage.svg)](https://codeclimate.com/github/akissa/baruwa-ruby/coverage)
|
6
5
|
[![Build Status](https://travis-ci.org/akissa/baruwa-ruby.svg?branch=master)](https://travis-ci.org/akissa/baruwa-ruby)
|
6
|
+
[![codecov](https://codecov.io/gh/akissa/baruwa-ruby/branch/master/graph/badge.svg)](https://codecov.io/gh/akissa/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
|
|
data/baruwa.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
# vim: ai ts=4 sts=4 et sw=4
|
3
3
|
# baruwa: Ruby bindings for the Baruwa REST API
|
4
|
-
# Copyright (C) 2015-
|
4
|
+
# Copyright (C) 2015-2019 Andrew Colin Kissa <andrew@topdog.za.net>
|
5
5
|
#
|
6
6
|
# This Source Code Form is subject to the terms of the Mozilla Public
|
7
7
|
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
data/lib/baruwa.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
# vim: ai ts=4 sts=4 et sw=4
|
3
3
|
# baruwa: Ruby bindings for the Baruwa REST API
|
4
|
-
# Copyright (C) 2015-
|
4
|
+
# Copyright (C) 2015-2019 Andrew Colin Kissa <andrew@topdog.za.net>
|
5
5
|
#
|
6
6
|
# This Source Code Form is subject to the terms of the Mozilla Public
|
7
7
|
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
@@ -46,6 +46,13 @@ class BaruwaAPI
|
|
46
46
|
:update => {:name => '/domainaliases/%s/%s', :method => :put},
|
47
47
|
:delete => {:name => '/domainaliases/%s/%s', :method => :delete}
|
48
48
|
},
|
49
|
+
:domainsmarthosts => {
|
50
|
+
:list => {:name => '/domains/smarthosts/%s', :method => :get},
|
51
|
+
:new => {:name => '/domains/smarthosts/%s', :method => :post},
|
52
|
+
:get => {:name => '/domains/smarthosts/%s/%s', :method => :get},
|
53
|
+
:update => {:name => '/domains/smarthosts/%s/%s', :method => :put},
|
54
|
+
:delete => {:name => '/domains/smarthosts/%s/%s', :method => :delete}
|
55
|
+
},
|
49
56
|
:deliveryservers => {
|
50
57
|
:list => {:name => '/deliveryservers/%s', :method => :get},
|
51
58
|
:new => {:name => '/deliveryservers/%s', :method => :post},
|
@@ -53,6 +60,13 @@ class BaruwaAPI
|
|
53
60
|
:update => {:name => '/deliveryservers/%s/%s', :method => :put},
|
54
61
|
:delete => {:name => '/deliveryservers/%s/%s', :method => :delete}
|
55
62
|
},
|
63
|
+
:userdeliveryservers => {
|
64
|
+
:list => {:name => '/userdeliveryservers/%s', :method => :get},
|
65
|
+
:new => {:name => '/userdeliveryservers/%s', :method => :post},
|
66
|
+
:get => {:name => '/userdeliveryservers/%s/%s', :method => :get},
|
67
|
+
:update => {:name => '/userdeliveryservers/%s/%s', :method => :put},
|
68
|
+
:delete => {:name => '/userdeliveryservers/%s/%s', :method => :delete}
|
69
|
+
},
|
56
70
|
:authservers => {
|
57
71
|
:list => {:name => '/authservers/%s', :method => :get},
|
58
72
|
:new => {:name => '/authservers/%s', :method => :post},
|
@@ -92,6 +106,13 @@ class BaruwaAPI
|
|
92
106
|
:update => {:name => '/fallbackservers/%s', :method => :put},
|
93
107
|
:delete => {:name => '/fallbackservers/%s', :method => :delete}
|
94
108
|
},
|
109
|
+
:orgsmarthosts => {
|
110
|
+
:list => {:name => '/organizations/smarthosts/%s', :method => :get},
|
111
|
+
:new => {:name => '/organizations/smarthosts/%s', :method => :post},
|
112
|
+
:get => {:name => '/organizations/smarthosts/%s/%s', :method => :get},
|
113
|
+
:update => {:name => '/organizations/smarthosts/%s/%s', :method => :put},
|
114
|
+
:delete => {:name => '/organizations/smarthosts/%s/%s', :method => :delete}
|
115
|
+
},
|
95
116
|
:status => {:name => '/status', :method => :get}
|
96
117
|
}
|
97
118
|
def initialize (url, token, ssl_verify=false)
|
@@ -205,6 +226,31 @@ class BaruwaAPI
|
|
205
226
|
call_api(ENDPOINTS[:domainaliases][:delete], [domainid, aliasid], data)
|
206
227
|
end
|
207
228
|
|
229
|
+
def get_domain_smarthosts(domainid)
|
230
|
+
# get domain smarthosts
|
231
|
+
call_api(ENDPOINTS[:domainsmarthosts][:list], [domainid])
|
232
|
+
end
|
233
|
+
|
234
|
+
def get_domain_smarthost(domainid, smarthostid)
|
235
|
+
# get domain smarthost
|
236
|
+
call_api(ENDPOINTS[:domainsmarthosts][:get], [domainid, smarthostid])
|
237
|
+
end
|
238
|
+
|
239
|
+
def create_domain_smarthost(domainid, data)
|
240
|
+
# create a domain smarthost
|
241
|
+
call_api(ENDPOINTS[:domainsmarthosts][:new], [domainid], data)
|
242
|
+
end
|
243
|
+
|
244
|
+
def update_domain_smarthost(domainid, smarthostid, data)
|
245
|
+
# update a domain smarthost
|
246
|
+
call_api(ENDPOINTS[:domainsmarthosts][:update], [domainid, smarthostid], data)
|
247
|
+
end
|
248
|
+
|
249
|
+
def delete_domain_smarthost(domainid, smarthostid, data)
|
250
|
+
# delete a domain smarthost
|
251
|
+
call_api(ENDPOINTS[:domainsmarthosts][:delete], [domainid, smarthostid], data)
|
252
|
+
end
|
253
|
+
|
208
254
|
def get_deliveryservers(domainid)
|
209
255
|
# get delivery servers
|
210
256
|
call_api(ENDPOINTS[:deliveryservers][:list], [domainid])
|
@@ -230,6 +276,31 @@ class BaruwaAPI
|
|
230
276
|
call_api(ENDPOINTS[:deliveryservers][:delete], [domainid, serverid], data)
|
231
277
|
end
|
232
278
|
|
279
|
+
def get_user_deliveryservers(domainid)
|
280
|
+
# get delivery servers
|
281
|
+
call_api(ENDPOINTS[:userdeliveryservers][:list], [domainid])
|
282
|
+
end
|
283
|
+
|
284
|
+
def get_user_deliveryserver(domainid, serverid)
|
285
|
+
# get a delivery server
|
286
|
+
call_api(ENDPOINTS[:userdeliveryservers][:get], [domainid, serverid])
|
287
|
+
end
|
288
|
+
|
289
|
+
def create_user_deliveryserver(domainid, data)
|
290
|
+
# create a delivery server
|
291
|
+
call_api(ENDPOINTS[:userdeliveryservers][:new], [domainid], data)
|
292
|
+
end
|
293
|
+
|
294
|
+
def update_user_deliveryserver(domainid, serverid, data)
|
295
|
+
# update a delivery server
|
296
|
+
call_api(ENDPOINTS[:userdeliveryservers][:update], [domainid, serverid], data)
|
297
|
+
end
|
298
|
+
|
299
|
+
def delete_user_deliveryserver(domainid, serverid, data)
|
300
|
+
# delete delivery servers
|
301
|
+
call_api(ENDPOINTS[:userdeliveryservers][:delete], [domainid, serverid], data)
|
302
|
+
end
|
303
|
+
|
233
304
|
def get_authservers(domainid)
|
234
305
|
# get auth servers
|
235
306
|
call_api(ENDPOINTS[:authservers][:list], [domainid])
|
@@ -365,6 +436,31 @@ class BaruwaAPI
|
|
365
436
|
call_api(ENDPOINTS[:fallbackservers][:delete], [serverid], data)
|
366
437
|
end
|
367
438
|
|
439
|
+
def get_org_smarthosts(orgid)
|
440
|
+
# get organization smarthosts
|
441
|
+
call_api(ENDPOINTS[:orgsmarthosts][:list], [orgid])
|
442
|
+
end
|
443
|
+
|
444
|
+
def get_org_smarthost(orgid, smarthostid)
|
445
|
+
# get organization smarthost
|
446
|
+
call_api(ENDPOINTS[:orgsmarthosts][:get], [orgid, smarthostid])
|
447
|
+
end
|
448
|
+
|
449
|
+
def create_org_smarthost(orgid, data)
|
450
|
+
# create a organization smarthost
|
451
|
+
call_api(ENDPOINTS[:orgsmarthosts][:new], [orgid], data)
|
452
|
+
end
|
453
|
+
|
454
|
+
def update_org_smarthost(orgid, smarthostid, data)
|
455
|
+
# update a organization smarthost
|
456
|
+
call_api(ENDPOINTS[:orgsmarthosts][:update], [orgid, smarthostid], data)
|
457
|
+
end
|
458
|
+
|
459
|
+
def delete_org_smarthost(orgid, smarthostid, data)
|
460
|
+
# delete a organization smarthost
|
461
|
+
call_api(ENDPOINTS[:orgsmarthosts][:delete], [orgid, smarthostid], data)
|
462
|
+
end
|
463
|
+
|
368
464
|
def get_status
|
369
465
|
# get status
|
370
466
|
call_api(ENDPOINTS[:status])
|
data/lib/baruwa/version.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
# vim: ai ts=4 sts=4 et sw=4
|
3
3
|
# baruwa: Ruby bindings for the Baruwa REST API
|
4
|
-
# Copyright (C) 2015-
|
4
|
+
# Copyright (C) 2015-2019 Andrew Colin Kissa <andrew@topdog.za.net>
|
5
5
|
#
|
6
6
|
# This Source Code Form is subject to the terms of the Mozilla Public
|
7
7
|
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
8
8
|
# You can obtain one at http://mozilla.org/MPL/2.0/.
|
9
9
|
module Baruwa
|
10
|
-
VERSION = "0.0.
|
10
|
+
VERSION = "0.0.5"
|
11
11
|
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'Test Organization Smarthosts' do
|
4
|
+
before(:each) do
|
5
|
+
WebMock.reset!
|
6
|
+
end
|
7
|
+
|
8
|
+
before do
|
9
|
+
@baruwapi = BaruwaAPI.new('https://testbaruwa.com', '6e2347bc-278e-42f6-a84b-fa1766140cbd')
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'should get organization smarthosts' do
|
13
|
+
orgid = 10
|
14
|
+
stub_request(:get, "https://testbaruwa.com/api/v1/organizations/smarthosts/#{orgid}").
|
15
|
+
with(:body => false,
|
16
|
+
:headers => {'Accept'=>'*/*',
|
17
|
+
'User-Agent'=>'BaruwaAPI-Ruby',
|
18
|
+
'Authorization'=>'Bearer 6e2347bc-278e-42f6-a84b-fa1766140cbd'}).
|
19
|
+
to_return(:status => 200, :body => "", :headers => {})
|
20
|
+
@baruwapi.get_org_smarthosts(orgid)
|
21
|
+
expect(WebMock).to have_requested(:get, "#{@baruwapi.instance_variable_get(:@baruwa_url)}/organizations/smarthosts/#{orgid}")
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'should get a organization smarthost' do
|
25
|
+
orgid = 10
|
26
|
+
smarthostid = 1
|
27
|
+
stub_request(:get, "https://testbaruwa.com/api/v1/organizations/smarthosts/#{orgid}/#{smarthostid}").
|
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_smarthost(orgid, smarthostid)
|
34
|
+
expect(WebMock).to have_requested(:get, "#{@baruwapi.instance_variable_get(:@baruwa_url)}/organizations/smarthosts/#{orgid}/#{smarthostid}")
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'should create a organization smarthost' do
|
38
|
+
orgid = 10
|
39
|
+
stub_request(:post, "https://testbaruwa.com/api/v1/organizations/smarthosts/#{orgid}").
|
40
|
+
with(:body => {},
|
41
|
+
:headers => {'Accept'=>'*/*',
|
42
|
+
'User-Agent'=>'BaruwaAPI-Ruby',
|
43
|
+
'Authorization'=>'Bearer 6e2347bc-278e-42f6-a84b-fa1766140cbd'}).
|
44
|
+
to_return(:status => 200, :body => "", :headers => {})
|
45
|
+
@baruwapi.create_org_smarthost(orgid, {})
|
46
|
+
expect(WebMock).to have_requested(:post, "#{@baruwapi.instance_variable_get(:@baruwa_url)}/organizations/smarthosts/#{orgid}")
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'should update a organization smarthost' do
|
50
|
+
orgid = 10
|
51
|
+
smarthostid = 1
|
52
|
+
stub_request(:put, "https://testbaruwa.com/api/v1/organizations/smarthosts/#{orgid}/#{smarthostid}").
|
53
|
+
with(:body => {},
|
54
|
+
:headers => {'Accept'=>'*/*',
|
55
|
+
'User-Agent'=>'BaruwaAPI-Ruby',
|
56
|
+
'Authorization'=>'Bearer 6e2347bc-278e-42f6-a84b-fa1766140cbd'}).
|
57
|
+
to_return(:status => 200, :body => "", :headers => {})
|
58
|
+
@baruwapi.update_org_smarthost(orgid, smarthostid, {})
|
59
|
+
expect(WebMock).to have_requested(:put, "#{@baruwapi.instance_variable_get(:@baruwa_url)}/organizations/smarthosts/#{orgid}/#{smarthostid}")
|
60
|
+
end
|
61
|
+
|
62
|
+
it 'should delete a organization smarthost' do
|
63
|
+
orgid = 10
|
64
|
+
smarthostid = 1
|
65
|
+
stub_request(:delete, "https://testbaruwa.com/api/v1/organizations/smarthosts/#{orgid}/#{smarthostid}").
|
66
|
+
with(:body => {},
|
67
|
+
:headers => {'Accept'=>'*/*',
|
68
|
+
'User-Agent'=>'BaruwaAPI-Ruby',
|
69
|
+
'Authorization'=>'Bearer 6e2347bc-278e-42f6-a84b-fa1766140cbd'}).
|
70
|
+
to_return(:status => 200, :body => "", :headers => {})
|
71
|
+
@baruwapi.delete_org_smarthost(orgid, smarthostid, {})
|
72
|
+
expect(WebMock).to have_requested(:delete, "#{@baruwapi.instance_variable_get(:@baruwa_url)}/organizations/smarthosts/#{orgid}/#{smarthostid}")
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'Test Domain Smarthosts' do
|
4
|
+
before(:each) do
|
5
|
+
WebMock.reset!
|
6
|
+
end
|
7
|
+
|
8
|
+
before do
|
9
|
+
@baruwapi = BaruwaAPI.new('https://testbaruwa.com', '6e2347bc-278e-42f6-a84b-fa1766140cbd')
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'should get domain smarthosts' do
|
13
|
+
domainid = 10
|
14
|
+
stub_request(:get, "https://testbaruwa.com/api/v1/domains/smarthosts/#{domainid}").
|
15
|
+
with(:body => false,
|
16
|
+
:headers => {'Accept'=>'*/*',
|
17
|
+
'User-Agent'=>'BaruwaAPI-Ruby',
|
18
|
+
'Authorization'=>'Bearer 6e2347bc-278e-42f6-a84b-fa1766140cbd'}).
|
19
|
+
to_return(:status => 200, :body => "", :headers => {})
|
20
|
+
@baruwapi.get_domain_smarthosts(domainid)
|
21
|
+
expect(WebMock).to have_requested(:get, "#{@baruwapi.instance_variable_get(:@baruwa_url)}/domains/smarthosts/#{domainid}")
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'should get a domain smarthost' do
|
25
|
+
domainid = 10
|
26
|
+
smarthostid = 1
|
27
|
+
stub_request(:get, "https://testbaruwa.com/api/v1/domains/smarthosts/#{domainid}/#{smarthostid}").
|
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_smarthost(domainid, smarthostid)
|
34
|
+
expect(WebMock).to have_requested(:get, "#{@baruwapi.instance_variable_get(:@baruwa_url)}/domains/smarthosts/#{domainid}/#{smarthostid}")
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'should create a domain smarthost' do
|
38
|
+
domainid = 10
|
39
|
+
stub_request(:post, "https://testbaruwa.com/api/v1/domains/smarthosts/#{domainid}").
|
40
|
+
with(:body => {},
|
41
|
+
:headers => {'Accept'=>'*/*',
|
42
|
+
'User-Agent'=>'BaruwaAPI-Ruby',
|
43
|
+
'Authorization'=>'Bearer 6e2347bc-278e-42f6-a84b-fa1766140cbd'}).
|
44
|
+
to_return(:status => 200, :body => "", :headers => {})
|
45
|
+
@baruwapi.create_domain_smarthost(domainid, {})
|
46
|
+
expect(WebMock).to have_requested(:post, "#{@baruwapi.instance_variable_get(:@baruwa_url)}/domains/smarthosts/#{domainid}")
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'should update a domain smarthost' do
|
50
|
+
domainid = 10
|
51
|
+
smarthostid = 1
|
52
|
+
stub_request(:put, "https://testbaruwa.com/api/v1/domains/smarthosts/#{domainid}/#{smarthostid}").
|
53
|
+
with(:body => {},
|
54
|
+
:headers => {'Accept'=>'*/*',
|
55
|
+
'User-Agent'=>'BaruwaAPI-Ruby',
|
56
|
+
'Authorization'=>'Bearer 6e2347bc-278e-42f6-a84b-fa1766140cbd'}).
|
57
|
+
to_return(:status => 200, :body => "", :headers => {})
|
58
|
+
@baruwapi.update_domain_smarthost(domainid, smarthostid, {})
|
59
|
+
expect(WebMock).to have_requested(:put, "#{@baruwapi.instance_variable_get(:@baruwa_url)}/domains/smarthosts/#{domainid}/#{smarthostid}")
|
60
|
+
end
|
61
|
+
|
62
|
+
it 'should delete a domain smarthost' do
|
63
|
+
domainid = 10
|
64
|
+
smarthostid = 1
|
65
|
+
stub_request(:delete, "https://testbaruwa.com/api/v1/domains/smarthosts/#{domainid}/#{smarthostid}").
|
66
|
+
with(:body => {},
|
67
|
+
:headers => {'Accept'=>'*/*',
|
68
|
+
'User-Agent'=>'BaruwaAPI-Ruby',
|
69
|
+
'Authorization'=>'Bearer 6e2347bc-278e-42f6-a84b-fa1766140cbd'}).
|
70
|
+
to_return(:status => 200, :body => "", :headers => {})
|
71
|
+
@baruwapi.delete_domain_smarthost(domainid, smarthostid, {})
|
72
|
+
expect(WebMock).to have_requested(:delete, "#{@baruwapi.instance_variable_get(:@baruwa_url)}/domains/smarthosts/#{domainid}/#{smarthostid}")
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'Test User Delivery servers' do
|
4
|
+
before(:each) do
|
5
|
+
WebMock.reset!
|
6
|
+
end
|
7
|
+
|
8
|
+
before do
|
9
|
+
@baruwapi = BaruwaAPI.new('https://testbaruwa.com', '6e2347bc-278e-42f6-a84b-fa1766140cbd')
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'should get user delivery servers' do
|
13
|
+
domainid = 10
|
14
|
+
stub_request(:get, "https://testbaruwa.com/api/v1/userdeliveryservers/#{domainid}").
|
15
|
+
with(:body => false,
|
16
|
+
:headers => {'Accept'=>'*/*',
|
17
|
+
'User-Agent'=>'BaruwaAPI-Ruby',
|
18
|
+
'Authorization'=>'Bearer 6e2347bc-278e-42f6-a84b-fa1766140cbd'}).
|
19
|
+
to_return(:status => 200, :body => "", :headers => {})
|
20
|
+
@baruwapi.get_user_deliveryservers(domainid)
|
21
|
+
expect(WebMock).to have_requested(:get, "#{@baruwapi.instance_variable_get(:@baruwa_url)}/userdeliveryservers/#{domainid}")
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'should get a user delivery server' do
|
25
|
+
domainid = 10
|
26
|
+
serverid = 10
|
27
|
+
stub_request(:get, "https://testbaruwa.com/api/v1/userdeliveryservers/#{domainid}/#{serverid}").
|
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_deliveryserver(domainid, serverid)
|
34
|
+
expect(WebMock).to have_requested(:get, "#{@baruwapi.instance_variable_get(:@baruwa_url)}/userdeliveryservers/#{domainid}/#{serverid}")
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'should create a user delivery server' do
|
38
|
+
domainid = 10
|
39
|
+
stub_request(:post, "https://testbaruwa.com/api/v1/userdeliveryservers/#{domainid}").
|
40
|
+
with(:body => {},
|
41
|
+
:headers => {'Accept'=>'*/*',
|
42
|
+
'User-Agent'=>'BaruwaAPI-Ruby',
|
43
|
+
'Authorization'=>'Bearer 6e2347bc-278e-42f6-a84b-fa1766140cbd'}).
|
44
|
+
to_return(:status => 200, :body => "", :headers => {})
|
45
|
+
@baruwapi.create_user_deliveryserver(domainid, {})
|
46
|
+
expect(WebMock).to have_requested(:post, "#{@baruwapi.instance_variable_get(:@baruwa_url)}/userdeliveryservers/#{domainid}")
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'should update a user delivery server' do
|
50
|
+
domainid = 10
|
51
|
+
serverid = 10
|
52
|
+
stub_request(:put, "https://testbaruwa.com/api/v1/userdeliveryservers/#{domainid}/#{serverid}").
|
53
|
+
with(:body => {},
|
54
|
+
:headers => {'Accept'=>'*/*',
|
55
|
+
'User-Agent'=>'BaruwaAPI-Ruby',
|
56
|
+
'Authorization'=>'Bearer 6e2347bc-278e-42f6-a84b-fa1766140cbd'}).
|
57
|
+
to_return(:status => 200, :body => "", :headers => {})
|
58
|
+
@baruwapi.update_user_deliveryserver(domainid, serverid, {})
|
59
|
+
expect(WebMock).to have_requested(:put, "#{@baruwapi.instance_variable_get(:@baruwa_url)}/userdeliveryservers/#{domainid}/#{serverid}")
|
60
|
+
end
|
61
|
+
|
62
|
+
it 'should delete a user delivery server' do
|
63
|
+
domainid = 10
|
64
|
+
serverid = 10
|
65
|
+
stub_request(:delete, "https://testbaruwa.com/api/v1/userdeliveryservers/#{domainid}/#{serverid}").
|
66
|
+
with(:body => {},
|
67
|
+
:headers => {'Accept'=>'*/*',
|
68
|
+
'User-Agent'=>'BaruwaAPI-Ruby',
|
69
|
+
'Authorization'=>'Bearer 6e2347bc-278e-42f6-a84b-fa1766140cbd'}).
|
70
|
+
to_return(:status => 200, :body => "", :headers => {})
|
71
|
+
@baruwapi.delete_user_deliveryserver(domainid, serverid, {})
|
72
|
+
expect(WebMock).to have_requested(:delete, "#{@baruwapi.instance_variable_get(:@baruwa_url)}/userdeliveryservers/#{domainid}/#{serverid}")
|
73
|
+
end
|
74
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
require "codeclimate-test-reporter"
|
2
|
-
CodeClimate::TestReporter.start
|
3
1
|
require 'simplecov'
|
4
2
|
SimpleCov.start
|
5
3
|
if ENV['CI']=='true'
|
@@ -12,6 +10,4 @@ require 'rspec'
|
|
12
10
|
require 'webmock/rspec'
|
13
11
|
require 'baruwa'
|
14
12
|
|
15
|
-
|
16
|
-
|
17
|
-
WebMock.disable_net_connect!(:allow_localhost => true, :allow => "codeclimate.com")
|
13
|
+
WebMock.disable_net_connect!(:allow_localhost => true)
|
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.5
|
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:
|
11
|
+
date: 2019-01-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -94,9 +94,12 @@ files:
|
|
94
94
|
- spec/baruwa_incorrect_method_spec.rb
|
95
95
|
- spec/baruwa_ldapsettings_spec.rb
|
96
96
|
- spec/baruwa_organizations_spec.rb
|
97
|
+
- spec/baruwa_orgsmarthosts_spec.rb
|
97
98
|
- spec/baruwa_radiusettings_spec.rb
|
98
99
|
- spec/baruwa_relays_spec.rb
|
100
|
+
- spec/baruwa_smarthosts_spec.rb
|
99
101
|
- spec/baruwa_status_spec.rb
|
102
|
+
- spec/baruwa_user_deliveryservers.rb
|
100
103
|
- spec/baruwa_users_spec.rb
|
101
104
|
- spec/spec_helper.rb
|
102
105
|
homepage: https://github.com/akissa/baruwa-ruby
|
@@ -118,8 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
118
121
|
- !ruby/object:Gem::Version
|
119
122
|
version: '0'
|
120
123
|
requirements: []
|
121
|
-
|
122
|
-
rubygems_version: 2.4.6
|
124
|
+
rubygems_version: 3.0.2
|
123
125
|
signing_key:
|
124
126
|
specification_version: 4
|
125
127
|
summary: Ruby bindings for the Baruwa REST API
|
@@ -133,8 +135,11 @@ test_files:
|
|
133
135
|
- spec/baruwa_incorrect_method_spec.rb
|
134
136
|
- spec/baruwa_ldapsettings_spec.rb
|
135
137
|
- spec/baruwa_organizations_spec.rb
|
138
|
+
- spec/baruwa_orgsmarthosts_spec.rb
|
136
139
|
- spec/baruwa_radiusettings_spec.rb
|
137
140
|
- spec/baruwa_relays_spec.rb
|
141
|
+
- spec/baruwa_smarthosts_spec.rb
|
138
142
|
- spec/baruwa_status_spec.rb
|
143
|
+
- spec/baruwa_user_deliveryservers.rb
|
139
144
|
- spec/baruwa_users_spec.rb
|
140
145
|
- spec/spec_helper.rb
|