gitlab 4.5.0 → 5.1.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 (96) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +0 -267
  3. data/LICENSE.txt +1 -1
  4. data/README.md +40 -30
  5. data/exe/gitlab +5 -1
  6. data/lib/gitlab/api.rb +7 -3
  7. data/lib/gitlab/cli.rb +13 -9
  8. data/lib/gitlab/cli_helpers.rb +49 -45
  9. data/lib/gitlab/client/access_requests.rb +10 -1
  10. data/lib/gitlab/client/application_settings.rb +172 -0
  11. data/lib/gitlab/client/avatar.rb +21 -0
  12. data/lib/gitlab/client/award_emojis.rb +5 -3
  13. data/lib/gitlab/client/boards.rb +62 -4
  14. data/lib/gitlab/client/branches.rb +47 -8
  15. data/lib/gitlab/client/broadcast_messages.rb +75 -0
  16. data/lib/gitlab/client/build_variables.rb +19 -12
  17. data/lib/gitlab/client/builds.rb +13 -11
  18. data/lib/gitlab/client/commits.rb +73 -21
  19. data/lib/gitlab/client/container_registry.rb +85 -0
  20. data/lib/gitlab/client/deployments.rb +3 -1
  21. data/lib/gitlab/client/environments.rb +5 -3
  22. data/lib/gitlab/client/epic_issues.rb +23 -0
  23. data/lib/gitlab/client/epics.rb +73 -0
  24. data/lib/gitlab/client/events.rb +6 -4
  25. data/lib/gitlab/client/features.rb +48 -0
  26. data/lib/gitlab/client/group_badges.rb +88 -0
  27. data/lib/gitlab/client/group_boards.rb +141 -0
  28. data/lib/gitlab/client/group_labels.rb +88 -0
  29. data/lib/gitlab/client/group_milestones.rb +7 -6
  30. data/lib/gitlab/client/groups.rb +326 -12
  31. data/lib/gitlab/client/issue_links.rb +48 -0
  32. data/lib/gitlab/client/issues.rb +47 -13
  33. data/lib/gitlab/client/jobs.rb +96 -8
  34. data/lib/gitlab/client/keys.rb +13 -0
  35. data/lib/gitlab/client/labels.rb +6 -4
  36. data/lib/gitlab/client/lint.rb +19 -0
  37. data/lib/gitlab/client/markdown.rb +23 -0
  38. data/lib/gitlab/client/merge_request_approvals.rb +164 -9
  39. data/lib/gitlab/client/merge_requests.rb +148 -11
  40. data/lib/gitlab/client/merge_trains.rb +55 -0
  41. data/lib/gitlab/client/milestones.rb +19 -5
  42. data/lib/gitlab/client/namespaces.rb +4 -2
  43. data/lib/gitlab/client/notes.rb +38 -9
  44. data/lib/gitlab/client/packages.rb +95 -0
  45. data/lib/gitlab/client/pipeline_schedules.rb +36 -10
  46. data/lib/gitlab/client/pipeline_triggers.rb +10 -8
  47. data/lib/gitlab/client/pipelines.rb +65 -3
  48. data/lib/gitlab/client/project_badges.rb +85 -0
  49. data/lib/gitlab/client/project_clusters.rb +83 -0
  50. data/lib/gitlab/client/project_exports.rb +54 -0
  51. data/lib/gitlab/client/project_release_links.rb +76 -0
  52. data/lib/gitlab/client/project_releases.rb +90 -0
  53. data/lib/gitlab/client/projects.rb +307 -26
  54. data/lib/gitlab/client/protected_tags.rb +59 -0
  55. data/lib/gitlab/client/remote_mirrors.rb +51 -0
  56. data/lib/gitlab/client/repositories.rb +77 -6
  57. data/lib/gitlab/client/repository_files.rb +21 -3
  58. data/lib/gitlab/client/repository_submodules.rb +27 -0
  59. data/lib/gitlab/client/resource_label_events.rb +82 -0
  60. data/lib/gitlab/client/resource_state_events.rb +57 -0
  61. data/lib/gitlab/client/runners.rb +170 -18
  62. data/lib/gitlab/client/search.rb +66 -0
  63. data/lib/gitlab/client/services.rb +4 -1
  64. data/lib/gitlab/client/sidekiq.rb +2 -0
  65. data/lib/gitlab/client/snippets.rb +5 -3
  66. data/lib/gitlab/client/system_hooks.rb +9 -7
  67. data/lib/gitlab/client/tags.rb +10 -9
  68. data/lib/gitlab/client/templates.rb +100 -0
  69. data/lib/gitlab/client/todos.rb +7 -5
  70. data/lib/gitlab/client/user_snippets.rb +114 -0
  71. data/lib/gitlab/client/users.rb +302 -31
  72. data/lib/gitlab/client/versions.rb +18 -0
  73. data/lib/gitlab/client/wikis.rb +79 -0
  74. data/lib/gitlab/client.rb +48 -9
  75. data/lib/gitlab/configuration.rb +9 -6
  76. data/lib/gitlab/error.rb +73 -3
  77. data/lib/gitlab/file_response.rb +4 -2
  78. data/lib/gitlab/headers/page_links.rb +37 -0
  79. data/lib/gitlab/headers/total.rb +29 -0
  80. data/lib/gitlab/help.rb +16 -16
  81. data/lib/gitlab/objectified_hash.rb +27 -10
  82. data/lib/gitlab/paginated_response.rb +43 -25
  83. data/lib/gitlab/request.rb +51 -37
  84. data/lib/gitlab/shell.rb +6 -4
  85. data/lib/gitlab/shell_history.rb +11 -13
  86. data/lib/gitlab/version.rb +3 -1
  87. data/lib/gitlab.rb +23 -9
  88. metadata +59 -45
  89. data/.gitignore +0 -22
  90. data/CONTRIBUTING.md +0 -195
  91. data/Gemfile +0 -4
  92. data/Rakefile +0 -17
  93. data/bin/console +0 -10
  94. data/bin/setup +0 -6
  95. data/gitlab.gemspec +0 -33
  96. data/lib/gitlab/page_links.rb +0 -33
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Gitlab::Client
2
4
  # Defines methods related to snippets.
