gitlab 4.6.0 → 4.6.1

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