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 repositories.
3
5
  # @see https://docs.gitlab.com/ce/api/branches.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 branches(project, options={})
17
+ def branches(project, options = {})
16
18
  get("/projects/#{url_encode project}/repository/branches", query: options)
17
19
  end
18
- alias_method :repo_branches, :branches
20
+ alias repo_branches branches
19
21
 
20
22
  # Gets information about a repository branch.
21
23
  #
@@ -29,7 +31,7 @@ class Gitlab::Client
29
31
  def branch(project, branch)
30
32
  get("/projects/#{url_encode project}/repository/branches/#{url_encode branch}")
31
33
  end
32
- alias_method :repo_branch, :branch
34
+ alias repo_branch branch
33
35
 
34
36
  # Protects a repository branch.
35
37
  #
@@ -47,9 +49,9 @@ class Gitlab::Client
47
49
  # @option options [Boolean] :developers_can_merge True to allow developers to merge into the branch (default = false)
48
50
  # @return [Gitlab::ObjectifiedHash] Details about the branch
49
51
  def protect_branch(project, branch, options = {})
50
- post("/projects/#{url_encode project}/protected_branches", body: {name: branch}.merge(options))
52
+ post("/projects/#{url_encode project}/protected_branches", body: { name: branch }.merge(options))
51
53
  end
52
- alias_method :repo_protect_branch, :protect_branch
54
+ alias repo_protect_branch protect_branch
53
55
 
54
56
  # Unprotects a repository branch.
55
57
  #
@@ -63,7 +65,7 @@ class Gitlab::Client
63
65
  def unprotect_branch(project, branch)
64
66
  delete("/projects/#{url_encode project}/protected_branches/#{url_encode branch}")
65
67
  end
66
- alias_method :repo_unprotect_branch, :unprotect_branch
68
+ alias repo_unprotect_branch unprotect_branch
67
69
 
68
70
  # Creates a repository branch. Requires Gitlab >= 6.8.x
69
71
  #
@@ -78,7 +80,7 @@ class Gitlab::Client
78
80
  def create_branch(project, branch, ref)
79
81
  post("/projects/#{url_encode project}/repository/branches", query: { branch: branch, ref: ref })
80
82
  end
81
- alias_method :repo_create_branch, :create_branch
83
+ alias repo_create_branch create_branch
82
84
 
83
85
  # Deletes a repository branch. Requires Gitlab >= 6.8.x
84
86
  #
@@ -91,6 +93,43 @@ class Gitlab::Client
91
93
  def delete_branch(project, branch)
92
94
  delete("/projects/#{url_encode project}/repository/branches/#{url_encode branch}")
93
95
  end
94
- alias_method :repo_delete_branch, :delete_branch
96
+ alias repo_delete_branch delete_branch
97
+
98
+ # Delete all branches that are merged into the project default branch. Protected branches will not be deleted as part of this operation.
99
+ #
100
+ # @example
101
+ # Gitlab.delete_merged_branches(3)
102
+ #
103
+ # @param [Integer, String] project The ID or name of a project.
104
+ # @return [nil] This API call returns an empty response body.
105
+ def delete_merged_branches(project)
106
+ delete("/projects/#{url_encode project}/repository/merged_branches")
107
+ end
108
+ alias repo_delete_merged_branches delete_merged_branches
109
+
110
+ # Gets a list of protected branches from a project.
111
+ #
112
+ # @example
113
+ # Gitlab.protected_branches(42)
114
+ #
115
+ # @param [Integer, String] project The ID or name of a project.
116
+ # @return [Array<Gitlab::ObjectifiedHash>]
117
+ def protected_branches(project)
118
+ get("/projects/#{url_encode project}/protected_branches")
119
+ end
120
+ alias repo_protected_branches protected_branches
121
+
122
+ # Gets a single protected branch or wildcard protected branch
123
+ #
124
+ # @example
125
+ # Gitlab.protected_branch(3, 'api')
126
+ #
127
+ # @param [Integer, String] project The ID or name of a project.
128
+ # @param [String] name The name of the branch or wildcard
129
+ # @return [Gitlab::ObjectifiedHash]
130
+ def protected_branch(project, branch)
131
+ get("/projects/#{url_encode project}/protected_branches/#{url_encode branch}")
132
+ end
133
+ alias repo_protected_branch protected_branch
95
134
  end
96
135
  end
