gitlab 4.5.0 → 4.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/stale.yml +18 -0
- data/.rubocop_todo.yml +46 -0
- data/Gemfile +2 -0
- data/README.md +22 -22
- data/Rakefile +3 -5
- data/bin/console +1 -0
- data/exe/gitlab +5 -1
- data/gitlab.gemspec +9 -6
- data/lib/gitlab.rb +6 -3
- data/lib/gitlab/api.rb +5 -3
- data/lib/gitlab/cli.rb +11 -5
- data/lib/gitlab/cli_helpers.rb +31 -22
- data/lib/gitlab/client.rb +7 -8
- data/lib/gitlab/client/access_requests.rb +100 -93
- data/lib/gitlab/client/award_emojis.rb +127 -127
- data/lib/gitlab/client/boards.rb +82 -82
- data/lib/gitlab/client/branches.rb +89 -89
- data/lib/gitlab/client/build_variables.rb +117 -117
- data/lib/gitlab/client/builds.rb +98 -98
- data/lib/gitlab/client/commits.rb +154 -154
- data/lib/gitlab/client/deployments.rb +29 -29
- data/lib/gitlab/client/environments.rb +80 -80
- data/lib/gitlab/client/events.rb +54 -54
- data/lib/gitlab/client/group_milestones.rb +85 -86
- data/lib/gitlab/client/groups.rb +178 -178
- data/lib/gitlab/client/issues.rb +195 -196
- data/lib/gitlab/client/jobs.rb +150 -150
- data/lib/gitlab/client/keys.rb +14 -14
- data/lib/gitlab/client/labels.rb +79 -79
- data/lib/gitlab/client/merge_request_approvals.rb +102 -102
- data/lib/gitlab/client/merge_requests.rb +281 -256
- data/lib/gitlab/client/milestones.rb +85 -85
- data/lib/gitlab/client/namespaces.rb +18 -18
- data/lib/gitlab/client/notes.rb +260 -260
- data/lib/gitlab/client/pipeline_schedules.rb +123 -123
- data/lib/gitlab/client/pipeline_triggers.rb +93 -93
- data/lib/gitlab/client/pipelines.rb +62 -62
- data/lib/gitlab/client/projects.rb +526 -505
- data/lib/gitlab/client/repositories.rb +68 -55
- data/lib/gitlab/client/repository_files.rb +103 -103
- data/lib/gitlab/client/runners.rb +113 -115
- data/lib/gitlab/client/services.rb +46 -45
- data/lib/gitlab/client/sidekiq.rb +32 -32
- data/lib/gitlab/client/snippets.rb +86 -86
- data/lib/gitlab/client/system_hooks.rb +57 -57
- data/lib/gitlab/client/tags.rb +87 -88
- data/lib/gitlab/client/todos.rb +41 -41
- data/lib/gitlab/client/users.rb +242 -228
- data/lib/gitlab/client/versions.rb +16 -0
- data/lib/gitlab/configuration.rb +7 -5
- data/lib/gitlab/error.rb +3 -1
- data/lib/gitlab/file_response.rb +4 -2
- data/lib/gitlab/help.rb +9 -9
- data/lib/gitlab/objectified_hash.rb +5 -4
- data/lib/gitlab/page_links.rb +9 -7
- data/lib/gitlab/paginated_response.rb +14 -4
- data/lib/gitlab/request.rb +8 -5
- data/lib/gitlab/shell.rb +6 -4
- data/lib/gitlab/shell_history.rb +7 -5
- data/lib/gitlab/version.rb +3 -1
- metadata +8 -5
@@ -1,50 +1,51 @@
|
|
1
|
-
|
2
|
-
# Third party services connected to a project.
|
3
|
-
# @see https://docs.gitlab.com/ce/api/services.html
|
4
|
-
module Services
|
5
|
-
# Create/Edit service
|
6
|
-
# Full service params documentation: https://github.com/gitlabhq/gitlabhq/blob/master/doc/api/services.md
|
7
|
-
#
|
8
|
-
# @example
|
9
|
-
# Gitlab.change_service(42, :redmine, { new_issue_url: 'https://example.com/projects/test_project/issues/new',
|
10
|
-
# project_url: 'https://example.com/projects/test_project/issues',
|
11
|
-
# issues_url: 'https://example.com/issues/:id' })
|
12
|
-
#
|
13
|
-
# @param [Integer, String] project The ID or name of a project.
|
14
|
-
# @param [String] service A service code name.
|
15
|
-
# @param [Hash] params A service parameters.
|
16
|
-
# @return [Boolean]
|
17
|
-
def change_service(project, service, params)
|
18
|
-
put("/projects/#{url_encode project}/services/#{correct_service_name(service)}", body: params)
|
19
|
-
end
|
1
|
+
# frozen_string_literal: true
|
20
2
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
3
|
+
# Third party services connected to a project.
|
4
|
+
# @see https://docs.gitlab.com/ce/api/services.html
|
5
|
+
module Services
|
6
|
+
# Create/Edit service
|
7
|
+
# Full service params documentation: https://github.com/gitlabhq/gitlabhq/blob/master/doc/api/services.md
|
8
|
+
#
|
9
|
+
# @example
|
10
|
+
# Gitlab.change_service(42, :redmine, { new_issue_url: 'https://example.com/projects/test_project/issues/new',
|
11
|
+
# project_url: 'https://example.com/projects/test_project/issues',
|
12
|
+
# issues_url: 'https://example.com/issues/:id' })
|
13
|
+
#
|
14
|
+
# @param [Integer, String] project The ID or name of a project.
|
15
|
+
# @param [String] service A service code name.
|
16
|
+
# @param [Hash] params A service parameters.
|
17
|
+
# @return [Boolean]
|
18
|
+
def change_service(project, service, params)
|
19
|
+
put("/projects/#{url_encode project}/services/#{correct_service_name(service)}", body: params)
|
20
|
+
end
|
21
|
+
|
22
|
+
# Delete service
|
23
|
+
#
|
24
|
+
# @example
|
25
|
+
# Gitlab.delete_service(42, :redmine)
|
26
|
+
#
|
27
|
+
# @param [Integer, String] project The ID or name of a project.
|
28
|
+
# @param [String] service A service code name.
|
29
|
+
# @return [Boolean]
|
30
|
+
def delete_service(project, service)
|
31
|
+
delete("/projects/#{url_encode project}/services/#{correct_service_name(service)}")
|
32
|
+
end
|
33
|
+
|
34
|
+
# Get service
|
35
|
+
#
|
36
|
+
# @example
|
37
|
+
# Gitlab.service(42, :redmine)
|
38
|
+
#
|
39
|
+
# @param [Integer, String] project The ID or name of a project.
|
40
|
+
# @param [String] service A service code name.
|
41
|
+
# @return [Gitlab::ObjectifiedHash]
|
42
|
+
def service(project, service)
|
43
|
+
get("/projects/#{url_encode project}/services/#{correct_service_name(service)}")
|
44
|
+
end
|
32
45
|
|
33
|
-
|
34
|
-
#
|
35
|
-
# @example
|
36
|
-
# Gitlab.service(42, :redmine)
|
37
|
-
#
|
38
|
-
# @param [Integer, String] project The ID or name of a project.
|
39
|
-
# @param [String] service A service code name.
|
40
|
-
# @return [Gitlab::ObjectifiedHash]
|
41
|
-
def service(project, service)
|
42
|
-
get("/projects/#{url_encode project}/services/#{correct_service_name(service)}")
|
43
|
-
end
|
46
|
+
private
|
44
47
|
|
45
|
-
|
46
|
-
|
47
|
-
service.to_s.gsub('_', '-')
|
48
|
-
end
|
48
|
+
def correct_service_name(service)
|
49
|
+
service.to_s.tr('_', '-')
|
49
50
|
end
|
50
51
|
end
|
@@ -1,37 +1,37 @@
|
|
1
|
-
|
2
|
-
# Defines methods related to sidekiq metrics.
|
3
|
-
# @see https://docs.gitlab.com/ce/api/sidekiq_metrics.html
|
4
|
-
module Sidekiq
|
5
|
-
# Get the current Queue Metrics
|
6
|
-
#
|
7
|
-
# @example
|
8
|
-
# Gitlab.sidekiq_queue_metrics
|
9
|
-
def sidekiq_queue_metrics
|
10
|
-
get('/sidekiq/queue_metrics')
|
11
|
-
end
|
1
|
+
# frozen_string_literal: true
|
12
2
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
3
|
+
# Defines methods related to sidekiq metrics.
|
4
|
+
# @see https://docs.gitlab.com/ce/api/sidekiq_metrics.html
|
5
|
+
module Sidekiq
|
6
|
+
# Get the current Queue Metrics
|
7
|
+
#
|
8
|
+
# @example
|
9
|
+
# Gitlab.sidekiq_queue_metrics
|
10
|
+
def sidekiq_queue_metrics
|
11
|
+
get('/sidekiq/queue_metrics')
|
12
|
+
end
|
13
|
+
|
14
|
+
# Get the current Process Metrics
|
15
|
+
#
|
16
|
+
# @example
|
17
|
+
# Gitlab.sidekiq_process_metrics
|
18
|
+
def sidekiq_process_metrics
|
19
|
+
get('/sidekiq/process_metrics')
|
20
|
+
end
|
20
21
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
22
|
+
# Get the current Job Statistics
|
23
|
+
#
|
24
|
+
# @example
|
25
|
+
# Gitlab.sidekiq_job_stats
|
26
|
+
def sidekiq_job_stats
|
27
|
+
get('/sidekiq/job_stats')
|
28
|
+
end
|
28
29
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
end
|
30
|
+
# Get a compound response of all the previously mentioned metrics
|
31
|
+
#
|
32
|
+
# @example
|
33
|
+
# Gitlab.sidekiq_compound_metrics
|
34
|
+
def sidekiq_compound_metrics
|
35
|
+
get('/sidekiq/compound_metrics')
|
36
36
|
end
|
37
37
|
end
|
@@ -1,93 +1,93 @@
|
|
1
|
-
|
2
|
-
# Defines methods related to snippets.
|
3
|
-
# @see https://docs.gitlab.com/ce/api/project_snippets.html
|
4
|
-
module Snippets
|
5
|
-
# Gets a list of project's snippets.
|
6
|
-
#
|
7
|
-
# @example
|
8
|
-
# Gitlab.snippets(42)
|
9
|
-
#
|
10
|
-
# @param [Integer, String] project The ID or name of a project.
|
11
|
-
# @param [Hash] options A customizable set of options.
|
12
|
-
# @option options [Integer] :page The page number.
|
13
|
-
# @option options [Integer] :per_page The number of results per page.
|
14
|
-
# @return [Gitlab::ObjectifiedHash]
|
15
|
-
def snippets(project, options={})
|
16
|
-
get("/projects/#{url_encode project}/snippets", query: options)
|
17
|
-
end
|
1
|
+
# frozen_string_literal: true
|
18
2
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
3
|
+
# Defines methods related to snippets.
|
4
|
+
# @see https://docs.gitlab.com/ce/api/project_snippets.html
|
5
|
+
module Snippets
|
6
|
+
# Gets a list of project's snippets.
|
7
|
+
#
|
8
|
+
# @example
|
9
|
+
# Gitlab.snippets(42)
|
10
|
+
#
|
11
|
+
# @param [Integer, String] project The ID or name of a project.
|
12
|
+
# @param [Hash] options A customizable set of options.
|
13
|
+
# @option options [Integer] :page The page number.
|
14
|
+
# @option options [Integer] :per_page The number of results per page.
|
15
|
+
# @return [Gitlab::ObjectifiedHash]
|
16
|
+
def snippets(project, options = {})
|
17
|
+
get("/projects/#{url_encode project}/snippets", query: options)
|
18
|
+
end
|
19
|
+
|
20
|
+
# Gets information about a snippet.
|
21
|
+
#
|
22
|
+
# @example
|
23
|
+
# Gitlab.snippet(2, 14)
|
24
|
+
#
|
25
|
+
# @param [Integer, String] project The ID or name of a project.
|
26
|
+
# @param [Integer] id The ID of a snippet.
|
27
|
+
# @return [Gitlab::ObjectifiedHash]
|
28
|
+
def snippet(project, id)
|
29
|
+
get("/projects/#{url_encode project}/snippets/#{id}")
|
30
|
+
end
|
30
31
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
32
|
+
# Creates a new snippet.
|
33
|
+
#
|
34
|
+
# @example
|
35
|
+
# Gitlab.create_snippet(42, { title: 'REST', file_name: 'api.rb', code: 'some code', visibility: 'public'})
|
36
|
+
#
|
37
|
+
# @param [Integer, String] project The ID or name of a project.
|
38
|
+
# @param [Hash] options A customizable set of options.
|
39
|
+
# @option options [String] :title (required) The title of a snippet.
|
40
|
+
# @option options [String] :file_name (required) The name of a snippet file.
|
41
|
+
# @option options [String] :code (required) The content of a snippet.
|
42
|
+
# @option options [String] :lifetime (optional) The expiration date of a snippet.
|
43
|
+
# @option options [String] :visibility (required) The visibility of a snippet
|
44
|
+
# @return [Gitlab::ObjectifiedHash] Information about created snippet.
|
45
|
+
def create_snippet(project, options = {})
|
46
|
+
post("/projects/#{url_encode project}/snippets", body: options)
|
47
|
+
end
|
47
48
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
49
|
+
# Updates a snippet.
|
50
|
+
#
|
51
|
+
# @example
|
52
|
+
# Gitlab.edit_snippet(42, 34, { file_name: 'README.txt' })
|
53
|
+
#
|
54
|
+
# @param [Integer, String] project The ID or name of a project.
|
55
|
+
# @param [Integer] id The ID of a snippet.
|
56
|
+
# @param [Hash] options A customizable set of options.
|
57
|
+
# @option options [String] :title The title of a snippet.
|
58
|
+
# @option options [String] :file_name The name of a snippet file.
|
59
|
+
# @option options [String] :code The content of a snippet.
|
60
|
+
# @option options [String] :lifetime The expiration date of a snippet.
|
61
|
+
# @option options [String] :visibility (optional) The visibility of a snippet
|
62
|
+
# @return [Gitlab::ObjectifiedHash] Information about updated snippet.
|
63
|
+
def edit_snippet(project, id, options = {})
|
64
|
+
put("/projects/#{url_encode project}/snippets/#{id}", body: options)
|
65
|
+
end
|
65
66
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
67
|
+
# Deletes a snippet.
|
68
|
+
#
|
69
|
+
# @example
|
70
|
+
# Gitlab.delete_snippet(2, 14)
|
71
|
+
#
|
72
|
+
# @param [Integer, String] project The ID or name of a project.
|
73
|
+
# @param [Integer] id The ID of a snippet.
|
74
|
+
# @return [Gitlab::ObjectifiedHash] Information about deleted snippet.
|
75
|
+
def delete_snippet(project, id)
|
76
|
+
delete("/projects/#{url_encode project}/snippets/#{id}")
|
77
|
+
end
|
77
78
|
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
end
|
79
|
+
# Returns raw project snippet content as plain text.
|
80
|
+
#
|
81
|
+
# @example
|
82
|
+
# Gitlab.snippet_content(2, 14)
|
83
|
+
#
|
84
|
+
# @param [Integer, String] project The ID or name of a project.
|
85
|
+
# @param [Integer] id The ID of a snippet.
|
86
|
+
# @return [Gitlab::ObjectifiedHash] Information about deleted snippet.
|
87
|
+
def snippet_content(project, id)
|
88
|
+
get("/projects/#{url_encode project}/snippets/#{id}/raw",
|
89
|
+
format: nil,
|
90
|
+
headers: { Accept: 'text/plain' },
|
91
|
+
parser: ::Gitlab::Request::Parser)
|
92
92
|
end
|
93
93
|
end
|
@@ -1,62 +1,62 @@
|
|
1
|
-
|
2
|
-
# Defines methods related to system hooks.
|
3
|
-
# @see https://docs.gitlab.com/ce/api/system_hooks.html
|
4
|
-
module SystemHooks
|
5
|
-
# Gets a list of system hooks.
|
6
|
-
#
|
7
|
-
# @example
|
8
|
-
# Gitlab.hooks
|
9
|
-
# Gitlab.system_hooks
|
10
|
-
#
|
11
|
-
# @param [Hash] options A customizable set of options.
|
12
|
-
# @option options [Integer] :page The page number.
|
13
|
-
# @option options [Integer] :per_page The number of results per page.
|
14
|
-
# @return [Array<Gitlab::ObjectifiedHash>]
|
15
|
-
def hooks(options={})
|
16
|
-
get("/hooks", query: options)
|
17
|
-
end
|
18
|
-
alias_method :system_hooks, :hooks
|
1
|
+
# frozen_string_literal: true
|
19
2
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
3
|
+
# Defines methods related to system hooks.
|
4
|
+
# @see https://docs.gitlab.com/ce/api/system_hooks.html
|
5
|
+
module SystemHooks
|
6
|
+
# Gets a list of system hooks.
|
7
|
+
#
|
8
|
+
# @example
|
9
|
+
# Gitlab.hooks
|
10
|
+
# Gitlab.system_hooks
|
11
|
+
#
|
12
|
+
# @param [Hash] options A customizable set of options.
|
13
|
+
# @option options [Integer] :page The page number.
|
14
|
+
# @option options [Integer] :per_page The number of results per page.
|
15
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
16
|
+
def hooks(options = {})
|
17
|
+
get('/hooks', query: options)
|
18
|
+
end
|
19
|
+
alias system_hooks hooks
|
20
|
+
|
21
|
+
# Adds a new system hook.
|
22
|
+
#
|
23
|
+
# @example
|
24
|
+
# Gitlab.add_hook('http://example.com/hook')
|
25
|
+
# Gitlab.add_system_hook('https://api.example.net/v1/hook')
|
26
|
+
#
|
27
|
+
# @param [String] url The hook URL.
|
28
|
+
# @param [Hash] options Additional options, as allowed by Gitlab API, including but not limited to:
|
29
|
+
# @option options [String] :token A secret token for Gitlab to send in the `X-Gitlab-Token` header for authentication.
|
30
|
+
# @option options [boolean] :enable_ssl_verification `false` will cause Gitlab to ignore invalid/unsigned certificate errors (default is `true`)
|
31
|
+
# @return [Gitlab::ObjectifiedHash]
|
32
|
+
def add_hook(url, options = {})
|
33
|
+
post('/hooks', body: options.merge(url: url))
|
34
|
+
end
|
35
|
+
alias add_system_hook add_hook
|
35
36
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
37
|
+
# Tests a system hook.
|
38
|
+
#
|
39
|
+
# @example
|
40
|
+
# Gitlab.hook(3)
|
41
|
+
# Gitlab.system_hook(12)
|
42
|
+
#
|
43
|
+
# @param [Integer] id The ID of a system hook.
|
44
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
45
|
+
def hook(id)
|
46
|
+
get("/hooks/#{id}")
|
47
|
+
end
|
48
|
+
alias system_hook hook
|
48
49
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
end
|
60
|
-
alias_method :delete_system_hook, :delete_hook
|
50
|
+
# Deletes a new system hook.
|
51
|
+
#
|
52
|
+
# @example
|
53
|
+
# Gitlab.delete_hook(3)
|
54
|
+
# Gitlab.delete_system_hook(12)
|
55
|
+
#
|
56
|
+
# @param [Integer] id The ID of a system hook.
|
57
|
+
# @return [Gitlab::ObjectifiedHash]
|
58
|
+
def delete_hook(id)
|
59
|
+
delete("/hooks/#{id}")
|
61
60
|
end
|
61
|
+
alias delete_system_hook delete_hook
|
62
62
|
end
|