zephyr_ruby 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: ab2c9cf5c2090d39581ded7976db96f025eadf08cc8a33942874718006b3a9ed
4
+ data.tar.gz: b6819d1e26fab13612a43e494df417ee950986838145eb95a1124120ba057434
5
+ SHA512:
6
+ metadata.gz: 31bf85295413059989b186f46b8162bc77813b8f9b05bd54ec425e730240d1c7e935f781266828c4e759baaea9baed69ea34ffc0f47f7863c3206b501991558a
7
+ data.tar.gz: 46987d8457bb115a7ec239b1da56ced4bcd2150f676d33fb878b8fe44362ff01e21193ac0f5589329086ebce124a84efb994a8c3edd58558dfc5469699193831
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2022-11-24
4
+
5
+ - Initial release
data/Gemfile ADDED
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ # Specify your gem's dependencies in zephyr_ruby.gemspec
6
+ gemspec
7
+
8
+ gem 'rake', '~> 13.0'
9
+ gem 'rubocop'
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2022 Chris Davis
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,42 @@
1
+ # ZephyrRuby
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/zephyr_ruby`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ ## Installation
6
+
7
+ Install the gem and add to the application's Gemfile by executing:
8
+
9
+ $ bundle add zephyr_ruby
10
+
11
+ If bundler is not being used to manage dependencies, install the gem by executing:
12
+
13
+ $ gem install zephyr_ruby
14
+
15
+ ## Usage
16
+
17
+ This gem provides access to the Zephyr Scale REST API.
18
+
19
+ ```ruby
20
+ require 'zephyr_ruby'
21
+
22
+ @client = ZephyrRuby::Client.new('YOUR_API_KEY')
23
+
24
+ puts @client.list_test_cases
25
+ ```
26
+
27
+ ## Links to Zephyr Scale REST API Documentation
28
+ - [Overview](https://support.smartbear.com/zephyr-scale-cloud/api-docs/#section/Introduction)
29
+
30
+ ## Development
31
+
32
+ After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
33
+
34
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
35
+
36
+ ## Contributing
37
+
38
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/zephyr_ruby.
39
+
40
+ ## License
41
+
42
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ task default: %i[]
@@ -0,0 +1,60 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'resource/automations'
4
+ require_relative 'resource/environments'
5
+ require_relative 'resource/folders'
6
+ require_relative 'resource/healthcheck'
7
+ require_relative 'resource/links'
8
+ require_relative 'resource/priorities'
9
+ require_relative 'resource/projects'
10
+ require_relative 'resource/statuses'
11
+ require_relative 'resource/test_cases'
12
+ require_relative 'resource/test_cycles'
13
+ require_relative 'resource/test_executions'
14
+ require_relative 'resource/test_plans'
15
+ require_relative 'connection'
16
+
17
+ require 'faraday'
18
+ require 'json'
19
+
20
+ module ZephyrRuby
21
+ # Client provides methods for interacting with all zephyr scale endpoints
22
+ class Client
23
+ include ZephyrRuby::Client::Resource::Automations
24
+ include ZephyrRuby::Client::Resource::Environments
25
+ include ZephyrRuby::Client::Resource::Folders
26
+ include ZephyrRuby::Client::Resource::HealthCheck
27
+ include ZephyrRuby::Client::Resource::Links
28
+ include ZephyrRuby::Client::Resource::Priorities
29
+ include ZephyrRuby::Client::Resource::Projects
30
+ include ZephyrRuby::Client::Resource::Statuses
31
+ include ZephyrRuby::Client::Resource::TestCases
32
+ include ZephyrRuby::Client::Resource::TestCycles
33
+ include ZephyrRuby::Client::Resource::TestExecutions
34
+ include ZephyrRuby::Client::Resource::TestPlans
35
+ include ZephyrRuby::Connection
36
+
37
+ def initialize(api_token)
38
+ @base_url = 'https://api.zephyrscale.smartbear.com/v2'
39
+ @api_token = api_token
40
+ @client = Faraday.new(@base_url, builder: build_middleware)
41
+ @headers = {
42
+ 'Authorization' => "Bearer #{@api_token}",
43
+ 'Content-Type' => 'application/json'
44
+ }
45
+ end
46
+
47
+ attr_reader :base_url
48
+
49
+ def request(method, path, params, headers = @headers)
50
+ path = URI.parse("#{@base_url}#{path}").normalize.to_s
51
+ @client.send(method, path, params, headers)
52
+ end
53
+
54
+ def build_middleware
55
+ Faraday::RackBuilder.new do |builder|
56
+ builder.response :json
57
+ end
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ZephyrRuby
4
+ # Connection provides the base functionality for interacting with APIs using
5
+ # get, post, put, and delete operations.
6
+ module Connection
7
+ def get(path, params = {})
8
+ request :get, path, params
9
+ end
10
+
11
+ def post(path, body)
12
+ body = body.to_json if body.is_a?(Hash)
13
+ request :post, path, body
14
+ end
15
+
16
+ def put(path, body)
17
+ body = body.to_json if body.is_a?(Hash)
18
+ request :put, path, body
19
+ end
20
+
21
+ def delete(path, params = {})
22
+ request :delete, path, params
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ZephyrRuby
4
+ class Client
5
+ module Resource
6
+ # Operations related to Automations
7
+ module Automations
8
+ def create_automation_custom(body)
9
+ post '/automations/executions/custom', body
10
+ end
11
+
12
+ def create_automation_cucumber(body)
13
+ post '/automations/executions/cucumber', body
14
+ end
15
+
16
+ def create_automation_junit(body)
17
+ post '/automations/executions/junit', body
18
+ end
19
+
20
+ def get_zip_file(params = {})
21
+ get '/automations/testcases', params
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ZephyrRuby
4
+ class Client
5
+ module Resource
6
+ # Operations related to Environments
7
+ module Environments
8
+ def list_environments(params = {})
9
+ get '/environments', params
10
+ end
11
+
12
+ def get_environment(environment_id)
13
+ get "/environments/#{environment_id}"
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ZephyrRuby
4
+ class Client
5
+ module Resource
6
+ # Operations related to Folders
7
+ module Folders
8
+ def create_folder(body)
9
+ post '/folders', body
10
+ end
11
+
12
+ def get_folder(folder_id)
13
+ get "/folders/#{folder_id}"
14
+ end
15
+
16
+ def list_folders(params = {})
17
+ get '/folders', params
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ZephyrRuby
4
+ class Client
5
+ module Resource
6
+ # Operations related to API Health
7
+ module HealthCheck
8
+ def healthcheck_status
9
+ get '/healthcheck'
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ZephyrRuby
4
+ class Client
5
+ module Resource
6
+ # Operations related to Issue Links
7
+ module IssueLinks
8
+ def get_issuelinks_testplans(issue_key)
9
+ get "/issuelinks/#{issue_key}/testplans"
10
+ end
11
+
12
+ def get_issuelinks_testcases(issue_key)
13
+ get "/issuelinks/#{issue_key}/testcases"
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ZephyrRuby
4
+ class Client
5
+ module Resource
6
+ # Operations related to Links
7
+ module Links
8
+ def delete_link(link_id)
9
+ delete "/links/#{link_id}"
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ZephyrRuby
4
+ class Client
5
+ module Resource
6
+ # Operations related to Priorities
7
+ module Priorities
8
+ def list_priorities(params = {})
9
+ get '/priorities', params
10
+ end
11
+
12
+ def create_priority(body)
13
+ post '/priorities', body
14
+ end
15
+
16
+ def get_priority(priority_id)
17
+ get "/priorities/#{priority_id}"
18
+ end
19
+
20
+ def update_priority(priority_id, params = {})
21
+ put "/priorities/#{priority_id}", params
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ZephyrRuby
4
+ class Client
5
+ module Resource
6
+ # Operations related to Projects
7
+ module Projects
8
+ def list_projects(params = {})
9
+ get '/projects', params
10
+ end
11
+
12
+ def get_project(project_id)
13
+ get "/projects/#{project_id}"
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ZephyrRuby
4
+ class Client
5
+ module Resource
6
+ # Operations related to Statuses
7
+ module Statuses
8
+ def list_statuses(params = {})
9
+ get '/statuses', params
10
+ end
11
+
12
+ def create_status(body)
13
+ post '/statuses', body
14
+ end
15
+
16
+ def get_status(status_id)
17
+ get "/statuses/#{status_id}"
18
+ end
19
+
20
+ def update_status(status_id, params = {})
21
+ put "/statuses/#{status_id}", params
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,62 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ZephyrRuby
4
+ class Client
5
+ module Resource
6
+ # Operations related to Test Cases
7
+ module TestCases
8
+ def create_testcase(body)
9
+ post '/testcases', body
10
+ end
11
+
12
+ def list_testcases(params = {})
13
+ get '/testcases', params
14
+ end
15
+
16
+ def get_testcase(testcase_key)
17
+ get "/testcases/#{testcase_key}"
18
+ end
19
+
20
+ def update_testcase(testcase_key, params = {})
21
+ put "/testcases/#{testcase_key}", params
22
+ end
23
+
24
+ def get_testcase_links(testcase_key)
25
+ get "/testcases/#{testcase_key}/links"
26
+ end
27
+
28
+ def create_testcase_issue_link(testcase_key, body)
29
+ post "/testcases/#{testcase_key}/links/issues", body
30
+ end
31
+
32
+ def create_testcase_web_link(testcase_key, body)
33
+ post "/testcases/#{testcase_key}/links/weblinks", body
34
+ end
35
+
36
+ def list_testcase_versions(testcase_key, params = {})
37
+ get "/testcases/#{testcase_key}/versions", params
38
+ end
39
+
40
+ def get_testcase_version(testcase_key)
41
+ get "/testcases/#{testcase_key}/version"
42
+ end
43
+
44
+ def get_testcase_testscript(testcase_key)
45
+ get "/testcases/#{testcase_key}/testscript"
46
+ end
47
+
48
+ def create_testcase_testscript(testcase_key, body)
49
+ post "/testcases/#{testcase_key}/testscript", body
50
+ end
51
+
52
+ def get_testcase_teststeps(testcase_key, params = {})
53
+ get "/testcases/#{testcase_key}/teststeps", params
54
+ end
55
+
56
+ def create_testcase_teststeps(testcase_key, body)
57
+ post "/testcases/#{testcase_key}/teststeps", body
58
+ end
59
+ end
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ZephyrRuby
4
+ class Client
5
+ module Resource
6
+ # Operations related to Test Cycles
7
+ module TestCycles
8
+ def create_testcycle(body)
9
+ post '/testcycles', body
10
+ end
11
+
12
+ def get_testcycle(testcycle_id)
13
+ get "/testcycles/#{testcycle_id}"
14
+ end
15
+
16
+ def update_testcycle(testcycle_id, params = {})
17
+ put "/testcycles/#{testcycle_id}", params
18
+ end
19
+
20
+ def list_testcycles(params = {})
21
+ get '/testcycles', params
22
+ end
23
+
24
+ def get_testcycle_links(testcycle_id)
25
+ get "/testcycles/#{testcycle_id}/links"
26
+ end
27
+
28
+ def create_testcycle_issue_link(testcycle_id, body)
29
+ post "/testcycles/#{testcycle_id}/links/issues", body
30
+ end
31
+
32
+ def create_testcycle_web_link(testcycle_id, body)
33
+ post "/testcycles/#{testcycle_id}/links/weblinks", body
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ZephyrRuby
4
+ class Client
5
+ module Resource
6
+ # Operations related to Test Executions
7
+ module TestExecutions
8
+ def create_test_execution(body)
9
+ post '/testexecutions', body
10
+ end
11
+
12
+ def list_test_executions(params = {})
13
+ get '/testexecutions', params
14
+ end
15
+
16
+ def get_test_execution(test_execution_id, params = {})
17
+ get "/testexecutions/#{test_execution_id}", params
18
+ end
19
+
20
+ def get_test_execution_links(test_execution_id)
21
+ get "/testexecutions/#{test_execution_id}/links"
22
+ end
23
+
24
+ def create_test_execution_link(test_execution_id, body)
25
+ post "/testexecutions/#{test_execution_id}/links/issues", body
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ZephyrRuby
4
+ class Client
5
+ module Resource
6
+ # Operations related to Test Plans
7
+ module TestPlans
8
+ def create_testplan(body)
9
+ post '/testplans', body
10
+ end
11
+
12
+ def get_testplan(testplan_id)
13
+ get "/testplans/#{testplan_id}"
14
+ end
15
+
16
+ def list_testplans(params = {})
17
+ get '/testplans', params
18
+ end
19
+
20
+ def create_testplan_weblink(testplan_id, body)
21
+ post "/testplans/#{testplan_id}/links/weblinks", body
22
+ end
23
+
24
+ def create_testplan_issuelink(testplan_id, body)
25
+ post "/testplans/#{testplan_id}/links/issuelink", body
26
+ end
27
+
28
+ def create_testplan_testcycle_link(testplan_id, body)
29
+ post "/testplans/#{testplan_id}/links/testcycles", body
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ZephyrRuby
4
+ VERSION = '0.1.0'
5
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'zephyr_ruby/client'
4
+ require_relative 'zephyr_ruby/version'
5
+
6
+ module ZephyrRuby
7
+ class Error < StandardError; end
8
+ end
@@ -0,0 +1,4 @@
1
+ module ZephyrRuby
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
metadata ADDED
@@ -0,0 +1,125 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: zephyr_ruby
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Chris Davis
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2022-11-26 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: faraday
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.7'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 2.7.0
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '2.7'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 2.7.0
33
+ - !ruby/object:Gem::Dependency
34
+ name: json
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '2.3'
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: 2.3.0
43
+ type: :runtime
44
+ prerelease: false
45
+ version_requirements: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - "~>"
48
+ - !ruby/object:Gem::Version
49
+ version: '2.3'
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: 2.3.0
53
+ - !ruby/object:Gem::Dependency
54
+ name: rspec
55
+ requirement: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - "~>"
58
+ - !ruby/object:Gem::Version
59
+ version: '3.7'
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: 3.7.0
63
+ type: :runtime
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: '3.7'
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ version: 3.7.0
73
+ description: Allows users to use Zephyr's REST API
74
+ email:
75
+ executables: []
76
+ extensions: []
77
+ extra_rdoc_files: []
78
+ files:
79
+ - CHANGELOG.md
80
+ - Gemfile
81
+ - LICENSE.txt
82
+ - README.md
83
+ - Rakefile
84
+ - lib/zephyr_ruby.rb
85
+ - lib/zephyr_ruby/client.rb
86
+ - lib/zephyr_ruby/connection.rb
87
+ - lib/zephyr_ruby/resource/automations.rb
88
+ - lib/zephyr_ruby/resource/environments.rb
89
+ - lib/zephyr_ruby/resource/folders.rb
90
+ - lib/zephyr_ruby/resource/healthcheck.rb
91
+ - lib/zephyr_ruby/resource/issue_links.rb
92
+ - lib/zephyr_ruby/resource/links.rb
93
+ - lib/zephyr_ruby/resource/priorities.rb
94
+ - lib/zephyr_ruby/resource/projects.rb
95
+ - lib/zephyr_ruby/resource/statuses.rb
96
+ - lib/zephyr_ruby/resource/test_cases.rb
97
+ - lib/zephyr_ruby/resource/test_cycles.rb
98
+ - lib/zephyr_ruby/resource/test_executions.rb
99
+ - lib/zephyr_ruby/resource/test_plans.rb
100
+ - lib/zephyr_ruby/version.rb
101
+ - sig/zephyr_ruby.rbs
102
+ homepage: https://github.com/chrisdavis180/zephyr_ruby
103
+ licenses:
104
+ - MIT
105
+ metadata: {}
106
+ post_install_message:
107
+ rdoc_options: []
108
+ require_paths:
109
+ - lib
110
+ required_ruby_version: !ruby/object:Gem::Requirement
111
+ requirements:
112
+ - - ">="
113
+ - !ruby/object:Gem::Version
114
+ version: 2.6.0
115
+ required_rubygems_version: !ruby/object:Gem::Requirement
116
+ requirements:
117
+ - - ">="
118
+ - !ruby/object:Gem::Version
119
+ version: '0'
120
+ requirements: []
121
+ rubygems_version: 3.2.33
122
+ signing_key:
123
+ specification_version: 4
124
+ summary: Zephyr REST API Client for Ruby
125
+ test_files: []