@@ -0,0 +1,75 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Gitlab::Client
4
+ # Defines methods related to broadcast messages (only accessible to administrators).
5
+ # @see https://docs.gitlab.com/ce/api/broadcast_messages.html
6
+ module BroadcastMessages
7
+ # Get all broadcast messages
8
+ #
9
+ # @example
10
+ # Gitlab.broadcast_messages
11
+ #
12
+ # @return [Array<Gitlab::ObjectifiedHash>]
13
+ def broadcast_messages
14
+ get('/broadcast_messages')
15
+ end
16
+
17
+ # Get a specific broadcast message
18
+ #
19
+ # @example
20
+ # Gitlab.broadcast_message(3)
21
+ #
22
+ # @param [Integer] id The ID of broadcast message
23
+ # @return [Gitlab::ObjectifiedHash]
24
+ def broadcast_message(id)
25
+ get("/broadcast_messages/#{id}")
26
+ end
27
+
28
+ # Create a broadcast message.
29
+ #
30
+ # @example
31
+ # Gitlab.create_broadcast_message('Mayday')
32
+ # Gitlab.create_broadcast_message('Mayday', {starts_at: Time.zone.now, ends_at: Time.zone.now + 30.minutes, color: '#cecece', font: '#FFFFFF'})
33
+ #
34
+ # @param [String] message Message to display
35
+ # @param [Hash] options A customizable set of options.
36
+ # @option options [DateTime] :starts_at(optional) Starting time (defaults to current time)
37
+ # @option options [DateTime] :ends_at(optional) Ending time (defaults to one hour from current time)
38
+ # @option options [String] :color(optional) Background color hex code
39
+ # @option options [String] :font(optional) Foreground color hex code
40
+ # @return [Gitlab::ObjectifiedHash] Information about created broadcast message.
41
+ def create_broadcast_message(message, options = {})
42
+ body = { message: message }.merge(options)
43
+ post('/broadcast_messages', body: body)
44
+ end
45
+
46
+ # Update a broadcast message
47
+ #
48
+ # @example
49
+ # Gitlab.edit_broadcast_message(6, { message: 'No Mayday' })
50
+ # Gitlab.edit_broadcast_message(6, { font: '#FEFEFE' })
51
+ #
52
+ # @param [Integer] id The ID of a broadcast message
53
+ # @param [Hash] options A customizable set of options.
54
+ # @option options [String] :message(optional) Message to display
55
+ # @option options [DateTime] :starts_at(optional) Starting time (defaults to current time)
56
+ # @option options [DateTime] :ends_at(optional) Ending time (defaults to one hour from current time)
57
+ # @option options [String] :color(optional) Background color hex code
58
+ # @option options [String] :font(optional) Foreground color hex code
59
+ # @return [Gitlab::ObjectifiedHash] Information about updated broadcast message.
60
+ def edit_broadcast_message(id, options = {})
61
+ put("/broadcast_messages/#{id}", body: options)
62
+ end
63
+
64
+ # Delete a broadcast message.
65
+ #
66
+ # @example
67
+ # Gitlab.delete_broadcast_message(3)
68
+ #
69
+ # @param [Integer] id The ID of a broadcast message.
70
+ # @return [nil] This API call returns an empty response body.
71
+ def delete_broadcast_message(id)
72
+ delete("/broadcast_messages/#{id}")
73
+ end
74
+ end
75
+ end
@@ -1,7 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Gitlab::Client
2
4
  # Defines methods related to builds.
3
- # @see https://docs.gitlab.com/ce/api/build_variables.html
4
- # @see https://docs.gitlab.com/ee/api/group_level_variables.html
5
+ # @see https://docs.gitlab.com/ce/api/project_level_variables.html
6
+ # @see https://docs.gitlab.com/ce/api/group_level_variables.html
5
7
  module BuildVariables
6
8
  # Gets a list of the project's build variables
7
9
  #
@@ -34,9 +36,10 @@ class Gitlab::Client
34
36
  # @param [Integer, String] project The ID or name of a project.
35
37
  # @param [String] key The key of a variable; must have no more than 255 characters; only `A-Z`, `a-z`, `0-9` and `_` are allowed
36
38
  # @param [String] value The value of a variable
39
+ # @param [Hash] opts optional parameters
37
40
  # @return [Gitlab::ObjectifiedHash] The variable.
