gitlab 4.5.0 → 4.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/.github/stale.yml +18 -0
  3. data/.rubocop_todo.yml +46 -0
  4. data/Gemfile +2 -0
  5. data/README.md +22 -22
  6. data/Rakefile +3 -5
  7. data/bin/console +1 -0
  8. data/exe/gitlab +5 -1
  9. data/gitlab.gemspec +9 -6
  10. data/lib/gitlab.rb +6 -3
  11. data/lib/gitlab/api.rb +5 -3
  12. data/lib/gitlab/cli.rb +11 -5
  13. data/lib/gitlab/cli_helpers.rb +31 -22
  14. data/lib/gitlab/client.rb +7 -8
  15. data/lib/gitlab/client/access_requests.rb +100 -93
  16. data/lib/gitlab/client/award_emojis.rb +127 -127
  17. data/lib/gitlab/client/boards.rb +82 -82
  18. data/lib/gitlab/client/branches.rb +89 -89
  19. data/lib/gitlab/client/build_variables.rb +117 -117
  20. data/lib/gitlab/client/builds.rb +98 -98
  21. data/lib/gitlab/client/commits.rb +154 -154
  22. data/lib/gitlab/client/deployments.rb +29 -29
  23. data/lib/gitlab/client/environments.rb +80 -80
  24. data/lib/gitlab/client/events.rb +54 -54
  25. data/lib/gitlab/client/group_milestones.rb +85 -86
  26. data/lib/gitlab/client/groups.rb +178 -178
  27. data/lib/gitlab/client/issues.rb +195 -196
  28. data/lib/gitlab/client/jobs.rb +150 -150
  29. data/lib/gitlab/client/keys.rb +14 -14
  30. data/lib/gitlab/client/labels.rb +79 -79
  31. data/lib/gitlab/client/merge_request_approvals.rb +102 -102
  32. data/lib/gitlab/client/merge_requests.rb +281 -256
  33. data/lib/gitlab/client/milestones.rb +85 -85
  34. data/lib/gitlab/client/namespaces.rb +18 -18
  35. data/lib/gitlab/client/notes.rb +260 -260
  36. data/lib/gitlab/client/pipeline_schedules.rb +123 -123
  37. data/lib/gitlab/client/pipeline_triggers.rb +93 -93
  38. data/lib/gitlab/client/pipelines.rb +62 -62
  39. data/lib/gitlab/client/projects.rb +526 -505
  40. data/lib/gitlab/client/repositories.rb +68 -55
  41. data/lib/gitlab/client/repository_files.rb +103 -103
  42. data/lib/gitlab/client/runners.rb +113 -115
  43. data/lib/gitlab/client/services.rb +46 -45
  44. data/lib/gitlab/client/sidekiq.rb +32 -32
  45. data/lib/gitlab/client/snippets.rb +86 -86
  46. data/lib/gitlab/client/system_hooks.rb +57 -57
  47. data/lib/gitlab/client/tags.rb +87 -88
  48. data/lib/gitlab/client/todos.rb +41 -41
  49. data/lib/gitlab/client/users.rb +242 -228
  50. data/lib/gitlab/client/versions.rb +16 -0
  51. data/lib/gitlab/configuration.rb +7 -5
  52. data/lib/gitlab/error.rb +3 -1
  53. data/lib/gitlab/file_response.rb +4 -2
  54. data/lib/gitlab/help.rb +9 -9
  55. data/lib/gitlab/objectified_hash.rb +5 -4
  56. data/lib/gitlab/page_links.rb +9 -7
  57. data/lib/gitlab/paginated_response.rb +14 -4
  58. data/lib/gitlab/request.rb +8 -5
  59. data/lib/gitlab/shell.rb +6 -4
  60. data/lib/gitlab/shell_history.rb +7 -5
  61. data/lib/gitlab/version.rb +3 -1
  62. metadata +8 -5
