gitlab 4.2.0 → 4.18.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +4 -2
- data/LICENSE.txt +1 -1
- data/README.md +96 -25
- data/exe/gitlab +5 -1
- data/lib/gitlab/api.rb +8 -3
- data/lib/gitlab/cli.rb +15 -15
- data/lib/gitlab/cli_helpers.rb +63 -61
- data/lib/gitlab/client/access_requests.rb +103 -0
- data/lib/gitlab/client/application_settings.rb +172 -0
- data/lib/gitlab/client/avatar.rb +21 -0
- data/lib/gitlab/client/award_emojis.rb +5 -3
- data/lib/gitlab/client/boards.rb +62 -4
- data/lib/gitlab/client/branches.rb +53 -14
- data/lib/gitlab/client/broadcast_messages.rb +75 -0
- data/lib/gitlab/client/build_variables.rb +78 -9
- data/lib/gitlab/client/builds.rb +13 -11
- data/lib/gitlab/client/commits.rb +89 -19
- data/lib/gitlab/client/container_registry.rb +85 -0
- data/lib/gitlab/client/deployments.rb +34 -0
- data/lib/gitlab/client/environments.rb +5 -3
- data/lib/gitlab/client/epic_issues.rb +23 -0
- data/lib/gitlab/client/epics.rb +73 -0
- data/lib/gitlab/client/events.rb +60 -0
- data/lib/gitlab/client/features.rb +48 -0
- data/lib/gitlab/client/group_badges.rb +88 -0
- data/lib/gitlab/client/group_boards.rb +141 -0
- data/lib/gitlab/client/group_labels.rb +88 -0
- data/lib/gitlab/client/group_milestones.rb +94 -0
- data/lib/gitlab/client/groups.rb +197 -17
- data/lib/gitlab/client/issue_links.rb +48 -0
- data/lib/gitlab/client/issues.rb +98 -4
- data/lib/gitlab/client/jobs.rb +96 -8
- data/lib/gitlab/client/keys.rb +13 -0
- data/lib/gitlab/client/labels.rb +7 -5
- data/lib/gitlab/client/lint.rb +19 -0
- data/lib/gitlab/client/markdown.rb +23 -0
- data/lib/gitlab/client/merge_request_approvals.rb +265 -0
- data/lib/gitlab/client/merge_requests.rb +237 -9
- data/lib/gitlab/client/milestones.rb +19 -5
- data/lib/gitlab/client/namespaces.rb +4 -2
- data/lib/gitlab/client/notes.rb +58 -12
- data/lib/gitlab/client/pipeline_schedules.rb +147 -0
- data/lib/gitlab/client/pipeline_triggers.rb +12 -10
- data/lib/gitlab/client/pipelines.rb +40 -3
- data/lib/gitlab/client/project_badges.rb +85 -0
- data/lib/gitlab/client/project_clusters.rb +83 -0
- data/lib/gitlab/client/project_release_links.rb +76 -0
- data/lib/gitlab/client/project_releases.rb +79 -0
- data/lib/gitlab/client/projects.rb +280 -47
- data/lib/gitlab/client/protected_tags.rb +59 -0
- data/lib/gitlab/client/remote_mirrors.rb +51 -0
- data/lib/gitlab/client/repositories.rb +60 -6
- data/lib/gitlab/client/repository_files.rb +23 -5
- data/lib/gitlab/client/repository_submodules.rb +27 -0
- data/lib/gitlab/client/resource_label_events.rb +82 -0
- data/lib/gitlab/client/resource_state_events.rb +57 -0
- data/lib/gitlab/client/runners.rb +111 -15
- data/lib/gitlab/client/search.rb +66 -0
- data/lib/gitlab/client/services.rb +4 -1
- data/lib/gitlab/client/sidekiq.rb +39 -0
- data/lib/gitlab/client/snippets.rb +8 -4
- data/lib/gitlab/client/system_hooks.rb +9 -7
- data/lib/gitlab/client/tags.rb +15 -14
- data/lib/gitlab/client/templates.rb +100 -0
- data/lib/gitlab/client/todos.rb +7 -5
- data/lib/gitlab/client/user_snippets.rb +114 -0
- data/lib/gitlab/client/users.rb +166 -30
- data/lib/gitlab/client/versions.rb +18 -0
- data/lib/gitlab/client/wikis.rb +79 -0
- data/lib/gitlab/client.rb +49 -12
- data/lib/gitlab/configuration.rb +8 -6
- data/lib/gitlab/error.rb +74 -5
- data/lib/gitlab/file_response.rb +5 -3
- data/lib/gitlab/help.rb +19 -20
- data/lib/gitlab/objectified_hash.rb +27 -10
- data/lib/gitlab/page_links.rb +11 -9
- data/lib/gitlab/paginated_response.rb +37 -24
- data/lib/gitlab/request.rb +42 -53
- data/lib/gitlab/shell.rb +11 -12
- data/lib/gitlab/shell_history.rb +11 -13
- data/lib/gitlab/version.rb +3 -1
- data/lib/gitlab.rb +19 -8
- metadata +50 -395
- data/.gitignore +0 -22
- data/.travis.yml +0 -8
- data/CONTRIBUTING.md +0 -195
- data/Gemfile +0 -4
- data/Rakefile +0 -9
- data/bin/console +0 -10
- data/bin/setup +0 -6
- data/gitlab.gemspec +0 -31
- data/spec/fixtures/board_list.json +0 -1
- data/spec/fixtures/board_lists.json +0 -1
- data/spec/fixtures/boards.json +0 -1
- data/spec/fixtures/branch.json +0 -1
- data/spec/fixtures/branch_delete.json +0 -3
- data/spec/fixtures/branches.json +0 -1
- data/spec/fixtures/build.json +0 -38
- data/spec/fixtures/build_artifacts.json +0 -0
- data/spec/fixtures/build_cancel.json +0 -24
- data/spec/fixtures/build_erase.json +0 -24
- data/spec/fixtures/build_retry.json +0 -24
- data/spec/fixtures/builds.json +0 -78
- data/spec/fixtures/builds_commits.json +0 -64
- data/spec/fixtures/compare_merge_request_diff.json +0 -31
- data/spec/fixtures/empty.json +0 -0
- data/spec/fixtures/environment.json +0 -6
- data/spec/fixtures/environments.json +0 -14
- data/spec/fixtures/error_already_exists.json +0 -1
- data/spec/fixtures/error_project_not_found.json +0 -1
- data/spec/fixtures/get_repository_file.json +0 -1
- data/spec/fixtures/group.json +0 -60
- data/spec/fixtures/group_create.json +0 -1
- data/spec/fixtures/group_create_with_description.json +0 -1
- data/spec/fixtures/group_delete.json +0 -1
- data/spec/fixtures/group_member.json +0 -1
- data/spec/fixtures/group_member_delete.json +0 -1
- data/spec/fixtures/group_member_edit.json +0 -1
- data/spec/fixtures/group_members.json +0 -1
- data/spec/fixtures/group_projects.json +0 -44
- data/spec/fixtures/group_search.json +0 -2
- data/spec/fixtures/groups.json +0 -2
- data/spec/fixtures/issue.json +0 -1
- data/spec/fixtures/issue_award_emoji.json +0 -16
- data/spec/fixtures/issue_award_emojis.json +0 -34
- data/spec/fixtures/issues.json +0 -1
- data/spec/fixtures/job.json +0 -43
- data/spec/fixtures/job_trace.json +0 -1
- data/spec/fixtures/jobs.json +0 -91
- data/spec/fixtures/key.json +0 -1
- data/spec/fixtures/keys.json +0 -1
- data/spec/fixtures/label.json +0 -1
- data/spec/fixtures/label_unsubscribe.json +0 -1
- data/spec/fixtures/labels.json +0 -1
- data/spec/fixtures/merge_request.json +0 -1
- data/spec/fixtures/merge_request_award_emoji.json +0 -16
- data/spec/fixtures/merge_request_award_emojis.json +0 -34
- data/spec/fixtures/merge_request_changes.json +0 -1
- data/spec/fixtures/merge_request_closes_issues.json +0 -1
- data/spec/fixtures/merge_request_comment.json +0 -1
- data/spec/fixtures/merge_request_comments.json +0 -1
- data/spec/fixtures/merge_request_commits.json +0 -1
- data/spec/fixtures/merge_requests.json +0 -1
- data/spec/fixtures/milestone.json +0 -1
- data/spec/fixtures/milestone_issues.json +0 -1
- data/spec/fixtures/milestone_merge_requests.json +0 -1
- data/spec/fixtures/milestones.json +0 -1
- data/spec/fixtures/namespaces.json +0 -1
- data/spec/fixtures/note.json +0 -1
- data/spec/fixtures/note_award_emoji.json +0 -16
- data/spec/fixtures/note_award_emojis.json +0 -18
- data/spec/fixtures/notes.json +0 -1
- data/spec/fixtures/pipeline.json +0 -23
- data/spec/fixtures/pipeline_cancel.json +0 -23
- data/spec/fixtures/pipeline_create.json +0 -23
- data/spec/fixtures/pipeline_jobs.json +0 -91
- data/spec/fixtures/pipeline_retry.json +0 -23
- data/spec/fixtures/pipelines.json +0 -48
- data/spec/fixtures/project.json +0 -1
- data/spec/fixtures/project_commit.json +0 -13
- data/spec/fixtures/project_commit_comment.json +0 -1
- data/spec/fixtures/project_commit_comments.json +0 -1
- data/spec/fixtures/project_commit_create.json +0 -22
- data/spec/fixtures/project_commit_diff.json +0 -10
- data/spec/fixtures/project_commit_status.json +0 -42
- data/spec/fixtures/project_commits.json +0 -1
- data/spec/fixtures/project_edit.json +0 -21
- data/spec/fixtures/project_events.json +0 -1
- data/spec/fixtures/project_for_user.json +0 -1
- data/spec/fixtures/project_fork.json +0 -50
- data/spec/fixtures/project_fork_link.json +0 -1
- data/spec/fixtures/project_forked_for_user.json +0 -50
- data/spec/fixtures/project_hook.json +0 -1
- data/spec/fixtures/project_hooks.json +0 -1
- data/spec/fixtures/project_issues.json +0 -1
- data/spec/fixtures/project_key.json +0 -6
- data/spec/fixtures/project_keys.json +0 -6
- data/spec/fixtures/project_runner_enable.json +0 -7
- data/spec/fixtures/project_runners.json +0 -16
- data/spec/fixtures/project_search.json +0 -1
- data/spec/fixtures/project_star.json +0 -44
- data/spec/fixtures/project_tag_annotated.json +0 -1
- data/spec/fixtures/project_tag_lightweight.json +0 -1
- data/spec/fixtures/project_tags.json +0 -1
- data/spec/fixtures/project_unstar.json +0 -44
- data/spec/fixtures/project_update_commit_status.json +0 -20
- data/spec/fixtures/projects.json +0 -1
- data/spec/fixtures/push_rule.json +0 -1
- data/spec/fixtures/raw_file.json +0 -2
- data/spec/fixtures/release_create.json +0 -1
- data/spec/fixtures/release_update.json +0 -1
- data/spec/fixtures/repository_file.json +0 -1
- data/spec/fixtures/run_trigger.json +0 -1
- data/spec/fixtures/runner.json +0 -26
- data/spec/fixtures/runner_delete.json +0 -7
- data/spec/fixtures/runner_edit.json +0 -26
- data/spec/fixtures/runners.json +0 -16
- data/spec/fixtures/runners_all.json +0 -30
- data/spec/fixtures/service.json +0 -1
- data/spec/fixtures/session.json +0 -1
- data/spec/fixtures/shell_history.json +0 -2
- data/spec/fixtures/snippet.json +0 -1
- data/spec/fixtures/snippet_award_emoji.json +0 -16
- data/spec/fixtures/snippet_award_emojis.json +0 -34
- data/spec/fixtures/snippet_content.json +0 -3
- data/spec/fixtures/snippets.json +0 -1
- data/spec/fixtures/system_hook.json +0 -1
- data/spec/fixtures/system_hooks.json +0 -1
- data/spec/fixtures/tag.json +0 -1
- data/spec/fixtures/tag_create.json +0 -1
- data/spec/fixtures/tag_create_with_description.json +0 -1
- data/spec/fixtures/tag_delete.json +0 -1
- data/spec/fixtures/tags.json +0 -1
- data/spec/fixtures/team_member.json +0 -1
- data/spec/fixtures/team_members.json +0 -1
- data/spec/fixtures/todo.json +0 -73
- data/spec/fixtures/todos.json +0 -148
- data/spec/fixtures/tree.json +0 -1
- data/spec/fixtures/trigger.json +0 -10
- data/spec/fixtures/triggers.json +0 -12
- data/spec/fixtures/user.json +0 -1
- data/spec/fixtures/user_block_unblock.json +0 -1
- data/spec/fixtures/user_email.json +0 -1
- data/spec/fixtures/user_emails.json +0 -1
- data/spec/fixtures/user_search.json +0 -1
- data/spec/fixtures/users.json +0 -1
- data/spec/fixtures/variable.json +0 -4
- data/spec/fixtures/variables.json +0 -10
- data/spec/gitlab/cli_helpers_spec.rb +0 -57
- data/spec/gitlab/cli_spec.rb +0 -119
- data/spec/gitlab/client/award_emojis_spec.rb +0 -391
- data/spec/gitlab/client/boards_spec.rb +0 -94
- data/spec/gitlab/client/branches_spec.rb +0 -116
- data/spec/gitlab/client/build_variables_spec.rb +0 -86
- data/spec/gitlab/client/builds_spec.rb +0 -148
- data/spec/gitlab/client/client_spec.rb +0 -11
- data/spec/gitlab/client/commits_spec.rb +0 -168
- data/spec/gitlab/client/environments_spec.rb +0 -132
- data/spec/gitlab/client/groups_spec.rb +0 -195
- data/spec/gitlab/client/issues_spec.rb +0 -186
- data/spec/gitlab/client/jobs_spec.rb +0 -135
- data/spec/gitlab/client/keys_spec.rb +0 -19
- data/spec/gitlab/client/labels_spec.rb +0 -100
- data/spec/gitlab/client/merge_requests_spec.rb +0 -224
- data/spec/gitlab/client/milestones_spec.rb +0 -98
- data/spec/gitlab/client/namespaces_spec.rb +0 -22
- data/spec/gitlab/client/notes_spec.rb +0 -333
- data/spec/gitlab/client/pipeline_triggers_spec.rb +0 -157
- data/spec/gitlab/client/pipelines_spec.rb +0 -95
- data/spec/gitlab/client/projects_spec.rb +0 -613
- data/spec/gitlab/client/repositories_spec.rb +0 -94
- data/spec/gitlab/client/repository_files_spec.rb +0 -95
- data/spec/gitlab/client/runners_spec.rb +0 -185
- data/spec/gitlab/client/services_spec.rb +0 -55
- data/spec/gitlab/client/snippets_spec.rb +0 -100
- data/spec/gitlab/client/system_hooks_spec.rb +0 -69
- data/spec/gitlab/client/tags_spec.rb +0 -109
- data/spec/gitlab/client/todos_spec.rb +0 -45
- data/spec/gitlab/client/users_spec.rb +0 -418
- data/spec/gitlab/error_spec.rb +0 -45
- data/spec/gitlab/file_response_spec.rb +0 -33
- data/spec/gitlab/help_spec.rb +0 -46
- data/spec/gitlab/objectified_hash_spec.rb +0 -48
- data/spec/gitlab/page_links_spec.rb +0 -16
- data/spec/gitlab/paginated_response_spec.rb +0 -60
- data/spec/gitlab/request_spec.rb +0 -73
- data/spec/gitlab/shell_history_spec.rb +0 -53
- data/spec/gitlab/shell_spec.rb +0 -80
- data/spec/gitlab_spec.rb +0 -97
- data/spec/spec_helper.rb +0 -74
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
class Gitlab::Client
|
2
4
|
# Defines methods related to system hooks.
|
3
5
|
# @see https://docs.gitlab.com/ce/api/system_hooks.html
|
@@ -12,10 +14,10 @@ class Gitlab::Client
|
|
12
14
|
# @option options [Integer] :page The page number.
|
13
15
|
# @option options [Integer] :per_page The number of results per page.
|
14
16
|
# @return [Array<Gitlab::ObjectifiedHash>]
|
15
|
-
def hooks(options={})
|
16
|
-
get(
|
17
|
+
def hooks(options = {})
|
18
|
+
get('/hooks', query: options)
|
17
19
|
end
|
18
|
-
|
20
|
+
alias system_hooks hooks
|
19
21
|
|
20
22
|
# Adds a new system hook.
|
21
23
|
#
|
@@ -29,9 +31,9 @@ class Gitlab::Client
|
|
29
31
|
# @option options [boolean] :enable_ssl_verification `false` will cause Gitlab to ignore invalid/unsigned certificate errors (default is `true`)
|
30
32
|
# @return [Gitlab::ObjectifiedHash]
|
31
33
|
def add_hook(url, options = {})
|
32
|
-
post(
|
34
|
+
post('/hooks', body: options.merge(url: url))
|
33
35
|
end
|
34
|
-
|
36
|
+
alias add_system_hook add_hook
|
35
37
|
|
36
38
|
# Tests a system hook.
|
37
39
|
#
|
@@ -44,7 +46,7 @@ class Gitlab::Client
|
|
44
46
|
def hook(id)
|
45
47
|
get("/hooks/#{id}")
|
46
48
|
end
|
47
|
-
|
49
|
+
alias system_hook hook
|
48
50
|
|
49
51
|
# Deletes a new system hook.
|
50
52
|
#
|
@@ -57,6 +59,6 @@ class Gitlab::Client
|
|
57
59
|
def delete_hook(id)
|
58
60
|
delete("/hooks/#{id}")
|
59
61
|
end
|
60
|
-
|
62
|
+
alias delete_system_hook delete_hook
|
61
63
|
end
|
62
64
|
end
|
data/lib/gitlab/client/tags.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
class Gitlab::Client
|
2
4
|
# Defines methods related to tags.
|
3
5
|
# @see https://docs.gitlab.com/ce/api/tags.html
|
@@ -12,10 +14,10 @@ class Gitlab::Client
|
|
12
14
|
# @option options [Integer] :page The page number.
|
13
15
|
# @option options [Integer] :per_page The number of results per page.
|
14
16
|
# @return [Array<Gitlab::ObjectifiedHash>]
|
15
|
-
def tags(project, options={})
|
17
|
+
def tags(project, options = {})
|
16
18
|
get("/projects/#{url_encode project}/repository/tags", query: options)
|
17
19
|
end
|
18
|
-
|
20
|
+
alias repo_tags tags
|
19
21
|
|
20
22
|
# Creates a new project repository tag.
|
21
23
|
#
|
@@ -29,10 +31,10 @@ class Gitlab::Client
|
|
29
31
|
# @param [String] message Optional message for tag, creates annotated tag if specified.
|
30
32
|
# @param [String] description Optional release notes for tag.
|
31
33
|
# @return [Gitlab::ObjectifiedHash]
|
32
|
-
def create_tag(project, tag_name, ref, message='', description=nil)
|
33
|
-
post("/projects/#{url_encode project}/repository/tags", body: { tag_name: tag_name, ref: ref, message: message,
|
34
|
+
def create_tag(project, tag_name, ref, message = '', description = nil)
|
35
|
+
post("/projects/#{url_encode project}/repository/tags", body: { tag_name: tag_name, ref: ref, message: message, release_description: description })
|
34
36
|
end
|
35
|
-
|
37
|
+
alias repo_create_tag create_tag
|
36
38
|
|
37
39
|
# Gets information about a repository tag.
|
38
40
|
#
|
@@ -44,9 +46,9 @@ class Gitlab::Client
|
|
44
46
|
# @param [String] tag The name of the tag.
|
45
47
|
# @return [Gitlab::ObjectifiedHash]
|
46
48
|
def tag(project, tag)
|
47
|
-
get("/projects/#{url_encode project}/repository/tags/#{tag}")
|
49
|
+
get("/projects/#{url_encode project}/repository/tags/#{url_encode tag}")
|
48
50
|
end
|
49
|
-
|
51
|
+
alias repo_tag tag
|
50
52
|
|
51
53
|
# Deletes a repository tag. Requires Gitlab >= 6.8.x
|
52
54
|
#
|
@@ -58,9 +60,9 @@ class Gitlab::Client
|
|
58
60
|
# @param [String] tag The name of the tag to delete
|
59
61
|
# @return [Gitlab::ObjectifiedHash]
|
60
62
|
def delete_tag(project, tag)
|
61
|
-
delete("/projects/#{url_encode project}/repository/tags/#{tag}")
|
63
|
+
delete("/projects/#{url_encode project}/repository/tags/#{url_encode tag}")
|
62
64
|
end
|
63
|
-
|
65
|
+
alias repo_delete_tag delete_tag
|
64
66
|
|
65
67
|
# Adds release notes to an existing repository tag. Requires Gitlab >= 8.2.0
|
66
68
|
#
|
@@ -73,9 +75,9 @@ class Gitlab::Client
|
|
73
75
|
# @param [String] description Release notes with markdown support
|
74
76
|
# @return [Gitlab::ObjectifiedHash]
|
75
77
|
def create_release(project, tag, description)
|
76
|
-
post("/projects/#{url_encode project}/repository/tags/#{tag}/release", body: { description: description })
|
78
|
+
post("/projects/#{url_encode project}/repository/tags/#{url_encode tag}/release", body: { description: description })
|
77
79
|
end
|
78
|
-
|
80
|
+
alias repo_create_release create_release
|
79
81
|
|
80
82
|
# Updates the release notes of a given release. Requires Gitlab >= 8.2.0
|
81
83
|
#
|
@@ -88,9 +90,8 @@ class Gitlab::Client
|
|
88
90
|
# @param [String] description Release notes with markdown support
|
89
91
|
# @return [Gitlab::ObjectifiedHash]
|
90
92
|
def update_release(project, tag, description)
|
91
|
-
put("/projects/#{url_encode project}/repository/tags/#{tag}/release", body: { description: description })
|
93
|
+
put("/projects/#{url_encode project}/repository/tags/#{url_encode tag}/release", body: { description: description })
|
92
94
|
end
|
93
|
-
|
94
|
-
|
95
|
+
alias repo_update_release update_release
|
95
96
|
end
|
96
97
|
end
|
@@ -0,0 +1,100 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Gitlab::Client
|
4
|
+
# Defines methods related to templates.
|
5
|
+
# @see https://docs.gitlab.com/ce/api/templates/dockerfiles.html
|
6
|
+
# @see https://docs.gitlab.com/ce/api/templates/gitignores.html
|
7
|
+
# @see https://docs.gitlab.com/ce/api/templates/gitlab_ci_ymls.html
|
8
|
+
# @see https://docs.gitlab.com/ce/api/templates/licenses.html
|
9
|
+
module Templates
|
10
|
+
# Get all Dockerfile templates.
|
11
|
+
#
|
12
|
+
# @example
|
13
|
+
# Gitlab.dockerfile_templates
|
14
|
+
#
|
15
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
16
|
+
def dockerfile_templates
|
17
|
+
get('/templates/dockerfiles')
|
18
|
+
end
|
19
|
+
|
20
|
+
# Get a single Dockerfile template.
|
21
|
+
#
|
22
|
+
# @example
|
23
|
+
# Gitlab.dockerfile_template('Binary')
|
24
|
+
#
|
25
|
+
# @param [String] key The key of the Dockerfile template
|
26
|
+
# @return [Gitlab::ObjectifiedHash]
|
27
|
+
def dockerfile_template(key)
|
28
|
+
get("/templates/dockerfiles/#{key}")
|
29
|
+
end
|
30
|
+
|
31
|
+
# Get all gitignore templates.
|
32
|
+
#
|
33
|
+
# @example
|
34
|
+
# Gitlab.gitignore_templates
|
35
|
+
#
|
36
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
37
|
+
def gitignore_templates
|
38
|
+
get('/templates/gitignores')
|
39
|
+
end
|
40
|
+
|
41
|
+
# Get a single gitignore template.
|
42
|
+
#
|
43
|
+
# @example
|
44
|
+
# Gitlab.gitignore_template('Ruby')
|
45
|
+
#
|
46
|
+
# @param [String] key The key of the gitignore template
|
47
|
+
# @return [Gitlab::ObjectifiedHash]
|
48
|
+
def gitignore_template(key)
|
49
|
+
get("/templates/gitignores/#{key}")
|
50
|
+
end
|
51
|
+
|
52
|
+
# Get all `gitlab_ci.yml` templates.
|
53
|
+
#
|
54
|
+
# @example
|
55
|
+
# Gitlab.gitlab_ci_yml_templates
|
56
|
+
#
|
57
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
58
|
+
def gitlab_ci_yml_templates
|
59
|
+
get('/templates/gitlab_ci_ymls')
|
60
|
+
end
|
61
|
+
|
62
|
+
# Get a single `gitlab_ci.yml` template.
|
63
|
+
#
|
64
|
+
# @example
|
65
|
+
# Gitlab.gitlab_ci_yml_template('Ruby')
|
66
|
+
#
|
67
|
+
# @param [String] key The key of the gitlab_ci_yml template
|
68
|
+
# @return [Gitlab::ObjectifiedHash]
|
69
|
+
def gitlab_ci_yml_template(key)
|
70
|
+
get("/templates/gitlab_ci_ymls/#{key}")
|
71
|
+
end
|
72
|
+
|
73
|
+
# Get all license templates.
|
74
|
+
#
|
75
|
+
# @example
|
76
|
+
# Gitlab.license_templates
|
77
|
+
# Gitlab.license_templates(popular: true)
|
78
|
+
#
|
79
|
+
# @param [Hash] options A customizable set of options.
|
80
|
+
# @option options [Boolean] popular(optional) If passed, returns only popular licenses.
|
81
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
82
|
+
def license_templates(options = {})
|
83
|
+
get('/templates/licenses', query: options)
|
84
|
+
end
|
85
|
+
|
86
|
+
# Get a single license template. You can pass parameters to replace the license placeholder.
|
87
|
+
#
|
88
|
+
# @example
|
89
|
+
# Gitlab.license_template('Ruby')
|
90
|
+
#
|
91
|
+
# @param [String] key The key of the license template
|
92
|
+
# @param [Hash] options A customizable set of options.
|
93
|
+
# @option options [String] project(optional) The copyrighted project name.
|
94
|
+
# @option options [String] fullname(optional) The full-name of the copyright holder
|
95
|
+
# @return [Gitlab::ObjectifiedHash]
|
96
|
+
def license_template(key, options = {})
|
97
|
+
get("/templates/licenses/#{key}", query: options)
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
data/lib/gitlab/client/todos.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
class Gitlab::Client
|
2
4
|
# Defines methods related to todos
|
3
|
-
# @see https://docs.gitlab.com/ce/api/todos.html
|
5
|
+
# @see https://docs.gitlab.com/ce/api/todos.html
|
4
6
|
module Todos
|
5
7
|
# Gets a list of todos.
|
6
8
|
#
|
@@ -16,8 +18,8 @@ class Gitlab::Client
|
|
16
18
|
# @option options [Integer] :state The state of the todo. Can be either `pending` or `done`
|
17
19
|
# @option options [Integer] :type The type of a todo. Can be either `Issue` or `MergeRequest`
|
18
20
|
# @return [Array<Gitlab::ObjectifiedHash>]
|
19
|
-
def todos(options={})
|
20
|
-
get(
|
21
|
+
def todos(options = {})
|
22
|
+
get('/todos', query: options)
|
21
23
|
end
|
22
24
|
|
23
25
|
# Marks a single pending todo for the current user as done.
|
@@ -38,7 +40,7 @@ class Gitlab::Client
|
|
38
40
|
#
|
39
41
|
# @return [void] This API call returns an empty response body.
|
40
42
|
def mark_all_todos_as_done
|
41
|
-
post(
|
43
|
+
post('/todos/mark_as_done')
|
42
44
|
end
|
43
45
|
end
|
44
|
-
end
|
46
|
+
end
|
@@ -0,0 +1,114 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Gitlab::Client
|
4
|
+
# Defines methods related to user snippets.
|
5
|
+
# @see https://docs.gitlab.com/ce/api/snippets.html
|
6
|
+
module UserSnippets
|
7
|
+
# Get a list of the snippets of the current user.
|
8
|
+
#
|
9
|
+
# @example
|
10
|
+
# Gitlab.user_snippets
|
11
|
+
#
|
12
|
+
# @return [Array<Gitlab::ObjectifiedHash>] List of snippets of current user
|
13
|
+
def user_snippets
|
14
|
+
get('/snippets')
|
15
|
+
end
|
16
|
+
|
17
|
+
# Get a single snippet.
|
18
|
+
#
|
19
|
+
# @example
|
20
|
+
# Gitlab.user_snippet(1)
|
21
|
+
#
|
22
|
+
# @param [Integer] id ID of snippet to retrieve.
|
23
|
+
# @return [Gitlab::ObjectifiedHash] Information about the user snippet
|
24
|
+
def user_snippet(id)
|
25
|
+
get("/snippets/#{id}")
|
26
|
+
end
|
27
|
+
|
28
|
+
# Get raw contents of a single snippet.
|
29
|
+
#
|
30
|
+
# @example
|
31
|
+
# Gitlab.user_snippet_raw(1)
|
32
|
+
#
|
33
|
+
# @param [Integer] id ID of snippet to retrieve.
|
34
|
+
# @return [String] User snippet text
|
35
|
+
def user_snippet_raw(id)
|
36
|
+
get("/snippets/#{id}/raw",
|
37
|
+
format: nil,
|
38
|
+
headers: { Accept: 'text/plain' },
|
39
|
+
parser: ::Gitlab::Request::Parser)
|
40
|
+
end
|
41
|
+
|
42
|
+
# Create a new snippet.
|
43
|
+
#
|
44
|
+
# @example
|
45
|
+
# Gitlab.create_user_snippet({ title: 'REST', file_name: 'api.rb', content: 'some code', description: 'Hello World snippet', visibility: 'public'})
|
46
|
+
#
|
47
|
+
# @param [Hash] options A customizable set of options.
|
48
|
+
# @option options [String] :title (required) Title of a snippet.
|
49
|
+
# @option options [String] :file_name (required) Name of a snippet file.
|
50
|
+
# @option options [String] :content (required) Content of a snippet.
|
51
|
+
# @option options [String] :description (optional) Description of a snippet.
|
52
|
+
# @option options [String] :visibility (optional) visibility of a snippet.
|
53
|
+
# @return [Gitlab::ObjectifiedHash] Information about created snippet.
|
54
|
+
def create_user_snippet(options = {})
|
55
|
+
post('/snippets', body: options)
|
56
|
+
end
|
57
|
+
|
58
|
+
# Update an existing snippet.
|
59
|
+
#
|
60
|
+
# @example
|
61
|
+
# Gitlab.edit_user_snippet(34, { file_name: 'README.txt' })
|
62
|
+
# Gitlab.edit_user_snippet(34, { file_name: 'README.txt', title: 'New title' })
|
63
|
+
#
|
64
|
+
# @param [Integer] id ID of snippet to update.
|
65
|
+
# @param [Hash] options A customizable set of options.
|
66
|
+
# @option options [String] :title (optional) Title of a snippet.
|
67
|
+
# @option options [String] :file_name (optional) Name of a snippet file.
|
68
|
+
# @option options [String] :content (optional) Content of a snippet.
|
69
|
+
# @option options [String] :description (optional) Description of a snippet.
|
70
|
+
# @option options [String] :visibility (optional) visibility of a snippet.
|
71
|
+
# @return [Gitlab::ObjectifiedHash] Information about updated snippet.
|
72
|
+
def edit_user_snippet(id, options = {})
|
73
|
+
put("/snippets/#{id}", body: options)
|
74
|
+
end
|
75
|
+
|
76
|
+
# Delete an existing snippet.
|
77
|
+
#
|
78
|
+
# @example
|
79
|
+
# Gitlab.delete_user_snippet(14)
|
80
|
+
#
|
81
|
+
# @param [Integer] id ID of snippet to delete.
|
82
|
+
# @return [void] This API call returns an empty response body.
|
83
|
+
def delete_user_snippet(id)
|
84
|
+
delete("/snippets/#{id}")
|
85
|
+
end
|
86
|
+
|
87
|
+
# List all public snippets.
|
88
|
+
#
|
89
|
+
# @example
|
90
|
+
# Gitlab.public_snippets
|
91
|
+
# Gitlab.public_snippets(per_page: 2, page: 1)
|
92
|
+
#
|
93
|
+
# @param [Hash] options A customizable set of options.
|
94
|
+
# @option options [String] :per_page (optional) Number of snippets to return per page.
|
95
|
+
# @option options [String] :page (optional) Page to retrieve.
|
96
|
+
#
|
97
|
+
# @return [Array<Gitlab::ObjectifiedHash>] List of all public snippets
|
98
|
+
def public_snippets(options = {})
|
99
|
+
get('/snippets/public', query: options)
|
100
|
+
end
|
101
|
+
|
102
|
+
# Get user agent details for a snippet.
|
103
|
+
#
|
104
|
+
# @example
|
105
|
+
# Gitlab.snippet_user_agent_details(1)
|
106
|
+
#
|
107
|
+
# @param [Integer] id ID of snippet to delete.
|
108
|
+
#
|
109
|
+
# @return [Array<Gitlab::ObjectifiedHash>] Details of the user agent
|
110
|
+
def snippet_user_agent_details(id)
|
111
|
+
get("/snippets/#{id}/user_agent_detail")
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
data/lib/gitlab/client/users.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
class Gitlab::Client
|
2
4
|
# Defines methods related to users.
|
3
5
|
# @see https://docs.gitlab.com/ce/api/users.html
|
@@ -12,8 +14,8 @@ class Gitlab::Client
|
|
12
14
|
# @option options [Integer] :page The page number.
|
13
15
|
# @option options [Integer] :per_page The number of results per page.
|
14
16
|
# @return [Array<Gitlab::ObjectifiedHash>]
|
15
|
-
def users(options={})
|
16
|
-
get(
|
17
|
+
def users(options = {})
|
18
|
+
get('/users', query: options)
|
17
19
|
end
|
18
20
|
|
19
21
|
# Gets information about a user.
|
@@ -25,8 +27,8 @@ class Gitlab::Client
|
|
25
27
|
#
|
26
28
|
# @param [Integer] id The ID of a user.
|
27
29
|
# @return [Gitlab::ObjectifiedHash]
|
28
|
-
def user(id=nil)
|
29
|
-
id.to_i.zero? ? get(
|
30
|
+
def user(id = nil)
|
31
|
+
id.to_i.zero? ? get('/user') : get("/users/#{id}")
|
30
32
|
end
|
31
33
|
|
32
34
|
# Creates a new user.
|
@@ -35,11 +37,11 @@ class Gitlab::Client
|
|
35
37
|
# @example
|
36
38
|
# Gitlab.create_user('joe@foo.org', 'secret', 'joe', { name: 'Joe Smith' })
|
37
39
|
# or
|
38
|
-
# Gitlab.create_user('joe@foo.org', 'secret')
|
40
|
+
# Gitlab.create_user('joe@foo.org', 'secret', 'joe')
|
39
41
|
#
|
40
|
-
# @param [String] email The email of a user.
|
41
|
-
# @param [String] password The password of a user.
|
42
|
-
# @param [String] username The username of a user.
|
42
|
+
# @param [String] email(required) The email of a user.
|
43
|
+
# @param [String] password(required) The password of a user.
|
44
|
+
# @param [String] username(required) The username of a user.
|
43
45
|
# @param [Hash] options A customizable set of options.
|
44
46
|
# @option options [String] :name The name of a user. Defaults to email.
|
45
47
|
# @option options [String] :skype The skype of a user.
|
@@ -48,12 +50,10 @@ class Gitlab::Client
|
|
48
50
|
# @option options [Integer] :projects_limit The limit of projects for a user.
|
49
51
|
# @return [Gitlab::ObjectifiedHash] Information about created user.
|
50
52
|
def create_user(*args)
|
51
|
-
options =
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
body = { email: args[0], password: args[1], name: args[0] }
|
56
|
-
end
|
53
|
+
options = args.last.is_a?(Hash) ? args.pop : {}
|
54
|
+
raise ArgumentError, 'Missing required parameters' unless args[2]
|
55
|
+
|
56
|
+
body = { email: args[0], password: args[1], username: args[2], name: args[0] }
|
57
57
|
body.merge!(options)
|
58
58
|
post('/users', body: body)
|
59
59
|
end
|
@@ -73,7 +73,7 @@ class Gitlab::Client
|
|
73
73
|
# @option options [String] :twitter The twitter of a user.
|
74
74
|
# @option options [Integer] :projects_limit The limit of projects for a user.
|
75
75
|
# @return [Gitlab::ObjectifiedHash] Information about created user.
|
76
|
-
def edit_user(user_id, options={})
|
76
|
+
def edit_user(user_id, options = {})
|
77
77
|
put("/users/#{user_id}", body: options)
|
78
78
|
end
|
79
79
|
|
@@ -120,7 +120,21 @@ class Gitlab::Client
|
|
120
120
|
# @return [Gitlab::ObjectifiedHash]
|
121
121
|
# @note This method doesn't require private_token to be set.
|
122
122
|
def session(email, password)
|
123
|
-
post(
|
123
|
+
post('/session', body: { email: email, password: password }, unauthenticated: true)
|
124
|
+
end
|
125
|
+
|
126
|
+
# Gets a list of user activities (for admin access only).
|
127
|
+
#
|
128
|
+
# @example
|
129
|
+
# Gitlab.activities
|
130
|
+
#
|
131
|
+
# @param [Hash] options A customizable set of options.
|
132
|
+
# @option options [Integer] :page The page number.
|
133
|
+
# @option options [Integer] :per_page The number of results per page.
|
134
|
+
# @option options [String] :from The start date for paginated results.
|
135
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
136
|
+
def activities(options = {})
|
137
|
+
get('/user/activities', query: options)
|
124
138
|
end
|
125
139
|
|
126
140
|
# Gets a list of user's SSH keys.
|
@@ -134,10 +148,10 @@ class Gitlab::Client
|
|
134
148
|
# @option options [Integer] :per_page The number of results per page.
|
135
149
|
# @option options [Integer] :user_id The ID of the user to retrieve the keys for.
|
136
150
|
# @return [Array<Gitlab::ObjectifiedHash>]
|
137
|
-
def ssh_keys(options={})
|
151
|
+
def ssh_keys(options = {})
|
138
152
|
user_id = options.delete :user_id
|
139
153
|
if user_id.to_i.zero?
|
140
|
-
get(
|
154
|
+
get('/user/keys', query: options)
|
141
155
|
else
|
142
156
|
get("/users/#{user_id}/keys", query: options)
|
143
157
|
end
|
@@ -161,9 +175,16 @@ class Gitlab::Client
|
|
161
175
|
#
|
162
176
|
# @param [String] title The title of an SSH key.
|
163
177
|
# @param [String] key The SSH key body.
|
178
|
+
# @param [Hash] options A customizable set of options.
|
179
|
+
# @option options [Integer] :user_id id of the user to associate the key with
|
164
180
|
# @return [Gitlab::ObjectifiedHash] Information about created SSH key.
|
165
|
-
def create_ssh_key(title, key)
|
166
|
-
|
181
|
+
def create_ssh_key(title, key, options = {})
|
182
|
+
user_id = options.delete :user_id
|
183
|
+
if user_id.to_i.zero?
|
184
|
+
post('/user/keys', body: { title: title, key: key })
|
185
|
+
else
|
186
|
+
post("/users/#{user_id}/keys", body: { title: title, key: key })
|
187
|
+
end
|
167
188
|
end
|
168
189
|
|
169
190
|
# Deletes an SSH key.
|
@@ -172,9 +193,16 @@ class Gitlab::Client
|
|
172
193
|
# Gitlab.delete_ssh_key(1)
|
173
194
|
#
|
174
195
|
# @param [Integer] id The ID of a user's SSH key.
|
196
|
+
# @param [Hash] options A customizable set of options.
|
197
|
+
# @option options [Integer] :user_id id of the user to associate the key with
|
175
198
|
# @return [Gitlab::ObjectifiedHash] Information about deleted SSH key.
|
176
|
-
def delete_ssh_key(id)
|
177
|
-
delete
|
199
|
+
def delete_ssh_key(id, options = {})
|
200
|
+
user_id = options.delete :user_id
|
201
|
+
if user_id.to_i.zero?
|
202
|
+
delete("/user/keys/#{id}")
|
203
|
+
else
|
204
|
+
delete("/users/#{user_id}/keys/#{id}")
|
205
|
+
end
|
178
206
|
end
|
179
207
|
|
180
208
|
# Gets user emails.
|
@@ -186,8 +214,8 @@ class Gitlab::Client
|
|
186
214
|
#
|
187
215
|
# @param [Integer] user_id The ID of a user.
|
188
216
|
# @return [Gitlab::ObjectifiedHash]
|
189
|
-
def emails(user_id=nil)
|
190
|
-
url = user_id.to_i.zero? ?
|
217
|
+
def emails(user_id = nil)
|
218
|
+
url = user_id.to_i.zero? ? '/user/emails' : "/users/#{user_id}/emails"
|
191
219
|
get(url)
|
192
220
|
end
|
193
221
|
|
@@ -211,10 +239,15 @@ class Gitlab::Client
|
|
211
239
|
#
|
212
240
|
# @param [String] email Email address
|
213
241
|
# @param [Integer] user_id The ID of a user.
|
242
|
+
# @param [Boolean] skip_confirmation Skip confirmation and assume e-mail is verified
|
214
243
|
# @return [Gitlab::ObjectifiedHash]
|
215
|
-
def add_email(email, user_id=nil)
|
216
|
-
url = user_id.to_i.zero? ?
|
217
|
-
|
244
|
+
def add_email(email, user_id = nil, skip_confirmation = nil)
|
245
|
+
url = user_id.to_i.zero? ? '/user/emails' : "/users/#{user_id}/emails"
|
246
|
+
if skip_confirmation.nil?
|
247
|
+
post(url, body: { email: email })
|
248
|
+
else
|
249
|
+
post(url, body: { email: email, skip_confirmation: skip_confirmation })
|
250
|
+
end
|
218
251
|
end
|
219
252
|
|
220
253
|
# Delete email
|
@@ -227,7 +260,7 @@ class Gitlab::Client
|
|
227
260
|
# @param [Integer] id Email address ID
|
228
261
|
# @param [Integer] user_id The ID of a user.
|
229
262
|
# @return [Boolean]
|
230
|
-
def delete_email(id, user_id=nil)
|
263
|
+
def delete_email(id, user_id = nil)
|
231
264
|
url = user_id.to_i.zero? ? "/user/emails/#{id}" : "/users/#{user_id}/emails/#{id}"
|
232
265
|
delete(url)
|
233
266
|
end
|
@@ -242,9 +275,112 @@ class Gitlab::Client
|
|
242
275
|
# @option options [String] :per_page Number of user to return per page
|
243
276
|
# @option options [String] :page The page to retrieve
|
244
277
|
# @return [Array<Gitlab::ObjectifiedHash>]
|
245
|
-
def user_search(search, options={})
|
278
|
+
def user_search(search, options = {})
|
246
279
|
options[:search] = search
|
247
|
-
get(
|
280
|
+
get('/users', query: options)
|
281
|
+
end
|
282
|
+
|
283
|
+
# Gets user custom_attributes.
|
284
|
+
#
|
285
|
+
# @example
|
286
|
+
# Gitlab.user_custom_attributes(2)
|
287
|
+
#
|
288
|
+
# @param [Integer] user_id The ID of a user.
|
289
|
+
# @return [Gitlab::ObjectifiedHash]
|
290
|
+
def user_custom_attributes(user_id)
|
291
|
+
get("/users/#{user_id}/custom_attributes")
|
292
|
+
end
|
293
|
+
|
294
|
+
# Gets single user custom_attribute.
|
295
|
+
#
|
296
|
+
# @example
|
297
|
+
# Gitlab.user_custom_attribute(key, 2)
|
298
|
+
#
|
299
|
+
# @param [String] key The custom_attributes key
|
300
|
+
# @param [Integer] user_id The ID of a user.
|
301
|
+
# @return [Gitlab::ObjectifiedHash]
|
302
|
+
def user_custom_attribute(key, user_id)
|
303
|
+
get("/users/#{user_id}/custom_attributes/#{key}")
|
304
|
+
end
|
305
|
+
|
306
|
+
# Creates a new custom_attribute
|
307
|
+
#
|
308
|
+
# @example
|
309
|
+
# Gitlab.add_custom_attribute('some_new_key', 'some_new_value', 2)
|
310
|
+
#
|
311
|
+
# @param [String] key The custom_attributes key
|
312
|
+
# @param [String] value The custom_attributes value
|
313
|
+
# @param [Integer] user_id The ID of a user.
|
314
|
+
# @return [Gitlab::ObjectifiedHash]
|
315
|
+
def add_user_custom_attribute(key, value, user_id)
|
316
|
+
url = "/users/#{user_id}/custom_attributes/#{key}"
|
317
|
+
put(url, body: { value: value })
|
318
|
+
end
|
319
|
+
|
320
|
+
# Delete custom_attribute
|
321
|
+
# Will delete a custom_attribute
|
322
|
+
#
|
323
|
+
# @example
|
324
|
+
# Gitlab.delete_user_custom_attribute('somekey', 2)
|
325
|
+
#
|
326
|
+
# @param [String] key The custom_attribute key to delete
|
327
|
+
# @param [Integer] user_id The ID of a user.
|
328
|
+
# @return [Boolean]
|
329
|
+
def delete_user_custom_attribute(key, user_id)
|
330
|
+
delete("/users/#{user_id}/custom_attributes/#{key}")
|
331
|
+
end
|
332
|
+
|
333
|
+
# Get all impersonation tokens for a user
|
334
|
+
#
|
335
|
+
# @example
|
336
|
+
# Gitlab.user_impersonation_tokens(1)
|
337
|
+
#
|
338
|
+
# @param [Integer] user_id The ID of the user.
|
339
|
+
# @param [String] state Filter impersonation tokens by state {}
|
340
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
341
|
+
def user_impersonation_tokens(user_id)
|
342
|
+
get("/users/#{user_id}/impersonation_tokens")
|
343
|
+
end
|
344
|
+
|
345
|
+
# Get impersonation token information
|
346
|
+
#
|
347
|
+
# @example
|
348
|
+
# Gitlab.user_impersonation_token(1, 1)
|
349
|
+
#
|
350
|
+
# @param [Integer] user_id The ID of the user.
|
351
|
+
# @param [Integer] impersonation_token_id ID of the impersonation token.
|
352
|
+
# @return [Gitlab::ObjectifiedHash]
|
353
|
+
def user_impersonation_token(user_id, impersonation_token_id)
|
354
|
+
get("/users/#{user_id}/impersonation_tokens/#{impersonation_token_id}")
|
355
|
+
end
|
356
|
+
|
357
|
+
# Create impersonation token
|
358
|
+
#
|
359
|
+
# @example
|
360
|
+
# Gitlab.create_user_impersonation_token(2, "token", ["api", "read_user"])
|
361
|
+
# Gitlab.create_user_impersonation_token(2, "token", ["api", "read_user"], "1970-01-01")
|
362
|
+
#
|
363
|
+
# @param [Integer] user_id The ID of the user.
|
364
|
+
# @param [String] name Name for impersonation token.
|
365
|
+
# @param [Array<String>] scopes Array of scopes for the impersonation token
|
366
|
+
# @param [String] expires_at Date for impersonation token expiration in ISO format.
|
367
|
+
# @return [Gitlab::ObjectifiedHash]
|
368
|
+
def create_user_impersonation_token(user_id, name, scopes, expires_at = nil)
|
369
|
+
body = { name: name, scopes: scopes }
|
370
|
+
body[:expires_at] = expires_at if expires_at
|
371
|
+
post("/users/#{user_id}/impersonation_tokens", body: body)
|
372
|
+
end
|
373
|
+
|
374
|
+
# Revoke an impersonation token
|
375
|
+
#
|
376
|
+
# @example
|
377
|
+
# Gitlab.revoke_user_impersonation_token(1, 1)
|
378
|
+
#
|
379
|
+
# @param [Integer] user_id The ID of the user.
|
380
|
+
# @param [Integer] impersonation_token_id ID of the impersonation token.
|
381
|
+
# @return [Gitlab::ObjectifiedHash]
|
382
|
+
def revoke_user_impersonation_token(user_id, impersonation_token_id)
|
383
|
+
delete("/users/#{user_id}/impersonation_tokens/#{impersonation_token_id}")
|
248
384
|
end
|
249
385
|
end
|
250
386
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Gitlab::Client
|
4
|
+
# Defines methods related to version
|
5
|
+
# @see https://docs.gitlab.com/ce/api/version.html
|
6
|
+
module Versions
|
7
|
+
# Returns server version.
|
8
|
+
# @see https://docs.gitlab.com/ce/api/version.html
|
9
|
+
#
|
10
|
+
# @example
|
11
|
+
# Gitlab.version
|
12
|
+
#
|
13
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
14
|
+
def version
|
15
|
+
get('/version')
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|