38
- def create_variable(project, key, value)
39
- post("/projects/#{url_encode project}/variables", body: { key: key, value: value })
41
+ def create_variable(project, key, value, **opts)
42
+ post("/projects/#{url_encode project}/variables", body: opts.merge(key: key, value: value))
40
43
  end
41
44
 
42
45
  # Update a project's build variable.
@@ -47,9 +50,10 @@ class Gitlab::Client
47
50
  # @param [Integer, String] project The ID or name of a project.
48
51
  # @param [String] key The key of a variable
49
52
  # @param [String] value The value of a variable
53
+ # @param [Hash] opts optional parameters
50
54
  # @return [Gitlab::ObjectifiedHash] The variable.
51
- def update_variable(project, key, value)
52
- put("/projects/#{url_encode project}/variables/#{key}", body: { value: value })
55
+ def update_variable(project, key, value, **opts)
56
+ put("/projects/#{url_encode project}/variables/#{key}", body: opts.merge(value: value))
53
57
  end
54
58
 
55
59
  # Remove a project's build variable.
@@ -59,9 +63,10 @@ class Gitlab::Client
59
63
  #
60
64
  # @param [Integer, String] project The ID or name of a project.
61
65
  # @param [String] key The key of a variable.
66
+ # @param [Hash] opts optional parameters
62
67
  # @return [Gitlab::ObjectifiedHash] The variable.
63
- def remove_variable(project, key)
64
- delete("/projects/#{url_encode project}/variables/#{key}")
68
+ def remove_variable(project, key, **opts)
69
+ delete("/projects/#{url_encode project}/variables/#{key}", query: opts)
65
70
  end
66
71
 
67
72
  # Gets a list of the group's build variables
@@ -95,9 +100,10 @@ class Gitlab::Client
95
100
  # @param [Integer, String] group The ID or name of a group.
96
101
  # @param [String] key The key of a variable; must have no more than 255 characters; only `A-Z`, `a-z`, `0-9` and `_` are allowed
97
102
  # @param [String] value The value of a variable
103
+ # @param [Hash] opts optional parameters
98
104
  # @return [Gitlab::ObjectifiedHash] The variable.
99
- def create_group_variable(group, key, value)
100
- post("/groups/#{url_encode group}/variables", body: { key: key, value: value })
105
+ def create_group_variable(group, key, value, **opts)
106
+ post("/groups/#{url_encode group}/variables", body: opts.merge(key: key, value: value))
101
107
  end
102
108
 
103
109
  # Update a group's build variable.
@@ -108,9 +114,10 @@ class Gitlab::Client
108
114
  # @param [Integer, String] group The ID or name of a group.
109
115
  # @param [String] key The key of a variable
110
116
  # @param [String] value The value of a variable
117
+ # @param [Hash] opts optional parameters
111
118
  # @return [Gitlab::ObjectifiedHash] The variable.
112
- def update_group_variable(group, key, value)
113
- put("/groups/#{url_encode group}/variables/#{key}", body: { value: value })
119
+ def update_group_variable(group, key, value, **opts)
120
+ put("/groups/#{url_encode group}/variables/#{key}", body: opts.merge(value: value))
114
121
  end
115
122
 
116
123
  # Remove a group's build variable.
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Gitlab::Client
2
4
  # Defines methods related to builds.
3
5
  # @see https://docs.gitlab.com/ce/api/builds.html
@@ -14,7 +16,7 @@ class Gitlab::Client
14
16
  # @option options [Integer] :per_page The number of results per page.
15
17
  # @param [Integer, String] project The ID or name of a project.
16
18
  # @return [Array<Gitlab::ObjectifiedHash>]
17
- def builds(project, options={})
19
+ def builds(project, options = {})
18
20
  get("/projects/#{url_encode project}/builds", query: options)
19
21
  end
20
22
 
@@ -40,15 +42,15 @@ class Gitlab::Client
40
42
  # @return [Gitlab::FileResponse]
41
43
  def build_artifacts(project, id)