@@ -1,50 +1,51 @@
1
- class Gitlab::Client
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
- # Delete service
22
- #
23
- # @example
24
- # Gitlab.delete_service(42, :redmine)
25
- #
26
- # @param [Integer, String] project The ID or name of a project.
27
- # @param [String] service A service code name.
28
- # @return [Boolean]
29
- def delete_service(project, service)
30
- delete("/projects/#{url_encode project}/services/#{correct_service_name(service)}")
31
- end
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
- # Get service
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
- private
46
- def correct_service_name(service)
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
- class Gitlab::Client
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
- # Get the current Process Metrics
14
- #
15
- # @example
16
- # Gitlab.sidekiq_process_metrics
17
- def sidekiq_process_metrics
18
- get('/sidekiq/process_metrics')
19
- end
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
- # Get the current Job Statistics
22
- #
23
- # @example
24
- # Gitlab.sidekiq_job_stats
25
- def sidekiq_job_stats
26
- get('/sidekiq/job_stats')
27
- end
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
- # Get a compound response of all the previously mentioned metrics
30
- #
31
- # @example
32
- # Gitlab.sidekiq_compound_metrics
33
- def sidekiq_compound_metrics
34
- get('/sidekiq/compound_metrics')
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
- class Gitlab::Client
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
- # Gets information about a snippet.
20
- #
21
- # @example
22
- # Gitlab.snippet(2, 14)
23
- #
24
- # @param [Integer, String] project The ID or name of a project.
25
- # @param [Integer] id The ID of a snippet.
26
- # @return [Gitlab::ObjectifiedHash]
27
- def snippet(project, id)
28
- get("/projects/#{url_encode project}/snippets/#{id}")
29
- end
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
- # Creates a new snippet.
32
- #
33
- # @example
34
- # Gitlab.create_snippet(42, { title: 'REST', file_name: 'api.rb', code: 'some code', visibility: 'public'})
35
- #
36
- # @param [Integer, String] project The ID or name of a project.
37
- # @param [Hash] options A customizable set of options.
38
- # @option options [String] :title (required) The title of a snippet.
39
- # @option options [String] :file_name (required) The name of a snippet file.
40
- # @option options [String] :code (required) The content of a snippet.
41
- # @option options [String] :lifetime (optional) The expiration date of a snippet.
42
- # @option options [String] :visibility (required) The visibility of a snippet
43
- # @return [Gitlab::ObjectifiedHash] Information about created snippet.
44
- def create_snippet(project, options={})
45
- post("/projects/#{url_encode project}/snippets", body: options)
46
- end
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
- # Updates a snippet.
49
- #
50
- # @example
51
- # Gitlab.edit_snippet(42, 34, { file_name: 'README.txt' })
52
- #
53
- # @param [Integer, String] project The ID or name of a project.
54
- # @param [Integer] id The ID of a snippet.
55
- # @param [Hash] options A customizable set of options.
56
- # @option options [String] :title The title of a snippet.
57
- # @option options [String] :file_name The name of a snippet file.
58
- # @option options [String] :code The content of a snippet.
59
- # @option options [String] :lifetime The expiration date of a snippet.
60
- # @option options [String] :visibility (optional) The visibility of a snippet
61
- # @return [Gitlab::ObjectifiedHash] Information about updated snippet.
62
- def edit_snippet(project, id, options={})
63
- put("/projects/#{url_encode project}/snippets/#{id}", body: options)
64
- end
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
- # Deletes a snippet.
67
- #
68
- # @example
69
- # Gitlab.delete_snippet(2, 14)
70
- #
71
- # @param [Integer, String] project The ID or name of a project.
72
- # @param [Integer] id The ID of a snippet.
73
- # @return [Gitlab::ObjectifiedHash] Information about deleted snippet.
74
- def delete_snippet(project, id)
75
- delete("/projects/#{url_encode project}/snippets/#{id}")
76
- end
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
- # Returns raw project snippet content as plain text.
79
- #
80
- # @example
81
- # Gitlab.snippet_content(2, 14)
82
- #
83
- # @param [Integer, String] project The ID or name of a project.
84
- # @param [Integer] id The ID of a snippet.
85
- # @return [Gitlab::ObjectifiedHash] Information about deleted snippet.
86
- def snippet_content(project, id)
87
- get("/projects/#{url_encode project}/snippets/#{id}/raw",
88
- format: nil,
89
- headers: { Accept: 'text/plain' },
90
- parser: ::Gitlab::Request::Parser)
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
- class Gitlab::Client
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
- # Adds a new system hook.
21
- #
22
- # @example
23
- # Gitlab.add_hook('http://example.com/hook')
24
- # Gitlab.add_system_hook('https://api.example.net/v1/hook')
25
- #
26
- # @param [String] url The hook URL.
27
- # @param [Hash] options Additional options, as allowed by Gitlab API, including but not limited to:
28
- # @option options [String] :token A secret token for Gitlab to send in the `X-Gitlab-Token` header for authentication.
29
- # @option options [boolean] :enable_ssl_verification `false` will cause Gitlab to ignore invalid/unsigned certificate errors (default is `true`)
30
- # @return [Gitlab::ObjectifiedHash]
31
- def add_hook(url, options = {})
32
- post("/hooks", body: options.merge(url: url))
33
- end
34
- alias_method :add_system_hook, :add_hook
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
- # Tests a system hook.
37
- #
38
- # @example
39
- # Gitlab.hook(3)
40
- # Gitlab.system_hook(12)
41
- #
42
- # @param [Integer] id The ID of a system hook.
43
- # @return [Array<Gitlab::ObjectifiedHash>]
44
- def hook(id)
45
- get("/hooks/#{id}")
46
- end
47
- alias_method :system_hook, :hook
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
- # Deletes a new system hook.
50
- #
51
- # @example
52
- # Gitlab.delete_hook(3)
53
- # Gitlab.delete_system_hook(12)
54
- #
55
- # @param [Integer] id The ID of a system hook.
56
- # @return [Gitlab::ObjectifiedHash]
57
- def delete_hook(id)
58
- delete("/hooks/#{id}")
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