3
5
  # @see https://docs.gitlab.com/ce/api/project_snippets.html
@@ -12,7 +14,7 @@ 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 [Gitlab::ObjectifiedHash]
15
- def snippets(project, options={})
17
+ def snippets(project, options = {})
16
18
  get("/projects/#{url_encode project}/snippets", query: options)
17
19
  end
18
20
 
@@ -41,7 +43,7 @@ class Gitlab::Client
41
43
  # @option options [String] :lifetime (optional) The expiration date of a snippet.
42
44
  # @option options [String] :visibility (required) The visibility of a snippet
43
45
  # @return [Gitlab::ObjectifiedHash] Information about created snippet.
44
- def create_snippet(project, options={})
46
+ def create_snippet(project, options = {})
45
47
  post("/projects/#{url_encode project}/snippets", body: options)
46
48
  end
47
49
 
@@ -59,7 +61,7 @@ class Gitlab::Client
59
61
  # @option options [String] :lifetime The expiration date of a snippet.
60
62
  # @option options [String] :visibility (optional) The visibility of a snippet
61
63
  # @return [Gitlab::ObjectifiedHash] Information about updated snippet.
62
- def edit_snippet(project, id, options={})
64
+ def edit_snippet(project, id, options = {})
63
65
  put("/projects/#{url_encode project}/snippets/#{id}", body: options)
64
66
  end
65
67
 
@@ -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("/hooks", query: options)
17
+ def hooks(options = {})
18
+ get('/hooks', query: options)
17
19
  end
18
- alias_method :system_hooks, :hooks
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("/hooks", body: options.merge(url: url))
34
+ post('/hooks', body: options.merge(url: url))
33
35
  end
34
- alias_method :add_system_hook, :add_hook
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
- alias_method :system_hook, :hook
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
- alias_method :delete_system_hook, :delete_hook
62
+ alias delete_system_hook delete_hook
61
63
  end
62
64
  end
@@ -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
- alias_method :repo_tags, :tags
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)
34
+ def create_tag(project, tag_name, ref, message = '', description = nil)
33
35
  post("/projects/#{url_encode project}/repository/tags", body: { tag_name: tag_name, ref: ref, message: message, release_description: description })
34
36
  end
35
- alias_method :repo_create_tag, :create_tag
37
+ alias repo_create_tag create_tag
36
38
 
37
39
  # Gets information about a repository tag.
38
40
  #
@@ -46,7 +48,7 @@ class Gitlab::Client
46
48
  def tag(project, tag)
47
49
  get("/projects/#{url_encode project}/repository/tags/#{url_encode tag}")
48
50
  end
49
- alias_method :repo_tag, :tag
51
+ alias repo_tag tag
50
52
 
51
53
  # Deletes a repository tag. Requires Gitlab >= 6.8.x
52
54
  #
@@ -60,7 +62,7 @@ class Gitlab::Client
60
62
  def delete_tag(project, tag)
61
63
  delete("/projects/#{url_encode project}/repository/tags/#{url_encode tag}")
62
64
  end
63
- alias_method :repo_delete_tag, :delete_tag
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
  #
@@ -75,7 +77,7 @@ class Gitlab::Client
75
77
  def create_release(project, tag, description)
76
78
  post("/projects/#{url_encode project}/repository/tags/#{url_encode tag}/release", body: { description: description })
77
79
  end
78
- alias_method :repo_create_release, :create_release
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
  #
@@ -90,7 +92,6 @@ class Gitlab::Client
90
92
  def update_release(project, tag, description)
91
93
  put("/projects/#{url_encode project}/repository/tags/#{url_encode tag}/release", body: { description: description })
92
94
  end
93
- alias_method :repo_update_release, :update_release
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
@@ -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("/todos", query: options)
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("/todos/mark_as_done")
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