42
44
  get("/projects/#{url_encode project}/builds/#{id}/artifacts",
43
- format: nil,
44
- headers: { Accept: 'application/octet-stream' },
45
- parser: proc { |body, _|
46
- if body.encoding == Encoding::ASCII_8BIT # binary response
47
- ::Gitlab::FileResponse.new StringIO.new(body, 'rb+')
48
- else # error with json response
49
- ::Gitlab::Request.parse(body)
50
- end
51
- })
45
+ format: nil,
46
+ headers: { Accept: 'application/octet-stream' },
47
+ parser: proc { |body, _|
48
+ if body.encoding == Encoding::ASCII_8BIT # binary response
49
+ ::Gitlab::FileResponse.new StringIO.new(body, 'rb+')
50
+ else # error with json response
51
+ ::Gitlab::Request.parse(body)
52
+ end
53
+ })
52
54
  end
53
55
 
54
56
  # Gets a list of builds for specific commit in a project.
@@ -63,7 +65,7 @@ class Gitlab::Client
63
65
  # @option options [Integer] :page The page number.
64
66
  # @option options [Integer] :per_page The number of results per page.
65
67
  # @return [Array<Gitlab::ObjectifiedHash>] The list of builds.
66
- def commit_builds(project, sha, options={})
68
+ def commit_builds(project, sha, options = {})
67
69
  get("/projects/#{url_encode project}/repository/commits/#{sha}/builds", query: options)
68
70
  end
69
71
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Gitlab::Client
2
4
  # Defines methods related to repository commits.
3
5
  # @see https://docs.gitlab.com/ce/api/commits.html
@@ -6,18 +8,18 @@ class Gitlab::Client
6
8
  #
7
9
  # @example
8
10
  # Gitlab.commits('viking')
9
- # Gitlab.repo_commits('gitlab', { ref_name: 'api' })
11
+ # Gitlab.repo_commits('gitlab', { ref: 'api' })
10
12
  #
11
13
  # @param [Integer, String] project The ID or name of a project.
12
14
  # @param [Hash] options A customizable set of options.
13
- # @option options [String] :ref_name The branch or tag name of a project repository.
15
+ # @option options [String] :ref The branch or tag name of a project repository.
14
16
  # @option options [Integer] :page The page number.
15
17
  # @option options [Integer] :per_page The number of results per page.
16
18
  # @return [Array<Gitlab::ObjectifiedHash>]
17
- def commits(project, options={})
19
+ def commits(project, options = {})
18
20
  get("/projects/#{url_encode project}/repository/commits", query: options)
19
21
  end
20
- alias_method :repo_commits, :commits
22
+ alias repo_commits commits
21
23
 
22
24
  # Gets a specific commit identified by the commit hash or name of a branch or tag.
23
25
  #
@@ -31,7 +33,57 @@ class Gitlab::Client
31
33
  def commit(project, sha)
32
34
  get("/projects/#{url_encode project}/repository/commits/#{sha}")
33
35
  end
34
- alias_method :repo_commit, :commit
36
+ alias repo_commit commit
37
+
38
+ # Get all references (from branches or tags) a commit is pushed to.
39
+ #
40
+ # @example
41
+ # Gitlab.commit_refs(42, '6104942438c14ec7bd21c6cd5bd995272b3faff6')
42
+ #
43
+ # @param [Integer, String] project The ID or name of a project.
44
+ # @param [String] sha The commit hash
45
+ # @param [Hash] options A customizable set of options.
46
+ # @option options [String] :type The scope of commits. Possible values `branch`, `tag`, `all`. Default is `all`.
47
+ # @option options [Integer] :page The page number.
48
+ # @option options [Integer] :per_page The number of results per page.
49
+ # @return [Gitlab::ObjectifiedHash]
50
+ def commit_refs(project, sha, options = {})
51
+ get("/projects/#{url_encode project}/repository/commits/#{sha}/refs", query: options)
52
+ end
53
+
54
+ # Cherry picks a commit to a given branch.
55
+ #
56
+ # @example
57
+ # Gitlab.cherry_pick_commit(42, '6104942438c14ec7bd21c6cd5bd995272b3faff6', 'master')
58
+ #
59
+ # @param [Integer, String] project The ID or name of a project.
60
+ # @param [String] sha The commit hash or name of a repository branch or tag
61
+ # @param [String] branch The name of the branch
62
+ # @param [Hash] options A customizable set of options.
63
+ # @option options [Boolean] :dry_run Don't commit any changes
64
+ # @return [Gitlab::ObjectifiedHash]
65
+ def cherry_pick_commit(project, sha, branch, options = {})
66
+ options[:branch] = branch
67
+
68
+ post("/projects/#{url_encode project}/repository/commits/#{sha}/cherry_pick", body: options)
69
+ end
70
+
71
+ # Reverts a commit in a given branch.
72
+ #
73
+ # @example
74
+ # Gitlab.revert_commit(42, '6104942438c14ec7bd21c6cd5bd995272b3faff6', 'master')
75
+ #
76
+ # @param [Integer, String] project The ID or name of a project.
77
+ # @param [String] sha The commit hash or name of a repository branch or tag
78
+ # @param [String] branch The name of the branch
79
+ # @param [Hash] options A customizable set of options.
80
+ # @option options [Boolean] :dry_run Don't commit any changes
81
+ # @return [Gitlab::ObjectifiedHash]
82
+ def revert_commit(project, sha, branch, options = {})
83
+ options[:branch] = branch
84
+
85
+ post("/projects/#{url_encode project}/repository/commits/#{sha}/revert", body: options)
86
+ end
35
87
 
