drone-ci 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/gem-push.yml +1 -0
- data/.gitignore +1 -0
- data/CHANGELOG.md +17 -0
- data/drone-ci.gemspec +3 -3
- data/lib/drone-ci/api/builds.rb +58 -13
- data/lib/drone-ci/api/cron.rb +30 -6
- data/lib/drone-ci/api/repos.rb +47 -13
- data/lib/drone-ci/api/secrets.rb +25 -5
- data/lib/drone-ci/api/templates.rb +25 -5
- data/lib/drone-ci/api/user.rb +32 -6
- data/lib/drone-ci/api/users.rb +25 -5
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9f484658c0d071dcfba3fda2385534c52034879bb62619eb1261a6356963d451
|
4
|
+
data.tar.gz: 65471e81f6ccc0fdc7baa34bb5c50fd953a2c60c72c0775e9878ac6bd2a49992
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b75bb62ad76c510c73282e4721bc145676fe3d9c4e8fda654c6f15b4c081ff88952d961a285c588b6a87c188f0edb54395eee268eed9858abdb48d64229302c4
|
7
|
+
data.tar.gz: a28baf3eaff5723e9ae2c5c516c26b2424774059ac187a4bd90f887ae1e78c132c5ac9a19f987654bd06073b752e6357fd7f621793e7d9776353ab5c4866547e
|
data/.gitignore
CHANGED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
0.2.0
|
2
|
+
|
3
|
+
- (feature) add undocumented params to BuildsAPI#build_list: `page`, `per_page`
|
4
|
+
- (feature) add undocumented param to ReposAPI#repo_delete: `remove`
|
5
|
+
- (feature) add undocumented params to ReposAPI#repo_list: `page`, `per_page`
|
6
|
+
- (feature) add undocumented endpoint to UserAPI: `user_token`
|
7
|
+
- (dependency) update octokit from `~> 5.5` to `~> 5.6`
|
8
|
+
|
9
|
+
0.1.1
|
10
|
+
|
11
|
+
- (feature) Added documentation to API methods.
|
12
|
+
- (fix) removed required but unused argument from ReposAPI#repo_list
|
13
|
+
- (fix) ReposAPI#repo_create now actually uses the arguments given... :sweat_smile:
|
14
|
+
|
15
|
+
0.1.0
|
16
|
+
|
17
|
+
- Initial Release
|
data/drone-ci.gemspec
CHANGED
@@ -13,7 +13,7 @@ Gem::Specification.new do |gem|
|
|
13
13
|
# gem.signing_key = File.expand_path ENV.fetch 'GEM_SIGNING_KEY'
|
14
14
|
|
15
15
|
if ENV['HACKING']
|
16
|
-
gem.version = '0.0.0
|
16
|
+
gem.version = '0.0.0'
|
17
17
|
gem.files = Dir.glob('**')
|
18
18
|
gem.executables = Dir.glob('bin/*')
|
19
19
|
else
|
@@ -28,12 +28,12 @@ Gem::Specification.new do |gem|
|
|
28
28
|
gem.add_runtime_dependency 'faraday', '~> 2.5', '>= 2.5.2'
|
29
29
|
gem.add_runtime_dependency 'faraday-retry', '~> 2.0'
|
30
30
|
gem.add_runtime_dependency 'httpx', '~> 0.21.0'
|
31
|
-
gem.add_runtime_dependency 'octokit', '~> 5.
|
31
|
+
gem.add_runtime_dependency 'octokit', '~> 5.6'
|
32
32
|
|
33
33
|
gem.add_development_dependency 'pry', '~> 0.14.1'
|
34
34
|
gem.add_development_dependency 'pry-doc', '~> 1.3'
|
35
35
|
gem.add_development_dependency 'rubocop', '~> 1.35'
|
36
|
-
gem.add_development_dependency 'solargraph', '~> 0.
|
36
|
+
gem.add_development_dependency 'solargraph', '~> 0.46.0'
|
37
37
|
gem.add_development_dependency 'yard', '~> 0.9.28'
|
38
38
|
gem.metadata['rubygems_mfa_required'] = 'true'
|
39
39
|
end
|
data/lib/drone-ci/api/builds.rb
CHANGED
@@ -2,12 +2,20 @@
|
|
2
2
|
|
3
3
|
module DroneCI
|
4
4
|
module BuildsAPI
|
5
|
-
#
|
5
|
+
# Approves a blocked build.
|
6
|
+
#
|
7
|
+
# Please note this api requires write access to the repository, and the request parameter {build} is not the build id but the build number.
|
8
|
+
#
|
9
|
+
# Reference: https://docs.drone.io/api/builds/build_approve/
|
6
10
|
def build_approve(owner, repo, build)
|
7
11
|
api.post("repos/#{owner}/#{repo}/builds/#{build}/approve")
|
8
12
|
end
|
9
13
|
|
10
|
-
#
|
14
|
+
# Create a build using the latest commit for the specified branch.
|
15
|
+
#
|
16
|
+
# Please note the resulting build is created with event type `custom`.
|
17
|
+
#
|
18
|
+
# Reference: https://docs.drone.io/api/builds/build_create/
|
11
19
|
def build_create(namespace, name, branch: nil, commit: nil, **params)
|
12
20
|
api.post("repos/#{namespace}/#{name}/builds") do |request|
|
13
21
|
{ branch: branch, commit: commit }.merge(params).compact.transform_keys(&:to_s).each do |key, value|
|
@@ -16,43 +24,80 @@ module DroneCI
|
|
16
24
|
end
|
17
25
|
end
|
18
26
|
|
19
|
-
#
|
27
|
+
# Declines a blocked build.
|
28
|
+
#
|
29
|
+
# Please note this api requires write access to the repository, and the request parameter {build} is not the build id but the build number.
|
30
|
+
#
|
31
|
+
# Reference: https://docs.drone.io/api/builds/build_decline/
|
20
32
|
def build_decline(owner, repo, build)
|
21
33
|
api.post("repos/#{owner}/#{repo}/builds/#{build}/decline")
|
22
34
|
end
|
23
35
|
|
24
|
-
#
|
36
|
+
# Returns the specified repository build.
|
37
|
+
#
|
38
|
+
# Please note this api requires read access to the repository and the request parameter {build} is not the build id but the build number.
|
39
|
+
#
|
40
|
+
# Reference: https://docs.drone.io/api/builds/build_info/
|
25
41
|
def build_info(owner, repo, build)
|
26
42
|
api.get("repos/#{owner}/#{repo}/builds/#{build}")
|
27
43
|
end
|
28
44
|
|
29
|
-
#
|
30
|
-
|
31
|
-
|
45
|
+
# Returns recent builds for the repository based on name.
|
46
|
+
#
|
47
|
+
# Please note this api requires read access to the repository.
|
48
|
+
#
|
49
|
+
# Reference: https://docs.drone.io/api/builds/build_list/
|
50
|
+
def build_list(owner, repo, branch: nil, tag: nil, page: 1, per_page: 25)
|
51
|
+
api.get("repos/#{owner}/#{repo}/builds") do |request|
|
52
|
+
{
|
53
|
+
branch: branch,
|
54
|
+
commit: commit,
|
55
|
+
page: page,
|
56
|
+
per_page: [[per_page, 1].max, 100].min, # https://github.com/harness/drone/blob/cbfd342333ffa4b2fe76b7e8948235efd3535fac/handler/api/repos/builds/list.go#L45-L47
|
57
|
+
}.compact.transform_keys(&:to_s).each do |key, value|
|
58
|
+
request.params[key] = value
|
59
|
+
end
|
60
|
+
end
|
32
61
|
end
|
33
62
|
|
34
|
-
#
|
63
|
+
# Please note this api requires read access to the repository.
|
64
|
+
#
|
65
|
+
# Reference: https://docs.drone.io/api/builds/build_logs/
|
35
66
|
def build_logs(owner, repo, build, stage, step)
|
36
67
|
api.get("repos/#{owner}/#{repo}/builds/#{build}/logs/#{stage}/#{step}")
|
37
68
|
end
|
38
69
|
|
39
|
-
#
|
40
|
-
|
70
|
+
# Promote the specified build number to the target environment.
|
71
|
+
#
|
72
|
+
# If given, additional (custom) parameters will be available to your pipeline steps as environment variables.
|
73
|
+
#
|
74
|
+
# Please note this api requires write access to the repository.
|
75
|
+
#
|
76
|
+
# Reference: https://docs.drone.io/api/builds/build_promote/
|
77
|
+
def build_promote(owner, repo, build, target:)
|
41
78
|
api.post("repos/#{owner}/#{repo}/builds/#{build}") do |request|
|
42
|
-
{ target: target }.
|
79
|
+
{ target: target }.compact.transform_keys(&:to_s).each do |key, value|
|
43
80
|
request.params[key] = value
|
44
81
|
end
|
45
82
|
end
|
46
83
|
end
|
47
84
|
|
48
|
-
#
|
85
|
+
# Restart the specified build.
|
86
|
+
#
|
87
|
+
# Please note this api requires read and write access to the repository and the request parameter {build} is not the build id but the build number.
|
88
|
+
#
|
89
|
+
# Reference: https://docs.drone.io/api/builds/build_start/
|
49
90
|
def build_start(owner, repo, build)
|
50
91
|
api.post("repos/#{owner}/#{repo}/builds/#{build}")
|
51
92
|
end
|
52
93
|
|
53
94
|
alias build_restart build_start
|
54
95
|
|
55
|
-
#
|
96
|
+
# Stop the specified build.
|
97
|
+
#
|
98
|
+
# Please note this api requires administrative privileges and the request parameter {build} is not the build id but the build number.
|
99
|
+
#
|
100
|
+
# Reference: https://docs.drone.io/api/builds/build_stop/
|
56
101
|
def build_stop(owner, repo, build)
|
57
102
|
api.delete("repos/#{owner}/#{repo}/builds/#{build}")
|
58
103
|
end
|
data/lib/drone-ci/api/cron.rb
CHANGED
@@ -2,32 +2,56 @@
|
|
2
2
|
|
3
3
|
module DroneCI
|
4
4
|
module CronAPI
|
5
|
-
#
|
5
|
+
# Create a new cron job.
|
6
|
+
#
|
7
|
+
# Please note this api requires write access to the repository.
|
8
|
+
#
|
9
|
+
# Reference: https://docs.drone.io/api/cron/cron_create/
|
6
10
|
def cron_create(owner, repo, **body)
|
7
11
|
api.post("repos/#{owner}/#{repo}/cron", body)
|
8
12
|
end
|
9
13
|
|
10
|
-
#
|
14
|
+
# Deletes a cron job.
|
15
|
+
#
|
16
|
+
# Please note this api requires write access to the repository.
|
17
|
+
#
|
18
|
+
# Reference: https://docs.drone.io/api/cron/cron_delete/
|
11
19
|
def cron_delete(owner, repo, name)
|
12
20
|
api.delete("repos/#{owner}/#{repo}/cron/#{name}")
|
13
21
|
end
|
14
22
|
|
15
|
-
#
|
23
|
+
# Returns the named cron job.
|
24
|
+
#
|
25
|
+
# Please note this api requires write access to the repository.
|
26
|
+
#
|
27
|
+
# Reference: https://docs.drone.io/api/cron/cron_info/
|
16
28
|
def cron_info(owner, repo, name)
|
17
29
|
api.get("repos/#{owner}/#{repo}/cron/#{name}")
|
18
30
|
end
|
19
31
|
|
20
|
-
#
|
32
|
+
# Returns the cron job list.
|
33
|
+
#
|
34
|
+
# Please note this api requires write access to the repository.
|
35
|
+
#
|
36
|
+
# Reference: https://docs.drone.io/api/cron/cron_list/
|
21
37
|
def cron_list(owner, repo)
|
22
38
|
api.get("repos/#{owner}/#{repo}/cron")
|
23
39
|
end
|
24
40
|
|
25
|
-
#
|
41
|
+
# Trigger an existing cron task.
|
42
|
+
#
|
43
|
+
# Please note this api requires write access to the repository.
|
44
|
+
#
|
45
|
+
# Reference: https://docs.drone.io/api/cron/cron_trigger/
|
26
46
|
def cron_trigger(owner, repo, name)
|
27
47
|
api.post("repos/#{owner}/#{repo}/cron/#{name}")
|
28
48
|
end
|
29
49
|
|
30
|
-
#
|
50
|
+
# Updates the named cron job.
|
51
|
+
#
|
52
|
+
# Please note this api requires write access to the repository.
|
53
|
+
#
|
54
|
+
# Reference: https://docs.drone.io/api/cron/cron_update/
|
31
55
|
def cron_update(owner, repo, name, **body)
|
32
56
|
api.patch("repos/#{owner}/#{repo}/cron/#{name}", body)
|
33
57
|
end
|
data/lib/drone-ci/api/repos.rb
CHANGED
@@ -2,43 +2,77 @@
|
|
2
2
|
|
3
3
|
module DroneCI
|
4
4
|
module ReposAPI
|
5
|
-
#
|
5
|
+
# Lets a user assume ownership of a named repository.
|
6
|
+
#
|
7
|
+
# Please note this api requires administrative access to the repository.
|
8
|
+
#
|
9
|
+
# Reference: https://docs.drone.io/api/repos/repo_chown/
|
6
10
|
def repo_chown(owner, repo)
|
7
11
|
api.post("repos/#{owner}/#{repo}/chown")
|
8
12
|
end
|
9
13
|
|
10
|
-
#
|
11
|
-
|
12
|
-
|
14
|
+
# Permanently deletes a repository. It cannot be undone.
|
15
|
+
#
|
16
|
+
# Please note this api requires administrative access to the repository, and repository’s secrets and builds aren’t deleted.
|
17
|
+
#
|
18
|
+
# Reference: https://docs.drone.io/api/repos/repo_delete/
|
19
|
+
def repo_delete(owner, repo, remove: nil)
|
20
|
+
api.delete("repos/#{owner}/#{repo}") do |request|
|
21
|
+
{ remove: remove }.compact.transform_keys(&:to_s).each do |key, value|
|
22
|
+
request[key] = value
|
23
|
+
end
|
24
|
+
end
|
13
25
|
end
|
14
26
|
|
15
27
|
alias repo_disable repo_delete
|
16
28
|
|
17
|
-
#
|
18
|
-
|
19
|
-
|
29
|
+
# Registers a named repository with Drone.
|
30
|
+
#
|
31
|
+
# Please note this api requires administrative access to the repository.
|
32
|
+
#
|
33
|
+
# Reference: https://docs.drone.io/api/repos/repo_create/
|
34
|
+
def repo_create(owner, name)
|
35
|
+
api.post("repos/#{owner}/#{name}")
|
20
36
|
end
|
21
37
|
|
22
38
|
alias repo_enable repo_create
|
23
39
|
|
24
|
-
#
|
40
|
+
# Retrieves the details of a repository.
|
41
|
+
#
|
42
|
+
# Please note this api requires read access to the repository.
|
43
|
+
#
|
44
|
+
# Reference: https://docs.drone.io/api/repos/repo_info/
|
25
45
|
def repo_info(owner, repo)
|
26
46
|
api.get("repos/#{owner}/#{repo}")
|
27
47
|
end
|
28
48
|
|
29
|
-
#
|
49
|
+
# Returns repositories which are registered to Drone.
|
50
|
+
#
|
51
|
+
# Reference: https://docs.drone.io/api/repos/repo_list/
|
30
52
|
# the docs are wrong, they say this is at api/user/repos, but the source code says...
|
31
53
|
# https://github.com/harness/drone/blob/2d45d90cdd5cf2ec0e8dbcce2ea6bc340ce1e67e/handler/api/api.go#L173-L182
|
32
|
-
def repo_list(
|
33
|
-
api.get('repos')
|
54
|
+
def repo_list(page: 1, per_page: 25)
|
55
|
+
api.get('repos') do |request|
|
56
|
+
{ page: page, per_page: per_page }.compact.transform_keys(&:to_s).each do |key, value|
|
57
|
+
request[key] = value
|
58
|
+
end
|
59
|
+
end
|
34
60
|
end
|
35
61
|
|
36
|
-
#
|
62
|
+
# Recreates webhooks for your repository in your version control system (e.g GitHub). This can be used if you accidentally delete your webhooks.
|
63
|
+
#
|
64
|
+
# Please note this api requires administrative access to the repository.
|
65
|
+
#
|
66
|
+
# Reference: https://docs.drone.io/api/repos/repo_repair/
|
37
67
|
def repo_repair(owner, repo)
|
38
68
|
api.post("repos/#{owner}/#{repo}/repair")
|
39
69
|
end
|
40
70
|
|
41
|
-
#
|
71
|
+
# Updates a named repository.
|
72
|
+
#
|
73
|
+
# Please note this api requires administrative access to the repository.
|
74
|
+
#
|
75
|
+
# Reference: https://docs.drone.io/api/repos/repo_update/
|
42
76
|
def repo_update(owner, repo, **body)
|
43
77
|
api.patch("repos/#{owner}/#{repo}", body)
|
44
78
|
end
|
data/lib/drone-ci/api/secrets.rb
CHANGED
@@ -2,27 +2,47 @@
|
|
2
2
|
|
3
3
|
module DroneCI
|
4
4
|
module SecretsAPI
|
5
|
-
#
|
5
|
+
# Create a new repository secret.
|
6
|
+
#
|
7
|
+
# Please note this api requires write access to the repository.
|
8
|
+
#
|
9
|
+
# Reference: https://docs.drone.io/api/secrets/secret_create/
|
6
10
|
def secret_create(owner, repo, **body)
|
7
11
|
api.post("repos/#{owner}/#{repo}/secrets", body)
|
8
12
|
end
|
9
13
|
|
10
|
-
#
|
14
|
+
# Deletes a repository secret.
|
15
|
+
#
|
16
|
+
# Please note this api requires write access to the repository, and the request parameter {secret} is not the secret’s id but secret name.
|
17
|
+
#
|
18
|
+
# Reference: https://docs.drone.io/api/secrets/secret_delete/
|
11
19
|
def secret_delete(owner, repo, secret)
|
12
20
|
api.post("repos/#{owner}/#{repo}/secrets/#{secret}")
|
13
21
|
end
|
14
22
|
|
15
|
-
#
|
23
|
+
# Returns the repository secret.
|
24
|
+
#
|
25
|
+
# Please note this api requires write access to the repository, and the request parameter {secret} is not the secret’s id but secret name.
|
26
|
+
#
|
27
|
+
# Reference: https://docs.drone.io/api/secrets/secret_info/
|
16
28
|
def secret_info(owner, repo, secret)
|
17
29
|
api.get("repos/#{owner}/#{repo}/secrets/#{secret}")
|
18
30
|
end
|
19
31
|
|
20
|
-
#
|
32
|
+
# Returns the repository secret list.
|
33
|
+
#
|
34
|
+
# Please note this api requires write access to the repository.
|
35
|
+
#
|
36
|
+
# Reference: https://docs.drone.io/api/secrets/secret_list/
|
21
37
|
def secret_list(owner, repo)
|
22
38
|
api.get("repos/#{owner}/#{repo}/secrets")
|
23
39
|
end
|
24
40
|
|
25
|
-
#
|
41
|
+
# Updates the specified repository secret.
|
42
|
+
#
|
43
|
+
# Please note this api requires write access to the repository, and the request parameter {secret} is not the secret’s id but secret name.
|
44
|
+
#
|
45
|
+
# Reference: https://docs.drone.io/api/secrets/secret_update/
|
26
46
|
def secret_update(owner, repo, secret, **body)
|
27
47
|
api.patch("repos/#{owner}/#{repo}/secrets/#{secret}", body)
|
28
48
|
end
|
@@ -2,27 +2,47 @@
|
|
2
2
|
|
3
3
|
module DroneCI
|
4
4
|
module TemplatesAPI
|
5
|
-
#
|
5
|
+
# Create a new template.
|
6
|
+
#
|
7
|
+
# Please note this api requires write access to the repository.
|
8
|
+
#
|
9
|
+
# Reference: https://docs.drone.io/api/templates/template_create/
|
6
10
|
def template_create(namespace, **body)
|
7
11
|
api.post("templates/#{namespace}", body)
|
8
12
|
end
|
9
13
|
|
10
|
-
#
|
14
|
+
# Deletes a template.
|
15
|
+
#
|
16
|
+
# Please note this api requires write access to the repository.
|
17
|
+
#
|
18
|
+
# Reference: https://docs.drone.io/api/templates/template_delete/
|
11
19
|
def template_delete(namespace, name)
|
12
20
|
api.delete("templates/#{namespace}/#{name}")
|
13
21
|
end
|
14
22
|
|
15
|
-
#
|
23
|
+
# Returns the template.
|
24
|
+
#
|
25
|
+
# Please note this api requires write access to the repository.
|
26
|
+
#
|
27
|
+
# Reference: https://docs.drone.io/api/templates/template_info/
|
16
28
|
def template_info(namespace, name)
|
17
29
|
api.get("templates/#{namespace}/#{name}")
|
18
30
|
end
|
19
31
|
|
20
|
-
#
|
32
|
+
# Returns the organization template list.
|
33
|
+
#
|
34
|
+
# Please note this api requires write access to the repository.
|
35
|
+
#
|
36
|
+
# Reference: https://docs.drone.io/api/templates/template_list/
|
21
37
|
def template_list(namespace)
|
22
38
|
api.get("templates/#{namespace}")
|
23
39
|
end
|
24
40
|
|
25
|
-
#
|
41
|
+
# Updates the specified repository secret.
|
42
|
+
#
|
43
|
+
# Please note this api requires write access to the repository, and the request parameter {secret} is not the secret’s id but secret name.
|
44
|
+
#
|
45
|
+
# Reference: https://docs.drone.io/api/templates/template_update/
|
26
46
|
def template_update(namespace, name, **body)
|
27
47
|
api.patch("templates/#{namespace}/#{name}", body)
|
28
48
|
end
|
data/lib/drone-ci/api/user.rb
CHANGED
@@ -2,17 +2,25 @@
|
|
2
2
|
|
3
3
|
module DroneCI
|
4
4
|
module UserAPI
|
5
|
-
#
|
5
|
+
# Returns the currently authenticated user’s build feed.
|
6
|
+
#
|
7
|
+
# Reference: https://docs.drone.io/api/user/user_builds/
|
6
8
|
def user_builds
|
7
9
|
api.get('user/builds')
|
8
10
|
end
|
9
11
|
|
10
|
-
#
|
12
|
+
# Returns the currently authenticated user.
|
13
|
+
#
|
14
|
+
# Reference: https://docs.drone.io/api/user/user_info/
|
11
15
|
def user_info
|
12
16
|
api.get('user')
|
13
17
|
end
|
14
18
|
|
15
|
-
#
|
19
|
+
# Returns the currently authenticated user’s repository list.
|
20
|
+
#
|
21
|
+
# Optionally, include the latest build for each active repository.
|
22
|
+
#
|
23
|
+
# Reference: https://docs.drone.io/api/user/user_repos/
|
16
24
|
def user_repos(latest: nil)
|
17
25
|
api.get('user/repos') do |request|
|
18
26
|
{ latest: latest }.compact.each do |key, value|
|
@@ -21,9 +29,27 @@ module DroneCI
|
|
21
29
|
end
|
22
30
|
end
|
23
31
|
|
24
|
-
#
|
25
|
-
|
26
|
-
|
32
|
+
# Synchronize the currently authenticated user’s repository list.
|
33
|
+
#
|
34
|
+
# Reference: https://docs.drone.io/api/user/user_sync/
|
35
|
+
def user_sync(async: nil)
|
36
|
+
api.post('user/repos') do |request|
|
37
|
+
{ async: async }.compact.each do |key, value|
|
38
|
+
request.params[key] = value
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
# Undocumented endpoint.
|
44
|
+
#
|
45
|
+
# Route Reference: https://github.com/harness/drone/blob/master/handler/api/api.go#L324
|
46
|
+
# Code Reference: https://github.com/harness/drone/blob/master/handler/api/user/token.go
|
47
|
+
def user_token(rotate: nil)
|
48
|
+
api.post('user/token') do |request|
|
49
|
+
{ rotate: rotate }.compact.each do |key, value|
|
50
|
+
request.params[key] = value
|
51
|
+
end
|
52
|
+
end
|
27
53
|
end
|
28
54
|
end
|
29
55
|
end
|
data/lib/drone-ci/api/users.rb
CHANGED
@@ -2,27 +2,47 @@
|
|
2
2
|
|
3
3
|
module DroneCI
|
4
4
|
module UsersAPI
|
5
|
-
#
|
5
|
+
# Creates a user.
|
6
|
+
#
|
7
|
+
# Please note this api requires administrative privileges.
|
8
|
+
#
|
9
|
+
# Reference: https://docs.drone.io/api/users/users_create/
|
6
10
|
def users_create(**body)
|
7
11
|
api.post('users', body)
|
8
12
|
end
|
9
13
|
|
10
|
-
#
|
14
|
+
# Deletes a user.
|
15
|
+
#
|
16
|
+
# Please note this api requires administrative privileges.
|
17
|
+
#
|
18
|
+
# Reference: https://docs.drone.io/api/users/users_delete/
|
11
19
|
def users_delete(login)
|
12
20
|
api.delete("users/#{login}")
|
13
21
|
end
|
14
22
|
|
15
|
-
#
|
23
|
+
# Returns information about the named registered user.
|
24
|
+
#
|
25
|
+
# Please note this api requires administrative privileges.
|
26
|
+
#
|
27
|
+
# Reference: https://docs.drone.io/api/users/users_info/
|
16
28
|
def users_info(login)
|
17
29
|
api.get("users/#{login}")
|
18
30
|
end
|
19
31
|
|
20
|
-
#
|
32
|
+
# Returns a list of all registered users.
|
33
|
+
#
|
34
|
+
# Please note this api requires administrative privileges.
|
35
|
+
#
|
36
|
+
# Reference: https://docs.drone.io/api/users/users_list/
|
21
37
|
def users_list
|
22
38
|
api.get('users')
|
23
39
|
end
|
24
40
|
|
25
|
-
#
|
41
|
+
# Updates the specified user.
|
42
|
+
#
|
43
|
+
# Please note this api requires administrative privileges.
|
44
|
+
#
|
45
|
+
# Reference: https://docs.drone.io/api/users/users_update/
|
26
46
|
def users_update(login, **body)
|
27
47
|
api.patch("users/#{login}", body)
|
28
48
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: drone-ci
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Olstrom
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-09-
|
11
|
+
date: 2022-09-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -64,14 +64,14 @@ dependencies:
|
|
64
64
|
requirements:
|
65
65
|
- - "~>"
|
66
66
|
- !ruby/object:Gem::Version
|
67
|
-
version: '5.
|
67
|
+
version: '5.6'
|
68
68
|
type: :runtime
|
69
69
|
prerelease: false
|
70
70
|
version_requirements: !ruby/object:Gem::Requirement
|
71
71
|
requirements:
|
72
72
|
- - "~>"
|
73
73
|
- !ruby/object:Gem::Version
|
74
|
-
version: '5.
|
74
|
+
version: '5.6'
|
75
75
|
- !ruby/object:Gem::Dependency
|
76
76
|
name: pry
|
77
77
|
requirement: !ruby/object:Gem::Requirement
|
@@ -120,14 +120,14 @@ dependencies:
|
|
120
120
|
requirements:
|
121
121
|
- - "~>"
|
122
122
|
- !ruby/object:Gem::Version
|
123
|
-
version: 0.
|
123
|
+
version: 0.46.0
|
124
124
|
type: :development
|
125
125
|
prerelease: false
|
126
126
|
version_requirements: !ruby/object:Gem::Requirement
|
127
127
|
requirements:
|
128
128
|
- - "~>"
|
129
129
|
- !ruby/object:Gem::Version
|
130
|
-
version: 0.
|
130
|
+
version: 0.46.0
|
131
131
|
- !ruby/object:Gem::Dependency
|
132
132
|
name: yard
|
133
133
|
requirement: !ruby/object:Gem::Requirement
|
@@ -154,6 +154,7 @@ files:
|
|
154
154
|
- ".github/workflows/gem-push.yml"
|
155
155
|
- ".gitignore"
|
156
156
|
- ".rubocop.yml"
|
157
|
+
- CHANGELOG.md
|
157
158
|
- Gemfile
|
158
159
|
- LICENSE.txt
|
159
160
|
- README.md
|