baruwa 0.0.1 → 0.0.2

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.
data/.travis.yml CHANGED
@@ -9,3 +9,9 @@ script: bundle exec rspec spec
9
9
  addons:
10
10
  code_climate:
11
11
  repo_token: 69a832cbd11706e0578a20c2aae40d42cf520f3a9a776932bc32833dd1b58f2b
12
+ notifications:
13
+ email:
14
+ on_success: change
15
+ on_failure: always
16
+ recipients:
17
+ - andrew@topdog.za.net
data/Gemfile CHANGED
@@ -2,5 +2,9 @@ source "http://rubygems.org"
2
2
 
3
3
  # Specify your gem's dependencies in baruwa.gemspec
4
4
  gemspec
5
- gem 'simplecov', :require => false, :group => :test
6
- gem "codeclimate-test-reporter", :group => :test, :require => nil
5
+
6
+ group :test do
7
+ gem 'simplecov', :require => false
8
+ gem 'codecov', :require => false
9
+ gem "codeclimate-test-reporter", :require => false
10
+ end
data/README.md CHANGED
@@ -4,6 +4,7 @@ This gem provides bindings for the [Baruwa](https://www.baruwa.com/) [REST API](
4
4
 
5
5
  [![Test Coverage](https://codeclimate.com/github/akissa/baruwa-ruby/badges/coverage.svg)](https://codeclimate.com/github/akissa/baruwa-ruby/coverage)
6
6
  [![Build Status](https://travis-ci.org/akissa/baruwa-ruby.svg?branch=master)](https://travis-ci.org/akissa/baruwa-ruby)
7
+ [![Gem Version](https://badge.fury.io/rb/baruwa.svg)](https://badge.fury.io/rb/baruwa)
7
8
  [![MPLv2 License](https://img.shields.io/badge/license-MPLv2-blue.svg?style=flat-square)](https://www.mozilla.org/MPL/2.0/)
8
9
 
9
10
  ## Installation
@@ -7,5 +7,5 @@
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.1"
10
+ VERSION = "0.0.2"
11
11
  end
data/lib/baruwa.rb CHANGED
@@ -6,11 +6,13 @@
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
- require "baruwa/version"
9
+ require "cgi"
10
10
  require "json"
11
11
  require "net/http"
12
12
 
13
- class BaruwaAPIError < StandardError; end
13
+ require "baruwa/version"
14
+
15
+ class BaruwaAPIError < StandardError;end
14
16
 
15
17
  class BaruwaAPI
16
18
  ENDPOINTS = {
@@ -86,6 +88,7 @@ class BaruwaAPI
86
88
  def initialize (url, token, ssl_verify=false)
87
89
  @baruwa_url = "#{url}/api/v1"
88
90
  @baruwa_token = token
91
+ @ssl_verify = ssl_verify
89
92
  end
90
93
 
91
94
  def get_users
@@ -346,13 +349,14 @@ class BaruwaAPI
346
349
  url_string = @baruwa_url + endpoint_string
347
350
  url_string << params if params
348
351
  uri = URI.parse(url_string)
352
+ return uri
349
353
  end
350
354
 
351
355
  def set_headers
352
356
  {
353
357
  'Content-Type' =>'application/json',
354
- 'User-Agent' => 'BaruwaAPI/Ruby',
355
- 'Authorization' => 'Bearer %s' % @baruwa_token
358
+ 'User-Agent' => 'BaruwaAPI-Ruby',
359
+ 'Authorization' => "Bearer #{@baruwa_token}"
356
360
  }
357
361
  end
358
362
 
@@ -379,7 +383,7 @@ class BaruwaAPI
379
383
  JSON.parse(response.body)
380
384
  end
381
385
  else
382
- raise BaruwaApiError.new("#{response.code} #{response.body.to_s}")
386
+ raise StandardError.new("#{response.code} #{response.body}")
383
387
  end
384
388
  end
385
389
 
@@ -15,7 +15,7 @@ describe 'Test Aliases' do
15
15
  with(:body => false,
16
16
  :headers => {'Accept'=>'*/*',
17
17
  'Content-Type'=>'application/json',
18
- 'User-Agent'=>'BaruwaAPI/Ruby',
18
+ 'User-Agent'=>'BaruwaAPI-Ruby',
19
19
  'Authorization'=>'Bearer 6e2347bc-278e-42f6-a84b-fa1766140cbd'}).
20
20
  to_return(:status => 200, :body => "", :headers => {})
21
21
  @baruwapi.get_aliases(addressid)
@@ -28,7 +28,7 @@ describe 'Test Aliases' do
28
28
  with(:body => {},
29
29
  :headers => {'Accept'=>'*/*',
30
30
  'Content-Type'=>'application/json',
31
- 'User-Agent'=>'BaruwaAPI/Ruby',
31
+ 'User-Agent'=>'BaruwaAPI-Ruby',
32
32
  'Authorization'=>'Bearer 6e2347bc-278e-42f6-a84b-fa1766140cbd'}).
33
33
  to_return(:status => 200, :body => "", :headers => {})
34
34
  @baruwapi.create_alias(addressid, {})
@@ -41,7 +41,7 @@ describe 'Test Aliases' do
41
41
  with(:body => {},
42
42
  :headers => {'Accept'=>'*/*',
43
43
  'Content-Type'=>'application/json',
44
- 'User-Agent'=>'BaruwaAPI/Ruby',
44
+ 'User-Agent'=>'BaruwaAPI-Ruby',
45
45
  'Authorization'=>'Bearer 6e2347bc-278e-42f6-a84b-fa1766140cbd'}).
46
46
  to_return(:status => 200, :body => "", :headers => {})
47
47
  @baruwapi.update_alias(addressid, {})
@@ -54,7 +54,7 @@ describe 'Test Aliases' do
54
54
  with(:body => {},
55
55
  :headers => {'Accept'=>'*/*',
56
56
  'Content-Type'=>'application/json',
57
- 'User-Agent'=>'BaruwaAPI/Ruby',
57
+ 'User-Agent'=>'BaruwaAPI-Ruby',
58
58
  'Authorization'=>'Bearer 6e2347bc-278e-42f6-a84b-fa1766140cbd'}).
59
59
  to_return(:status => 200, :body => "", :headers => {})
60
60
  @baruwapi.delete_alias(addressid, {})
@@ -15,7 +15,7 @@ describe 'Test Authentication Settings' do
15
15
  with(:body => false,
16
16
  :headers => {'Accept'=>'*/*',
17
17
  'Content-Type'=>'application/json',
18
- 'User-Agent'=>'BaruwaAPI/Ruby',
18
+ 'User-Agent'=>'BaruwaAPI-Ruby',
19
19
  'Authorization'=>'Bearer 6e2347bc-278e-42f6-a84b-fa1766140cbd'}).
20
20
  to_return(:status => 200, :body => "", :headers => {})
21
21
  @baruwapi.get_authservers(domainid)
@@ -29,7 +29,7 @@ describe 'Test Authentication Settings' do
29
29
  with(:body => false,
30
30
  :headers => {'Accept'=>'*/*',
31
31
  'Content-Type'=>'application/json',
32
- 'User-Agent'=>'BaruwaAPI/Ruby',
32
+ 'User-Agent'=>'BaruwaAPI-Ruby',
33
33
  'Authorization'=>'Bearer 6e2347bc-278e-42f6-a84b-fa1766140cbd'}).
34
34
  to_return(:status => 200, :body => "", :headers => {})
35
35
  @baruwapi.get_authserver(domainid, serverid)
@@ -42,7 +42,7 @@ describe 'Test Authentication Settings' do
42
42
  with(:body => {},
43
43
  :headers => {'Accept'=>'*/*',
44
44
  'Content-Type'=>'application/json',
45
- 'User-Agent'=>'BaruwaAPI/Ruby',
45
+ 'User-Agent'=>'BaruwaAPI-Ruby',
46
46
  'Authorization'=>'Bearer 6e2347bc-278e-42f6-a84b-fa1766140cbd'}).
47
47
  to_return(:status => 200, :body => "", :headers => {})
48
48
  @baruwapi.create_authserver(domainid, {})
@@ -56,7 +56,7 @@ describe 'Test Authentication Settings' do
56
56
  with(:body => {},
57
57
  :headers => {'Accept'=>'*/*',
58
58
  'Content-Type'=>'application/json',
59
- 'User-Agent'=>'BaruwaAPI/Ruby',
59
+ 'User-Agent'=>'BaruwaAPI-Ruby',
60
60
  'Authorization'=>'Bearer 6e2347bc-278e-42f6-a84b-fa1766140cbd'}).
61
61
  to_return(:status => 200, :body => "", :headers => {})
62
62
  @baruwapi.update_authserver(domainid, serverid, {})
@@ -70,7 +70,7 @@ describe 'Test Authentication Settings' do
70
70
  with(:body => {},
71
71
  :headers => {'Accept'=>'*/*',
72
72
  'Content-Type'=>'application/json',
73
- 'User-Agent'=>'BaruwaAPI/Ruby',
73
+ 'User-Agent'=>'BaruwaAPI-Ruby',
74
74
  'Authorization'=>'Bearer 6e2347bc-278e-42f6-a84b-fa1766140cbd'}).
75
75
  to_return(:status => 200, :body => "", :headers => {})
76
76
  @baruwapi.delete_authserver(domainid, serverid, {})
@@ -15,7 +15,7 @@ describe 'Test Delivery servers' do
15
15
  with(:body => false,
16
16
  :headers => {'Accept'=>'*/*',
17
17
  'Content-Type'=>'application/json',
18
- 'User-Agent'=>'BaruwaAPI/Ruby',
18
+ 'User-Agent'=>'BaruwaAPI-Ruby',
19
19
  'Authorization'=>'Bearer 6e2347bc-278e-42f6-a84b-fa1766140cbd'}).
20
20
  to_return(:status => 200, :body => "", :headers => {})
21
21
  @baruwapi.get_deliveryservers(domainid)
@@ -29,7 +29,7 @@ describe 'Test Delivery servers' do
29
29
  with(:body => false,
30
30
  :headers => {'Accept'=>'*/*',
31
31
  'Content-Type'=>'application/json',
32
- 'User-Agent'=>'BaruwaAPI/Ruby',
32
+ 'User-Agent'=>'BaruwaAPI-Ruby',
33
33
  'Authorization'=>'Bearer 6e2347bc-278e-42f6-a84b-fa1766140cbd'}).
34
34
  to_return(:status => 200, :body => "", :headers => {})
35
35
  @baruwapi.get_deliveryserver(domainid, serverid)
@@ -42,7 +42,7 @@ describe 'Test Delivery servers' do
42
42
  with(:body => {},
43
43
  :headers => {'Accept'=>'*/*',
44
44
  'Content-Type'=>'application/json',
45
- 'User-Agent'=>'BaruwaAPI/Ruby',
45
+ 'User-Agent'=>'BaruwaAPI-Ruby',
46
46
  'Authorization'=>'Bearer 6e2347bc-278e-42f6-a84b-fa1766140cbd'}).
47
47
  to_return(:status => 200, :body => "", :headers => {})
48
48
  @baruwapi.create_deliveryserver(domainid, {})
@@ -56,7 +56,7 @@ describe 'Test Delivery servers' do
56
56
  with(:body => {},
57
57
  :headers => {'Accept'=>'*/*',
58
58
  'Content-Type'=>'application/json',
59
- 'User-Agent'=>'BaruwaAPI/Ruby',
59
+ 'User-Agent'=>'BaruwaAPI-Ruby',
60
60
  'Authorization'=>'Bearer 6e2347bc-278e-42f6-a84b-fa1766140cbd'}).
61
61
  to_return(:status => 200, :body => "", :headers => {})
62
62
  @baruwapi.update_deliveryserver(domainid, serverid, {})
@@ -70,7 +70,7 @@ describe 'Test Delivery servers' do
70
70
  with(:body => {},
71
71
  :headers => {'Accept'=>'*/*',
72
72
  'Content-Type'=>'application/json',
73
- 'User-Agent'=>'BaruwaAPI/Ruby',
73
+ 'User-Agent'=>'BaruwaAPI-Ruby',
74
74
  'Authorization'=>'Bearer 6e2347bc-278e-42f6-a84b-fa1766140cbd'}).
75
75
  to_return(:status => 200, :body => "", :headers => {})
76
76
  @baruwapi.delete_deliveryserver(domainid, serverid, {})
@@ -15,7 +15,7 @@ describe 'Test Domain Aliases' do
15
15
  with(:body => false,
16
16
  :headers => {'Accept'=>'*/*',
17
17
  'Content-Type'=>'application/json',
18
- 'User-Agent'=>'BaruwaAPI/Ruby',
18
+ 'User-Agent'=>'BaruwaAPI-Ruby',
19
19
  'Authorization'=>'Bearer 6e2347bc-278e-42f6-a84b-fa1766140cbd'}).
20
20
  to_return(:status => 200, :body => "", :headers => {})
21
21
  @baruwapi.get_domainaliases(domainid)
@@ -29,7 +29,7 @@ describe 'Test Domain Aliases' do
29
29
  with(:body => false,
30
30
  :headers => {'Accept'=>'*/*',
31
31
  'Content-Type'=>'application/json',
32
- 'User-Agent'=>'BaruwaAPI/Ruby',
32
+ 'User-Agent'=>'BaruwaAPI-Ruby',
33
33
  'Authorization'=>'Bearer 6e2347bc-278e-42f6-a84b-fa1766140cbd'}).
34
34
  to_return(:status => 200, :body => "", :headers => {})
35
35
  @baruwapi.get_domainalias(domainid, aliasid)
@@ -42,7 +42,7 @@ describe 'Test Domain Aliases' do
42
42
  with(:body => {},
43
43
  :headers => {'Accept'=>'*/*',
44
44
  'Content-Type'=>'application/json',
45
- 'User-Agent'=>'BaruwaAPI/Ruby',
45
+ 'User-Agent'=>'BaruwaAPI-Ruby',
46
46
  'Authorization'=>'Bearer 6e2347bc-278e-42f6-a84b-fa1766140cbd'}).
47
47
  to_return(:status => 200, :body => "", :headers => {})
48
48
  @baruwapi.create_domainalias(domainid, {})
@@ -56,7 +56,7 @@ describe 'Test Domain Aliases' do
56
56
  with(:body => {},
57
57
  :headers => {'Accept'=>'*/*',
58
58
  'Content-Type'=>'application/json',
59
- 'User-Agent'=>'BaruwaAPI/Ruby',
59
+ 'User-Agent'=>'BaruwaAPI-Ruby',
60
60
  'Authorization'=>'Bearer 6e2347bc-278e-42f6-a84b-fa1766140cbd'}).
61
61
  to_return(:status => 200, :body => "", :headers => {})
62
62
  @baruwapi.update_domainalias(domainid, aliasid, {})
@@ -70,7 +70,7 @@ describe 'Test Domain Aliases' do
70
70
  with(:body => {},
71
71
  :headers => {'Accept'=>'*/*',
72
72
  'Content-Type'=>'application/json',
73
- 'User-Agent'=>'BaruwaAPI/Ruby',
73
+ 'User-Agent'=>'BaruwaAPI-Ruby',
74
74
  'Authorization'=>'Bearer 6e2347bc-278e-42f6-a84b-fa1766140cbd'}).
75
75
  to_return(:status => 200, :body => "", :headers => {})
76
76
  @baruwapi.delete_domainalias(domainid, aliasid, {})
@@ -34,7 +34,7 @@ describe 'Test Domains' do
34
34
  with(:body => false,
35
35
  :headers => {'Accept'=>'*/*',
36
36
  'Content-Type'=>'application/json',
37
- 'User-Agent'=>'BaruwaAPI/Ruby',
37
+ 'User-Agent'=>'BaruwaAPI-Ruby',
38
38
  'Authorization'=>'Bearer 6e2347bc-278e-42f6-a84b-fa1766140cbd'}).
39
39
  to_return(:status => 200, :body => "", :headers => {})
40
40
  @baruwapi.get_domains()
@@ -47,7 +47,7 @@ describe 'Test Domains' do
47
47
  with(:body => false,
48
48
  :headers => {'Accept'=>'*/*',
49
49
  'Content-Type'=>'application/json',
50
- 'User-Agent'=>'BaruwaAPI/Ruby',
50
+ 'User-Agent'=>'BaruwaAPI-Ruby',
51
51
  'Authorization'=>'Bearer 6e2347bc-278e-42f6-a84b-fa1766140cbd'}).
52
52
  to_return(:status => 200, :body => "", :headers => {})
53
53
  @baruwapi.get_domain(domainid)
@@ -59,7 +59,7 @@ describe 'Test Domains' do
59
59
  with(:body => @baruwapi.get_params(dom),
60
60
  :headers => {'Accept'=>'*/*',
61
61
  'Content-Type'=>'application/json',
62
- 'User-Agent'=>'BaruwaAPI/Ruby',
62
+ 'User-Agent'=>'BaruwaAPI-Ruby',
63
63
  'Authorization'=>'Bearer 6e2347bc-278e-42f6-a84b-fa1766140cbd'}).
64
64
  to_return(:status => 200, :body => "", :headers => {})
65
65
  @baruwapi.create_domain(dom)
@@ -72,7 +72,7 @@ describe 'Test Domains' do
72
72
  with(:body => @baruwapi.get_params(dom),
73
73
  :headers => {'Accept'=>'*/*',
74
74
  'Content-Type'=>'application/json',
75
- 'User-Agent'=>'BaruwaAPI/Ruby',
75
+ 'User-Agent'=>'BaruwaAPI-Ruby',
76
76
  'Authorization'=>'Bearer 6e2347bc-278e-42f6-a84b-fa1766140cbd'}).
77
77
  to_return(:status => 200, :body => "", :headers => {})
78
78
  @baruwapi.update_domain(domainid, dom)
@@ -85,7 +85,7 @@ describe 'Test Domains' do
85
85
  with(:body => false,
86
86
  :headers => {'Accept'=>'*/*',
87
87
  'Content-Type'=>'application/json',
88
- 'User-Agent'=>'BaruwaAPI/Ruby',
88
+ 'User-Agent'=>'BaruwaAPI-Ruby',
89
89
  'Authorization'=>'Bearer 6e2347bc-278e-42f6-a84b-fa1766140cbd'}).
90
90
  to_return(:status => 200, :body => "", :headers => {})
91
91
  @baruwapi.delete_domain(domainid)
@@ -0,0 +1,23 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Test Exceptions' do
4
+ before do
5
+ @baruwapi = BaruwaAPI.new('https://testbaruwa.com', '6e2347bc-278e-42f6-a84b-fa1766140cbd')
6
+ end
7
+
8
+ it 'should raise an argument error' do
9
+ ENDPOINT = {:name => '/status', :method => :patch}
10
+ expect {@baruwapi.get_request(ENDPOINT, ENDPOINT[:name])}.to raise_error(ArgumentError)
11
+ end
12
+
13
+ it 'should raise an error' do
14
+ stub_request(:get, "https://testbaruwa.com/api/v1/status").
15
+ with(:body => false,
16
+ :headers => {'Accept'=>'*/*',
17
+ 'Content-Type'=>'application/json',
18
+ 'User-Agent'=>'BaruwaAPI-Ruby',
19
+ 'Authorization'=>'Bearer 6e2347bc-278e-42f6-a84b-fa1766140cbd'}).
20
+ to_return(:status => 500, :body => "", :headers => {})
21
+ expect {@baruwapi.get_status()}.to raise_error(StandardError)
22
+ end
23
+ end
@@ -17,7 +17,7 @@ describe 'Test AD/LDAP Settings' do
17
17
  with(:body => false,
18
18
  :headers => {'Accept'=>'*/*',
19
19
  'Content-Type'=>'application/json',
20
- 'User-Agent'=>'BaruwaAPI/Ruby',
20
+ 'User-Agent'=>'BaruwaAPI-Ruby',
21
21
  'Authorization'=>'Bearer 6e2347bc-278e-42f6-a84b-fa1766140cbd'}).
22
22
  to_return(:status => 200, :body => "", :headers => {})
23
23
  @baruwapi.get_ldapsettings(domainid, serverid, settingsid)
@@ -31,7 +31,7 @@ describe 'Test AD/LDAP Settings' do
31
31
  with(:body => {},
32
32
  :headers => {'Accept'=>'*/*',
33
33
  'Content-Type'=>'application/json',
34
- 'User-Agent'=>'BaruwaAPI/Ruby',
34
+ 'User-Agent'=>'BaruwaAPI-Ruby',
35
35
  'Authorization'=>'Bearer 6e2347bc-278e-42f6-a84b-fa1766140cbd'}).
36
36
  to_return(:status => 200, :body => "", :headers => {})
37
37
  @baruwapi.create_ldapsettings(domainid, serverid, {})
@@ -46,7 +46,7 @@ describe 'Test AD/LDAP Settings' do
46
46
  with(:body => {},
47
47
  :headers => {'Accept'=>'*/*',
48
48
  'Content-Type'=>'application/json',
49
- 'User-Agent'=>'BaruwaAPI/Ruby',
49
+ 'User-Agent'=>'BaruwaAPI-Ruby',
50
50
  'Authorization'=>'Bearer 6e2347bc-278e-42f6-a84b-fa1766140cbd'}).
51
51
  to_return(:status => 200, :body => "", :headers => {})
52
52
  @baruwapi.update_ldapsettings(domainid, serverid, settingsid, {})
@@ -61,7 +61,7 @@ describe 'Test AD/LDAP Settings' do
61
61
  with(:body => {},
62
62
  :headers => {'Accept'=>'*/*',
63
63
  'Content-Type'=>'application/json',
64
- 'User-Agent'=>'BaruwaAPI/Ruby',
64
+ 'User-Agent'=>'BaruwaAPI-Ruby',
65
65
  'Authorization'=>'Bearer 6e2347bc-278e-42f6-a84b-fa1766140cbd'}).
66
66
  to_return(:status => 200, :body => "", :headers => {})
67
67
  @baruwapi.delete_ldapsettings(domainid, serverid, settingsid, {})
@@ -14,7 +14,7 @@ describe 'Test Organizations' do
14
14
  with(:body => false,
15
15
  :headers => {'Accept'=>'*/*',
16
16
  'Content-Type'=>'application/json',
17
- 'User-Agent'=>'BaruwaAPI/Ruby',
17
+ 'User-Agent'=>'BaruwaAPI-Ruby',
18
18
  'Authorization'=>'Bearer 6e2347bc-278e-42f6-a84b-fa1766140cbd'}).
19
19
  to_return(:status => 200, :body => "", :headers => {})
20
20
  @baruwapi.get_organizations()
@@ -27,7 +27,7 @@ describe 'Test Organizations' do
27
27
  with(:body => false,
28
28
  :headers => {'Accept'=>'*/*',
29
29
  'Content-Type'=>'application/json',
30
- 'User-Agent'=>'BaruwaAPI/Ruby',
30
+ 'User-Agent'=>'BaruwaAPI-Ruby',
31
31
  'Authorization'=>'Bearer 6e2347bc-278e-42f6-a84b-fa1766140cbd'}).
32
32
  to_return(:status => 200, :body => "", :headers => {})
33
33
  @baruwapi.get_organization(orgid)
@@ -39,7 +39,7 @@ describe 'Test Organizations' do
39
39
  with(:body => {},
40
40
  :headers => {'Accept'=>'*/*',
41
41
  'Content-Type'=>'application/json',
42
- 'User-Agent'=>'BaruwaAPI/Ruby',
42
+ 'User-Agent'=>'BaruwaAPI-Ruby',
43
43
  'Authorization'=>'Bearer 6e2347bc-278e-42f6-a84b-fa1766140cbd'}).
44
44
  to_return(:status => 200, :body => "", :headers => {})
45
45
  @baruwapi.create_organization({})
@@ -52,7 +52,7 @@ describe 'Test Organizations' do
52
52
  with(:body => {},
53
53
  :headers => {'Accept'=>'*/*',
54
54
  'Content-Type'=>'application/json',
55
- 'User-Agent'=>'BaruwaAPI/Ruby',
55
+ 'User-Agent'=>'BaruwaAPI-Ruby',
56
56
  'Authorization'=>'Bearer 6e2347bc-278e-42f6-a84b-fa1766140cbd'}).
57
57
  to_return(:status => 200, :body => "", :headers => {})
58
58
  @baruwapi.update_organization(orgid, {})
@@ -65,7 +65,7 @@ describe 'Test Organizations' do
65
65
  with(:body => false,
66
66
  :headers => {'Accept'=>'*/*',
67
67
  'Content-Type'=>'application/json',
68
- 'User-Agent'=>'BaruwaAPI/Ruby',
68
+ 'User-Agent'=>'BaruwaAPI-Ruby',
69
69
  'Authorization'=>'Bearer 6e2347bc-278e-42f6-a84b-fa1766140cbd'}).
70
70
  to_return(:status => 200, :body => "", :headers => {})
71
71
  @baruwapi.delete_organization(orgid)
@@ -17,7 +17,7 @@ describe 'Test RADIUS Settings' do
17
17
  with(:body => false,
18
18
  :headers => {'Accept'=>'*/*',
19
19
  'Content-Type'=>'application/json',
20
- 'User-Agent'=>'BaruwaAPI/Ruby',
20
+ 'User-Agent'=>'BaruwaAPI-Ruby',
21
21
  'Authorization'=>'Bearer 6e2347bc-278e-42f6-a84b-fa1766140cbd'}).
22
22
  to_return(:status => 200, :body => "", :headers => {})
23
23
  @baruwapi.get_radiussettings(domainid, serverid, settingsid)
@@ -31,7 +31,7 @@ describe 'Test RADIUS Settings' do
31
31
  with(:body => {},
32
32
  :headers => {'Accept'=>'*/*',
33
33
  'Content-Type'=>'application/json',
34
- 'User-Agent'=>'BaruwaAPI/Ruby',
34
+ 'User-Agent'=>'BaruwaAPI-Ruby',
35
35
  'Authorization'=>'Bearer 6e2347bc-278e-42f6-a84b-fa1766140cbd'}).
36
36
  to_return(:status => 200, :body => "", :headers => {})
37
37
  @baruwapi.create_radiussettings(domainid, serverid, {})
@@ -46,7 +46,7 @@ describe 'Test RADIUS Settings' do
46
46
  with(:body => {},
47
47
  :headers => {'Accept'=>'*/*',
48
48
  'Content-Type'=>'application/json',
49
- 'User-Agent'=>'BaruwaAPI/Ruby',
49
+ 'User-Agent'=>'BaruwaAPI-Ruby',
50
50
  'Authorization'=>'Bearer 6e2347bc-278e-42f6-a84b-fa1766140cbd'}).
51
51
  to_return(:status => 200, :body => "", :headers => {})
52
52
  @baruwapi.update_radiussettings(domainid, serverid, settingsid, {})
@@ -61,7 +61,7 @@ describe 'Test RADIUS Settings' do
61
61
  with(:body => {},
62
62
  :headers => {'Accept'=>'*/*',
63
63
  'Content-Type'=>'application/json',
64
- 'User-Agent'=>'BaruwaAPI/Ruby',
64
+ 'User-Agent'=>'BaruwaAPI-Ruby',
65
65
  'Authorization'=>'Bearer 6e2347bc-278e-42f6-a84b-fa1766140cbd'}).
66
66
  to_return(:status => 200, :body => "", :headers => {})
67
67
  @baruwapi.delete_radiussettings(domainid, serverid, settingsid, {})
@@ -15,7 +15,7 @@ describe 'Test Relays' do
15
15
  with(:body => false,
16
16
  :headers => {'Accept'=>'*/*',
17
17
  'Content-Type'=>'application/json',
18
- 'User-Agent'=>'BaruwaAPI/Ruby',
18
+ 'User-Agent'=>'BaruwaAPI-Ruby',
19
19
  'Authorization'=>'Bearer 6e2347bc-278e-42f6-a84b-fa1766140cbd'}).
20
20
  to_return(:status => 200, :body => "", :headers => {})
21
21
  @baruwapi.get_relay(relayid)
@@ -28,7 +28,7 @@ describe 'Test Relays' do
28
28
  with(:body => {},
29
29
  :headers => {'Accept'=>'*/*',
30
30
  'Content-Type'=>'application/json',
31
- 'User-Agent'=>'BaruwaAPI/Ruby',
31
+ 'User-Agent'=>'BaruwaAPI-Ruby',
32
32
  'Authorization'=>'Bearer 6e2347bc-278e-42f6-a84b-fa1766140cbd'}).
33
33
  to_return(:status => 200, :body => "", :headers => {})
34
34
  @baruwapi.create_relay(orgid, {})
@@ -41,7 +41,7 @@ describe 'Test Relays' do
41
41
  with(:body => {},
42
42
  :headers => {'Accept'=>'*/*',
43
43
  'Content-Type'=>'application/json',
44
- 'User-Agent'=>'BaruwaAPI/Ruby',
44
+ 'User-Agent'=>'BaruwaAPI-Ruby',
45
45
  'Authorization'=>'Bearer 6e2347bc-278e-42f6-a84b-fa1766140cbd'}).
46
46
  to_return(:status => 200, :body => "", :headers => {})
47
47
  @baruwapi.update_relay(relayid, {})
@@ -54,7 +54,7 @@ describe 'Test Relays' do
54
54
  with(:body => {},
55
55
  :headers => {'Accept'=>'*/*',
56
56
  'Content-Type'=>'application/json',
57
- 'User-Agent'=>'BaruwaAPI/Ruby',
57
+ 'User-Agent'=>'BaruwaAPI-Ruby',
58
58
  'Authorization'=>'Bearer 6e2347bc-278e-42f6-a84b-fa1766140cbd'}).
59
59
  to_return(:status => 200, :body => "", :headers => {})
60
60
  @baruwapi.delete_relay(relayid, {})
@@ -14,7 +14,7 @@ describe 'Test System Status' do
14
14
  with(:body => false,
15
15
  :headers => {'Accept'=>'*/*',
16
16
  'Content-Type'=>'application/json',
17
- 'User-Agent'=>'BaruwaAPI/Ruby',
17
+ 'User-Agent'=>'BaruwaAPI-Ruby',
18
18
  'Authorization'=>'Bearer 6e2347bc-278e-42f6-a84b-fa1766140cbd'}).
19
19
  to_return(:status => 200, :body => "", :headers => {})
20
20
  @baruwapi.get_status()
@@ -30,7 +30,7 @@ describe 'Test Users' do
30
30
  with(:body => false,
31
31
  :headers => {'Accept'=>'*/*',
32
32
  'Content-Type'=>'application/json',
33
- 'User-Agent'=>'BaruwaAPI/Ruby',
33
+ 'User-Agent'=>'BaruwaAPI-Ruby',
34
34
  'Authorization'=>'Bearer 6e2347bc-278e-42f6-a84b-fa1766140cbd'}).
35
35
  to_return(:status => 200, :body => "", :headers => {})
36
36
  @baruwapi.get_users()
@@ -43,7 +43,7 @@ describe 'Test Users' do
43
43
  with(:body => false,
44
44
  :headers => {'Accept'=>'*/*',
45
45
  'Content-Type'=>'application/json',
46
- 'User-Agent'=>'BaruwaAPI/Ruby',
46
+ 'User-Agent'=>'BaruwaAPI-Ruby',
47
47
  'Authorization'=>'Bearer 6e2347bc-278e-42f6-a84b-fa1766140cbd'}).
48
48
  to_return(:status => 200, :body => "", :headers => {})
49
49
  @baruwapi.get_user(userid)
@@ -55,7 +55,7 @@ describe 'Test Users' do
55
55
  with(:body => @baruwapi.get_params(user),
56
56
  :headers => {'Accept'=>'*/*',
57
57
  'Content-Type'=>'application/json',
58
- 'User-Agent'=>'BaruwaAPI/Ruby',
58
+ 'User-Agent'=>'BaruwaAPI-Ruby',
59
59
  'Authorization'=>'Bearer 6e2347bc-278e-42f6-a84b-fa1766140cbd'}).
60
60
  to_return(:status => 200, :body => "", :headers => {})
61
61
  @baruwapi.create_user(user)
@@ -67,7 +67,7 @@ describe 'Test Users' do
67
67
  with(:body => @baruwapi.get_params(user),
68
68
  :headers => {'Accept'=>'*/*',
69
69
  'Content-Type'=>'application/json',
70
- 'User-Agent'=>'BaruwaAPI/Ruby',
70
+ 'User-Agent'=>'BaruwaAPI-Ruby',
71
71
  'Authorization'=>'Bearer 6e2347bc-278e-42f6-a84b-fa1766140cbd'}).
72
72
  to_return(:status => 200, :body => "", :headers => {})
73
73
  @baruwapi.update_user(user)
@@ -80,7 +80,7 @@ describe 'Test Users' do
80
80
  with(:body => false,
81
81
  :headers => {'Accept'=>'*/*',
82
82
  'Content-Type'=>'application/json',
83
- 'User-Agent'=>'BaruwaAPI/Ruby',
83
+ 'User-Agent'=>'BaruwaAPI-Ruby',
84
84
  'Authorization'=>'Bearer 6e2347bc-278e-42f6-a84b-fa1766140cbd'}).
85
85
  to_return(:status => 200, :body => "", :headers => {})
86
86
  @baruwapi.delete_user(userid)
@@ -95,7 +95,7 @@ describe 'Test Users' do
95
95
  with(:body => @baruwapi.get_params(data),
96
96
  :headers => {'Accept'=>'*/*',
97
97
  'Content-Type'=>'application/json',
98
- 'User-Agent'=>'BaruwaAPI/Ruby',
98
+ 'User-Agent'=>'BaruwaAPI-Ruby',
99
99
  'Authorization'=>'Bearer 6e2347bc-278e-42f6-a84b-fa1766140cbd'}).
100
100
  to_return(:status => 200, :body => "", :headers => {})
101
101
  @baruwapi.set_user_passwd(userid, data)
data/spec/spec_helper.rb CHANGED
@@ -2,6 +2,10 @@ require "codeclimate-test-reporter"
2
2
  CodeClimate::TestReporter.start
3
3
  require 'simplecov'
4
4
  SimpleCov.start
5
+ if ENV['CI']=='true'
6
+ require 'codecov'
7
+ SimpleCov.formatter = SimpleCov::Formatter::Codecov
8
+ end
5
9
  require 'rubygems'
6
10
  require 'json'
7
11
  require 'rspec'
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.1
4
+ version: 0.0.2
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: 2015-10-17 00:00:00.000000000 Z
11
+ date: 2015-11-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -76,6 +76,7 @@ files:
76
76
  - .codeclimate.yml
77
77
  - .gitignore
78
78
  - .rspec
79
+ - .rubocop.yml
79
80
  - .travis.yml
80
81
  - Gemfile
81
82
  - LICENSE
@@ -89,6 +90,7 @@ files:
89
90
  - spec/baruwa_deliveryservers_spec.rb
90
91
  - spec/baruwa_domainalias_spec.rb
91
92
  - spec/baruwa_domains_spec.rb
93
+ - spec/baruwa_incorrect_method_spec.rb
92
94
  - spec/baruwa_ldapsettings_spec.rb
93
95
  - spec/baruwa_organizations_spec.rb
94
96
  - spec/baruwa_radiusettings_spec.rb
@@ -126,6 +128,7 @@ test_files:
126
128
  - spec/baruwa_deliveryservers_spec.rb
127
129
  - spec/baruwa_domainalias_spec.rb
128
130
  - spec/baruwa_domains_spec.rb
131
+ - spec/baruwa_incorrect_method_spec.rb
129
132
  - spec/baruwa_ldapsettings_spec.rb
130
133
  - spec/baruwa_organizations_spec.rb
131
134
  - spec/baruwa_radiusettings_spec.rb