mustard_client 0.1.2 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/MustardClient.rb +50 -31
- data/lib/MustardClient/authenticate.rb +2 -1
- data/lib/MustardClient/client.rb +33 -0
- data/lib/MustardClient/environments.rb +2 -1
- data/lib/MustardClient/executions.rb +2 -1
- data/lib/MustardClient/projects.rb +2 -1
- data/lib/MustardClient/results.rb +2 -1
- data/lib/MustardClient/teams.rb +2 -1
- data/lib/MustardClient/testcases.rb +2 -1
- data/lib/MustardClient/users.rb +2 -1
- data/lib/MustardClient/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: da9e2f0b5a5eb14e43cccd34866597e6a7fcaf1b
|
4
|
+
data.tar.gz: 38fb305fb5556ed576e8a547712e0980ffdd6982
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b3f5d09be3eff571c499572423b92b8dd1701b28635a78d8e9f8416544b050881bab701486277d5390ecf61de0b5584f4fa3dc572f7b56cedd92b12e375a9c2c
|
7
|
+
data.tar.gz: 4387af0338611e86ca7dd880196eafe65358cef6786869a12b197f22452e87f67196417a879d633070d98139e849a15c5d1e1709110b1e9ab933f287bed0ed2e
|
data/lib/MustardClient.rb
CHANGED
@@ -1,44 +1,73 @@
|
|
1
1
|
require "MustardClient/version"
|
2
2
|
require 'rest-client'
|
3
|
+
require 'MustardClient/users'
|
4
|
+
require 'MustardClient/authenticate'
|
5
|
+
require 'MustardClient/projects'
|
6
|
+
require 'MustardClient/testcases'
|
7
|
+
require 'MustardClient/teams'
|
8
|
+
require 'MustardClient/environments'
|
9
|
+
require 'MustardClient/results'
|
10
|
+
require 'MustardClient/executions'
|
11
|
+
require 'json'
|
3
12
|
|
4
13
|
module MustardClient
|
5
14
|
|
6
|
-
class
|
15
|
+
class Mustard
|
7
16
|
|
8
17
|
attr_accessor :mustard_url, :user_token
|
9
18
|
|
10
19
|
@user_token
|
11
20
|
@mustard_url
|
12
21
|
|
13
|
-
def initialize
|
14
|
-
@mustard_url =
|
22
|
+
def initialize(url= 'localhost:8081', token=nil)
|
23
|
+
@mustard_url = url
|
24
|
+
@user_token = token
|
15
25
|
end
|
16
26
|
|
17
27
|
def set_user_token token
|
18
28
|
@user_token = token
|
19
29
|
end
|
20
30
|
|
21
|
-
def
|
22
|
-
|
23
|
-
|
31
|
+
def set_mustard_url url
|
32
|
+
@mustard_url = url
|
33
|
+
end
|
24
34
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
r = RestClient.post command[:route], command[:params], command[:headers]
|
31
|
-
elsif command[:method] == :put
|
32
|
-
r = RestClient.put command[:route], command[:params], command[:headers]
|
33
|
-
elsif command[:method] == :delete
|
34
|
-
r = RestClient.delete command[:route], command[:headers]
|
35
|
-
end
|
36
|
-
rescue RestClient::ExceptionWithResponse => e
|
37
|
-
r =e.response
|
35
|
+
def authenticate(username, password)
|
36
|
+
a = AuthenticateClient.new(@mustard_url, @user_token)
|
37
|
+
r = a.authenticate(username, password)
|
38
|
+
unless r['error']
|
39
|
+
@user_token = r['token']
|
38
40
|
end
|
39
41
|
|
40
|
-
|
41
|
-
|
42
|
+
return r
|
43
|
+
end
|
44
|
+
|
45
|
+
def users
|
46
|
+
UsersClient.new(@mustard_url, @user_token)
|
47
|
+
end
|
48
|
+
|
49
|
+
def projects
|
50
|
+
ProjectsClient.new(@mustard_url, @user_token)
|
51
|
+
end
|
52
|
+
|
53
|
+
def testcases
|
54
|
+
TestcaseClient.new(@mustard_url, @user_token)
|
55
|
+
end
|
56
|
+
|
57
|
+
def teams
|
58
|
+
TeamsClient.new(@mustard_url, @user_token)
|
59
|
+
end
|
60
|
+
|
61
|
+
def envirnments
|
62
|
+
EnvironmentsClient.new(@mustard_url, @user_token)
|
63
|
+
end
|
64
|
+
|
65
|
+
def results
|
66
|
+
ResultsClient.new(@mustard_url, @user_token)
|
67
|
+
end
|
68
|
+
|
69
|
+
def executions
|
70
|
+
ExecutionsClient.new(@mustard_url, @user_token)
|
42
71
|
end
|
43
72
|
|
44
73
|
|
@@ -46,13 +75,3 @@ module MustardClient
|
|
46
75
|
|
47
76
|
|
48
77
|
end
|
49
|
-
|
50
|
-
require 'MustardClient/users'
|
51
|
-
require 'MustardClient/authenticate'
|
52
|
-
require 'MustardClient/projects'
|
53
|
-
require 'MustardClient/testcases'
|
54
|
-
require 'MustardClient/teams'
|
55
|
-
require 'MustardClient/environments'
|
56
|
-
require 'MustardClient/results'
|
57
|
-
require 'MustardClient/executions'
|
58
|
-
require 'json'
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module MustardClient
|
2
|
+
class Client
|
3
|
+
|
4
|
+
def initialize(url= nil, token=nil)
|
5
|
+
@mustard_url = url
|
6
|
+
@user_token = token
|
7
|
+
end
|
8
|
+
|
9
|
+
def execute(command)
|
10
|
+
|
11
|
+
raise Exception if command[:method].nil? || command[:route].nil?
|
12
|
+
|
13
|
+
#Suppress errors that return a response
|
14
|
+
begin
|
15
|
+
if command[:method] == :get
|
16
|
+
r = RestClient.get command[:route], command[:headers]
|
17
|
+
elsif command[:method] == :post
|
18
|
+
r = RestClient.post command[:route], command[:params], command[:headers]
|
19
|
+
elsif command[:method] == :put
|
20
|
+
r = RestClient.put command[:route], command[:params], command[:headers]
|
21
|
+
elsif command[:method] == :delete
|
22
|
+
r = RestClient.delete command[:route], command[:headers]
|
23
|
+
end
|
24
|
+
rescue RestClient::ExceptionWithResponse => e
|
25
|
+
r =e.response
|
26
|
+
end
|
27
|
+
|
28
|
+
JSON.parse(r)
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
data/lib/MustardClient/teams.rb
CHANGED
data/lib/MustardClient/users.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mustard_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Watson
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-09-
|
11
|
+
date: 2016-09-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -51,6 +51,7 @@ files:
|
|
51
51
|
- bin/setup
|
52
52
|
- lib/MustardClient.rb
|
53
53
|
- lib/MustardClient/authenticate.rb
|
54
|
+
- lib/MustardClient/client.rb
|
54
55
|
- lib/MustardClient/environments.rb
|
55
56
|
- lib/MustardClient/executions.rb
|
56
57
|
- lib/MustardClient/projects.rb
|