36
88
  # Get the diff of a commit in a project.
37
89
  #
@@ -45,7 +97,7 @@ class Gitlab::Client
45
97
  def commit_diff(project, sha)
46
98
  get("/projects/#{url_encode project}/repository/commits/#{sha}/diff")
47
99
  end
48
- alias_method :repo_commit_diff, :commit_diff
100
+ alias repo_commit_diff commit_diff
49
101
 
50
102
  # Gets a list of comments for a commit.
51
103
  #
@@ -57,10 +109,10 @@ class Gitlab::Client
57
109
  # @option options [Integer] :page The page number.
58
110
  # @option options [Integer] :per_page The number of results per page.
59
111
  # @return [Array<Gitlab::ObjectifiedHash>]
60
- def commit_comments(project, commit, options={})
112
+ def commit_comments(project, commit, options = {})
61
113
  get("/projects/#{url_encode project}/repository/commits/#{commit}/comments", query: options)
62
114
  end
63
- alias_method :repo_commit_comments, :commit_comments
115
+ alias repo_commit_comments commit_comments
64
116
 
65
117
  # Creates a new comment for a commit.
66
118
  #
@@ -75,10 +127,10 @@ class Gitlab::Client
75
127
  # @option options [Integer] :line The line number.
76
128
  # @option options [String] :line_type The line type (new or old).
77
129
  # @return [Gitlab::ObjectifiedHash] Information about created comment.
78
- def create_commit_comment(project, commit, note, options={})
130
+ def create_commit_comment(project, commit, note, options = {})
79
131
  post("/projects/#{url_encode project}/repository/commits/#{commit}/comments", body: options.merge(note: note))
80
132
  end
81
- alias_method :repo_create_commit_comment, :create_commit_comment
133
+ alias repo_create_commit_comment create_commit_comment
82
134
 
83
135
  # Get the status of a commit
84
136
  #
@@ -94,10 +146,10 @@ class Gitlab::Client
94
146
  # @option options [String] :stage Filter by stage
95
147
  # @option options [String] :name Filter by status name, eg. jenkins
96
148
  # @option options [Boolean] :all The flag to return all statuses, not only latest ones
97
- def commit_status(project, sha, options={})
149
+ def commit_status(project, sha, options = {})
98
150
  get("/projects/#{url_encode project}/repository/commits/#{sha}/statuses", query: options)
99
151
  end
100
- alias_method :repo_commit_status, :commit_status
152
+ alias repo_commit_status commit_status
101
153
 
102
154
  # Adds or updates a status of a commit.
103
155
  #
@@ -113,10 +165,10 @@ class Gitlab::Client
113
165
  # @option options [String] :ref The ref (branch or tag) to which the status refers
114
166
  # @option options [String] :name Filter by status name, eg. jenkins
115
167
  # @option options [String] :target_url The target URL to associate with this status
116
- def update_commit_status(project, sha, state, options={})
117
- post("/projects/#{url_encode project}/statuses/#{sha}", query: options.merge(state: state))
168
+ def update_commit_status(project, sha, state, options = {})
169
+ post("/projects/#{url_encode project}/statuses/#{sha}", body: options.merge(state: state))
118
170
  end
119
- alias_method :repo_update_commit_status, :update_commit_status
171
+ alias repo_update_commit_status update_commit_status
120
172
 
121
173
  # Creates a single commit with one or more changes
122
174
  #
@@ -134,11 +186,11 @@ class Gitlab::Client
134
186
  # @option options [String] :author_email the email address of the author
