mustard_client 0.1.1

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 4e630e2e0f7ebc608ca5125eb734962687a9a37e
4
+ data.tar.gz: 3d01de679814dbbe1fc36cab918b6967a2b766ca
5
+ SHA512:
6
+ metadata.gz: 3ce626f41d1dd19e205f3fb7ee70c27bc589e70e14cd848ae46e8cc01decec02e042e2987664daacdd1b9c140c29217cc96b8a42933a4059d8fcca4fb21f2a79
7
+ data.tar.gz: fb2e99f5fdae3ffdc1fd4678b0c9ad0e86f83da4cb81999f1bea6dca7fea572fe1e2cd595d85b953edd8bccf07eff6ad55153487172298b3a3d0488d00c1bf87
data/LICENSE ADDED
@@ -0,0 +1,27 @@
1
+ Copyright (c) 2016, Orasi Software
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without
5
+ modification, are permitted provided that the following conditions are met:
6
+ 1. Redistributions of source code must retain the above copyright
7
+ notice, this list of conditions and the following disclaimer.
8
+ 2. Redistributions in binary form must reproduce the above copyright
9
+ notice, this list of conditions and the following disclaimer in the
10
+ documentation and/or other materials provided with the distribution.
11
+ 3. All advertising materials mentioning features or use of this software
12
+ must display the following acknowledgement:
13
+ This product includes software developed by the <organization>.
14
+ 4. Neither the name of the <organization> nor the
15
+ names of its contributors may be used to endorse or promote products
16
+ derived from this software without specific prior written permission.
17
+
18
+ THIS SOFTWARE IS PROVIDED BY ORASI SOFTWARE ''AS IS'' AND ANY
19
+ EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21
+ DISCLAIMED. IN NO EVENT SHALL ORASI SOFTWARE BE LIABLE FOR ANY
22
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
data/README.md ADDED
@@ -0,0 +1,33 @@
1
+ # MustardClient
2
+
3
+ TODO
4
+
5
+ # Orasi Software Inc
6
+ Orasi is a software and professional services company focused on software quality testing and management. As an organization, we are dedicated to best-in-class QA tools, practices and processes. We are agile and drive continuous improvement with our customers and within our own business.
7
+
8
+ # License
9
+ Licensed under [BSD License](/LICENSE)
10
+
11
+ ## Installation
12
+
13
+ Add this line to your application's Gemfile:
14
+
15
+ ```ruby
16
+ gem 'mustard_client'
17
+ ```
18
+
19
+ And then execute:
20
+
21
+ $ bundle
22
+
23
+ Or install it yourself as:
24
+
25
+ $ gem install mustard_client
26
+
27
+ ## Usage
28
+ TODO
29
+
30
+ ## Contributing
31
+
32
+ Bug reports and pull requests are welcome on GitHub at https://github.com/Orasi/Mustard-Ruby. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
33
+
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "MustardClient"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,15 @@
1
+ module MustardClient
2
+ class Authenticate < MustardClient
3
+
4
+ def authenticate(username, password)
5
+
6
+ command = {}
7
+ command[:method] = :post
8
+ command[:route] = @mustard_url + '/authenticate'
9
+ command[:params] = {username: username, password: password}
10
+
11
+ execute(command)
12
+
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,51 @@
1
+ module MustardClient
2
+ class Environments < MustardClient
3
+
4
+ def find environment_id
5
+
6
+ command = {}
7
+ command[:method] = :get
8
+ command[:route] = @mustard_url + "/environments/#{environment_id}"
9
+ command[:headers] = {'User-Token' => @user_token}
10
+
11
+ execute(command)
12
+
13
+ end
14
+
15
+ def add environment_params
16
+
17
+ command = {}
18
+ command[:method] = :post
19
+ command[:route] = @mustard_url + "/environments"
20
+ command[:params] = {environment: environment_params}
21
+ command[:headers] = {'User-Token' => @user_token}
22
+
23
+ execute(command)
24
+
25
+ end
26
+
27
+ def delete environment_id
28
+
29
+ command = {}
30
+ command[:method] = :delete
31
+ command[:route] = @mustard_url + "/environments/#{environment_id}"
32
+ command[:headers] = {'User-Token' => @user_token}
33
+
34
+ execute(command)
35
+
36
+ end
37
+
38
+ def update environment_id, environment_params
39
+
40
+ command = {}
41
+ command[:method] = :put
42
+ command[:route] = @mustard_url + "/environments/#{environment_id}"
43
+ command[:headers] = {'User-Token' => @user_token}
44
+ command[:params] = {environment: environment_params}
45
+
46
+ execute(command)
47
+
48
+ end
49
+
50
+ end
51
+ end
@@ -0,0 +1,38 @@
1
+ module MustardClient
2
+ class Executions < MustardClient
3
+
4
+ def find execution_id
5
+
6
+ command = {}
7
+ command[:method] = :get
8
+ command[:route] = @mustard_url + "/executions/#{execution_id}"
9
+ command[:headers] = {'User-Token' => @user_token}
10
+
11
+ execute(command)
12
+
13
+ end
14
+
15
+ def close execution_id
16
+
17
+ command = {}
18
+ command[:method] = :post
19
+ command[:route] = @mustard_url + "/executions/#{execution_id}"
20
+ command[:headers] = {'User-Token' => @user_token}
21
+
22
+ execute(command)
23
+
24
+ end
25
+
26
+ def delete execution_id
27
+
28
+ command = {}
29
+ command[:method] = :delete
30
+ command[:route] = @mustard_url + "/executions/#{execution_id}"
31
+ command[:headers] = {'User-Token' => @user_token}
32
+
33
+ execute(command)
34
+
35
+ end
36
+
37
+ end
38
+ end
@@ -0,0 +1,61 @@
1
+ module MustardClient
2
+ class Projects < MustardClient
3
+
4
+ def all
5
+
6
+ command = {}
7
+ command[:method] = :get
8
+ command[:route] = @mustard_url + '/projects'
9
+ command[:headers] = {'User-Token' => @user_token}
10
+
11
+ execute(command)
12
+
13
+ end
14
+
15
+ def find project_id
16
+
17
+ command = {}
18
+ command[:method] = :get
19
+ command[:route] = @mustard_url + "/projects/#{project_id}"
20
+ command[:headers] = {'User-Token' => @user_token}
21
+
22
+ execute(command)
23
+
24
+ end
25
+
26
+ def add project_params
27
+
28
+ command = {}
29
+ command[:method] = :post
30
+ command[:route] = @mustard_url + "/projects"
31
+ command[:params] = {project: project_params}
32
+ command[:headers] = {'User-Token' => @user_token}
33
+
34
+ execute(command)
35
+
36
+ end
37
+
38
+ def delete project_id
39
+
40
+ command = {}
41
+ command[:method] = :delete
42
+ command[:route] = @mustard_url + "/projects/#{project_id}"
43
+ command[:headers] = {'User-Token' => @user_token}
44
+
45
+ execute(command)
46
+
47
+ end
48
+
49
+ def update project_id, project_params
50
+
51
+ command = {}
52
+ command[:method] = :put
53
+ command[:route] = @mustard_url + "/projects/#{project_id}"
54
+ command[:headers] = {'User-Token' => @user_token}
55
+ command[:params] = {project: project_params}
56
+
57
+ execute(command)
58
+
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,28 @@
1
+ module MustardClient
2
+ class Results < MustardClient
3
+
4
+ def find result_id
5
+
6
+ command = {}
7
+ command[:method] = :get
8
+ command[:route] = @mustard_url + "/results/#{result_id}"
9
+ command[:headers] = {'User-Token' => @user_token}
10
+
11
+ execute(command)
12
+
13
+ end
14
+
15
+ def add result_params
16
+
17
+ command = {}
18
+ command[:method] = :post
19
+ command[:route] = @mustard_url + "/results"
20
+ command[:params] = {result: result_params}
21
+ command[:headers] = {'User-Token' => @user_token}
22
+
23
+ execute(command)
24
+
25
+ end
26
+
27
+ end
28
+ end
@@ -0,0 +1,106 @@
1
+ module MustardClient
2
+ class Teams < MustardClient
3
+
4
+ def all
5
+
6
+ command = {}
7
+ command[:method] = :get
8
+ command[:route] = @mustard_url + '/teams'
9
+ command[:headers] = {'User-Token' => @user_token}
10
+
11
+ execute(command)
12
+
13
+ end
14
+
15
+ def find team_id
16
+
17
+ command = {}
18
+ command[:method] = :get
19
+ command[:route] = @mustard_url + "/teams/#{team_id}"
20
+ command[:headers] = {'User-Token' => @user_token}
21
+
22
+ execute(command)
23
+
24
+ end
25
+
26
+ def add team_params
27
+
28
+ command = {}
29
+ command[:method] = :post
30
+ command[:route] = @mustard_url + "/teams"
31
+ command[:params] = {team: team_params}
32
+ command[:headers] = {'User-Token' => @user_token}
33
+
34
+ execute(command)
35
+
36
+ end
37
+
38
+ def delete team_id
39
+
40
+ command = {}
41
+ command[:method] = :delete
42
+ command[:route] = @mustard_url + "/teams/#{team_id}"
43
+ command[:headers] = {'User-Token' => @user_token}
44
+
45
+ execute(command)
46
+
47
+ end
48
+
49
+ def update team_id, team_params
50
+
51
+ command = {}
52
+ command[:method] = :put
53
+ command[:route] = @mustard_url + "/teams/#{team_id}"
54
+ command[:headers] = {'User-Token' => @user_token}
55
+ command[:params] = {team: team_params}
56
+
57
+ execute(command)
58
+
59
+ end
60
+
61
+ def add_user team_id, user_id
62
+
63
+ command = {}
64
+ command[:method] = :post
65
+ command[:route] = @mustard_url + "/teams/#{team_id}/user/#{ user_id }"
66
+ command[:headers] = {'User-Token' => @user_token}
67
+
68
+ execute(command)
69
+
70
+ end
71
+
72
+ def add_project team_id, project_id
73
+
74
+ command = {}
75
+ command[:method] = :post
76
+ command[:route] = @mustard_url + "/teams/#{team_id}/project/#{ project_id }"
77
+ command[:headers] = {'User-Token' => @user_token}
78
+
79
+ execute(command)
80
+
81
+ end
82
+
83
+ def remove_user team_id, user_id
84
+
85
+ command = {}
86
+ command[:method] = :delete
87
+ command[:route] = @mustard_url + "/teams/#{team_id}/user/#{ user_id }"
88
+ command[:headers] = {'User-Token' => @user_token}
89
+
90
+ execute(command)
91
+
92
+ end
93
+
94
+ def remove_project team_id, project_id
95
+
96
+ command = {}
97
+ command[:method] = :delete
98
+ command[:route] = @mustard_url + "/teams/#{team_id}/project/#{ project_id }"
99
+ command[:headers] = {'User-Token' => @user_token}
100
+
101
+ execute(command)
102
+
103
+ end
104
+
105
+ end
106
+ end
@@ -0,0 +1,62 @@
1
+ module MustardClient
2
+ class Testcases < MustardClient
3
+
4
+ def find testcase_id
5
+
6
+ command = {}
7
+ command[:method] = :get
8
+ command[:route] = @mustard_url + "/testcases/#{testcase_id}"
9
+ command[:headers] = {'User-Token' => @user_token}
10
+
11
+ execute(command)
12
+
13
+ end
14
+
15
+ def add testcase_params
16
+
17
+ command = {}
18
+ command[:method] = :post
19
+ command[:route] = @mustard_url + "/testcases"
20
+ command[:params] = {testcase: testcase_params}
21
+ command[:headers] = {'User-Token' => @user_token}
22
+
23
+ execute(command)
24
+
25
+ end
26
+
27
+ def delete testcase_id
28
+
29
+ command = {}
30
+ command[:method] = :delete
31
+ command[:route] = @mustard_url + "/testcases/#{testcase_id}"
32
+ command[:headers] = {'User-Token' => @user_token}
33
+
34
+ execute(command)
35
+
36
+ end
37
+
38
+ def update testcase_id, testcase_params
39
+
40
+ command = {}
41
+ command[:method] = :put
42
+ command[:route] = @mustard_url + "/testcases/#{testcase_id}"
43
+ command[:headers] = {'User-Token' => @user_token}
44
+ command[:params] = {testcase: testcase_params}
45
+
46
+ execute(command)
47
+
48
+ end
49
+
50
+ def import project_id, testcase_params, preview: false
51
+
52
+ command = {}
53
+ command[:method] = :post
54
+ command[:route] = @mustard_url + "/projects/#{project_id}/import"
55
+ command[:headers] = {'User-Token' => @user_token}
56
+ command[:params] = {preview: preview, csv: testcase_params}
57
+
58
+ execute(command)
59
+
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,61 @@
1
+ module MustardClient
2
+ class Users < MustardClient
3
+
4
+ def all
5
+
6
+ command = {}
7
+ command[:method] = :get
8
+ command[:route] = @mustard_url + '/users'
9
+ command[:headers] = {'User-Token' => @user_token}
10
+
11
+ execute(command)
12
+
13
+ end
14
+
15
+ def find user_id
16
+
17
+ command = {}
18
+ command[:method] = :get
19
+ command[:route] = @mustard_url + "/users/#{user_id}"
20
+ command[:headers] = {'User-Token' => @user_token}
21
+
22
+ execute(command)
23
+
24
+ end
25
+
26
+ def add user_params
27
+
28
+ command = {}
29
+ command[:method] = :post
30
+ command[:route] = @mustard_url + "/users"
31
+ command[:params] = {user: user_params}
32
+ command[:headers] = {'User-Token' => @user_token}
33
+
34
+ execute(command)
35
+
36
+ end
37
+
38
+ def delete user_id
39
+
40
+ command = {}
41
+ command[:method] = :delete
42
+ command[:route] = @mustard_url + "/users/#{user_id}"
43
+ command[:headers] = {'User-Token' => @user_token}
44
+
45
+ execute(command)
46
+
47
+ end
48
+
49
+ def update user_id, user_params
50
+
51
+ command = {}
52
+ command[:method] = :put
53
+ command[:route] = @mustard_url + "/users/#{user_id}"
54
+ command[:headers] = {'User-Token' => @user_token}
55
+ command[:params] = {user: user_params}
56
+
57
+ execute(command)
58
+
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,3 @@
1
+ module MustardClient
2
+ VERSION = "0.1.1"
3
+ end
@@ -0,0 +1,58 @@
1
+ require "MustardClient/version"
2
+ require 'rest-client'
3
+
4
+ module MustardClient
5
+
6
+ class MustardClient
7
+
8
+ attr_accessor :mustard_url, :user_token
9
+
10
+ @user_token
11
+ @mustard_url
12
+
13
+ def initialize
14
+ @mustard_url = 'localhost:8081'
15
+ end
16
+
17
+ def set_user_token token
18
+ @user_token = token
19
+ end
20
+
21
+ def execute(command)
22
+
23
+ raise Exception if command[:method].nil? || command[:route].nil?
24
+
25
+ #Suppress errors that return a response
26
+ begin
27
+ if command[:method] == :get
28
+ r = RestClient.get command[:route], command[:headers]
29
+ elsif command[:method] == :post
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
38
+ end
39
+
40
+ JSON.parse(r)
41
+ #end
42
+ end
43
+
44
+
45
+ end
46
+
47
+
48
+ 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'
metadata ADDED
@@ -0,0 +1,86 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mustard_client
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - Matt Watson
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-09-23 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.12'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.12'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ description: Ruby Client for Mustard Results Server
42
+ email:
43
+ - matt.watson@orasi.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - LICENSE
49
+ - README.md
50
+ - bin/console
51
+ - bin/setup
52
+ - lib/MustardClient.rb
53
+ - lib/MustardClient/authenticate.rb
54
+ - lib/MustardClient/environments.rb
55
+ - lib/MustardClient/executions.rb
56
+ - lib/MustardClient/projects.rb
57
+ - lib/MustardClient/results.rb
58
+ - lib/MustardClient/teams.rb
59
+ - lib/MustardClient/testcases.rb
60
+ - lib/MustardClient/users.rb
61
+ - lib/MustardClient/version.rb
62
+ homepage: https://github.com/Orasi/Mustard-Ruby
63
+ licenses:
64
+ - BSD
65
+ metadata: {}
66
+ post_install_message:
67
+ rdoc_options: []
68
+ require_paths:
69
+ - lib
70
+ required_ruby_version: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ required_rubygems_version: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ version: '0'
80
+ requirements: []
81
+ rubyforge_project:
82
+ rubygems_version: 2.4.6
83
+ signing_key:
84
+ specification_version: 4
85
+ summary: Ruby Client for Mustard Results Server
86
+ test_files: []