135
187
  # @option options [String] :author_name the name of the author
136
188
  # @return [Gitlab::ObjectifiedHash] hash of commit related data
137
- def create_commit(project, branch, message, actions, options={})
189
+ def create_commit(project, branch, message, actions, options = {})
138
190
  payload = {
139
- branch: branch,
140
- commit_message: message,
141
- actions: actions,
191
+ branch: branch,
192
+ commit_message: message,
193
+ actions: actions
142
194
  }.merge(options)
143
195
  post("/projects/#{url_encode project}/repository/commits", body: payload)
144
196
  end
@@ -156,9 +208,9 @@ class Gitlab::Client
156
208
  # @option options [Integer] :page The page number.
157
209
  # @option options [Integer] :per_page The number of results per page.
158
210
  # @return [Array<Gitlab::ObjectifiedHash>]
159
- def commit_merge_requests(project, commit, options={})
211
+ def commit_merge_requests(project, commit, options = {})
160
212
  get("/projects/#{url_encode project}/repository/commits/#{commit}/merge_requests", query: options)
161
213
  end
162
- alias_method :repo_commit_merge_requests, :commit_merge_requests
214
+ alias repo_commit_merge_requests commit_merge_requests
163
215
  end
164
216
  end
@@ -0,0 +1,85 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Gitlab::Client
4
+ # Defines methods related to GitLab Container Registry.
5
+ # @see https://docs.gitlab.com/ce/api/container_registry.html
6
+ module ContainerRegistry
7
+ # Get a list of registry repositories in a project.
8
+ #
9
+ # @example
10
+ # Gitlab.registry_repositories(5)
11
+ #
12
+ # @param [Integer, String] project The ID or name of a project.
13
+ # @return [Array<Gitlab::ObjectifiedHash>] Returns list of registry repositories in a project.
14
+ def registry_repositories(project)
15
+ get("/projects/#{url_encode project}/registry/repositories")
16
+ end
17
+
18
+ # Delete a repository in registry.
19
+ #
20
+ # @example
21
+ # Gitlab.delete_registry_repository(5, 2)
22
+ #
23
+ # @param [Integer, String] project The ID or name of a project.
24
+ # @param [Integer] id The ID of registry repository.
25
+ # @return [void] This API call returns an empty response body.
26
+ def delete_registry_repository(project, id)
27
+ delete("/projects/#{url_encode project}/registry/repositories/#{id}")
28
+ end
29
+
30
+ # Get a list of tags for given registry repository.
31
+ #
32
+ # @example
33
+ # Gitlab.registry_repository_tags(5, 2)
34
+ #
35
+ # @param [Integer, String] project The ID or name of a project.
36
+ # @param [Integer] repository_id The ID of registry repository.
37
+ # @return [Array<Gitlab::ObjectifiedHash>] Returns list of tags of a registry repository.
38
+ def registry_repository_tags(project, repository_id)
39
+ get("/projects/#{url_encode project}/registry/repositories/#{repository_id}/tags")
40
+ end
41
+
42
+ # Get details of a registry repository tag.
43
+ #
44
+ # @example
45
+ # Gitlab.registry_repository_tag(5, 2, 'v10.0.0')
46
+ #
47
+ # @param [Integer, String] project The ID or name of a project.
48
+ # @param [Integer] repository_id The ID of registry repository.
49
+ # @param [String] tag_name The name of tag.
50
+ # @return <Gitlab::ObjectifiedHash> Returns details about the registry repository tag
51
+ def registry_repository_tag(project, repository_id, tag_name)
52
+ get("/projects/#{url_encode project}/registry/repositories/#{repository_id}/tags/#{tag_name}")
53
+ end
54
+
55
+ # Delete a registry repository tag.
56
+ #
57
+ # @example
58
+ # Gitlab.delete_registry_repository_tag(5, 2, 'v10.0.0')
59
+ #
60
+ # @param [Integer, String] project The ID or name of a project.
61
+ # @param [Integer] repository_id The ID of registry repository.
62
+ # @param [String] tag_name The name of tag.
63
+ # @return [void] This API call returns an empty response body.
64
+ def delete_registry_repository_tag(project, repository_id, tag_name)
65
+ delete("/projects/#{url_encode project}/registry/repositories/#{repository_id}/tags/#{tag_name}")
66
+ end
67
+
68
+ # Delete repository tags in bulk based on given criteria.
69
+ #
70
+ # @example
71
+ # Gitlab.bulk_delete_registry_repository_tags(5, 2, name_regex: '.*')
72
+ # Gitlab.bulk_delete_registry_repository_tags(5, 2, name_regex: '[0-9a-z]{40}', keep_n: 5, older_than: '1d')
73
+ #
74
+ # @param [Integer, String] project The ID or name of a project.
75
+ # @param [Integer] repository_id The ID of registry repository.
76
+ # @param [Hash] options A customizable set of options.
77
+ # @option options [String] :name_regex(required) The regex of the name to delete. To delete all tags specify .*.
78
+ # @option options [Integer] :keep_n(optional) The amount of latest tags of given name to keep.
79
+ # @option options [String] :older_than(required) Tags to delete that are older than the given time, written in human readable form 1h, 1d, 1month.
80
+ # @return [void] This API call returns an empty response body.
81
+ def bulk_delete_registry_repository_tags(project, repository_id, options = {})
82
+ delete("/projects/#{url_encode project}/registry/repositories/#{repository_id}/tags", body: options)
83
+ end
84
+ end
85
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Gitlab::Client
2
4
  # Defines methods related to deployments.
3
5
  # @see https://docs.gitlab.com/ce/api/deployments.html
@@ -13,7 +15,7 @@ class Gitlab::Client
13
15
  # @option options [Integer] :page The page number.
14
16
  # @option options [Integer] :per_page The number of results per page.
15
17
  # @return [Array<Gitlab::ObjectifiedHash>]
16
- def deployments(project, options={})
18
+ def deployments(project, options = {})
17
19
  get("/projects/#{url_encode project}/deployments", query: options)
18
20
  end
19
21
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Gitlab::Client
2
4
  # Defines methods related to environments.
3
5
  # @see https://docs.gitlab.com/ce/api/environments.html
@@ -13,7 +15,7 @@ class Gitlab::Client
13
15
  # @option options [Integer] :page The page number.
14
16
  # @option options [Integer] :per_page The number of results per page.
15
17
  # @return [Array<Gitlab::ObjectifiedHash>]
16
- def environments(project, options={})
18
+ def environments(project, options = {})
17
19
  get("/projects/#{url_encode project}/environments", query: options)
18
20
  end
19
21
 
@@ -40,7 +42,7 @@ class Gitlab::Client
40
42
  # @option options [String] :external_url Optional URL for viewing the deployed project in this environment
41
43
  # @return [Gitlab::ObjectifiedHash] The updated environment.
42
44
  def create_environment(project, env_name, options = {})
43
- body = {name: env_name}.merge(options)
45
+ body = { name: env_name }.merge(options)
44
46
  post("/projects/#{url_encode project}/environments", body: body)
45
47
  end
46
48
 
@@ -56,7 +58,7 @@ class Gitlab::Client
56
58
  # @option options [String] env_name Name for the environment
57
59
  # @option options [String] external_url Optional URL for viewing the deployed project in this environment
58
60
  # @return [Gitlab::ObjectifiedHash] The updated environment.
59
- def edit_environment(project, id, options={})
61
+ def edit_environment(project, id, options = {})
60
62
  put("/projects/#{url_encode project}/environments/#{id}", body: options)
61
63
  end
62
64
 
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Gitlab::Client
4
+ # Defines methods related to issues.
5
+ # @see https://docs.gitlab.com/ee/api/epic_issues.html
6
+ module EpicIssues
7
+ # List issues for an epic.
8
+ # Gets all issues that are assigned to an epic and the authenticated user has access to..
9
+ # @example
10
+ # Gitlab.epic_issues(5, 7)
11
+ # Gitlab.epic_issues(5, 7, { per_page: 40 })
12
+ #
13
+ # @param [Integer, String] group The ID or name of a group.
14
+ # @param [Integer] epic The iid of an epic.
15
+ # @param [Hash] options A customizable set of options.
16
+ # @option options [Integer] :page The page number.
17
+ # @option options [Integer] :per_page The number of results per page.
18
+ # @return [Array<Gitlab::ObjectifiedHash>]
19
+ def epic_issues(group, epic, options = {})
20
+ get("/groups/#{url_encode group}/epics/#{epic}/issues", query: options)
21
+ end
22
+ end
23
+ end