Module: Gitlab::Client::MergeRequestApprovals
- Included in:
- Gitlab::Client
- Defined in:
- lib/gitlab/client/merge_request_approvals.rb
Overview
Defines methods related to MR Approvals.
Instance Method Summary collapse
-
#approve_merge_request(project, merge_request, options = {}) ⇒ Gitlab::ObjectifiedHash
Approve a merge request.
-
#create_merge_request_level_rule(project, merge_request, options = {}) ⇒ Gitlab::ObjectifiedHash
Create merge request level rule.
-
#create_project_merge_request_approval_rule(project, options = {}) ⇒ Gitlab::ObjectifiedHash
Create MR Approval Rule for a project.
-
#delete_merge_request_level_rule(project, merge_request, appr_rule_id) ⇒ void
Delete merge request level rule.
-
#delete_project_merge_request_approval_rule(project, approval_rule_id) ⇒ void
Delete MR Approval Rule for a project.
-
#edit_merge_request_approvals(project, merge_request, options = {}) ⇒ Gitlab::ObjectifiedHash
Change configuration for approvals on a specific merge request.
-
#edit_merge_request_approvers(project, merge_request, options = {}) ⇒ Gitlab::ObjectifiedHash
deprecated
Deprecated.
Since Gitlab 13.12 /approvers endpoints are removed!!!
-
#edit_project_approvers(project, options = {}) ⇒ Gitlab::ObjectifiedHash
deprecated
Deprecated.
Since Gitlab 13.12 /approvers endpoints are removed!!!
-
#edit_project_merge_request_approvals(project, options = {}) ⇒ Gitlab::ObjectifiedHash
Change MR Approval Configuration for a project.
-
#merge_request_approval_state(project, id) ⇒ Array<Gitlab::ObjectifiedHash>
Get the approval state of merge requests.
-
#merge_request_approvals(project, merge_request) ⇒ Gitlab::ObjectifiedHash
Get Configuration for approvals on a specific Merge Request.
-
#merge_request_level_rule(project, merge_request) ⇒ Gitlab::ObjectifiedHash
Get merge request level rule.
-
#project_merge_request_approval_rules(project) ⇒ Gitlab::ObjectifiedHash
Gets MR Approval Rules for a project.
-
#project_merge_request_approvals(project) ⇒ Gitlab::ObjectifiedHash
Gets MR Approval Configuration for a project.
-
#unapprove_merge_request(project, merge_request, options = {}) ⇒ void
Unapprove a merge request.
-
#update_merge_request_level_rule(project, merge_request, appr_rule_id, options = {}) ⇒ Gitlab::ObjectifiedHash
Update merge request level rule.
-
#update_project_merge_request_approval_rule(project, approval_rule_id, options = {}) ⇒ Gitlab::ObjectifiedHash
Update MR Approval Rule for a project.
Instance Method Details
#approve_merge_request(project, merge_request, options = {}) ⇒ Gitlab::ObjectifiedHash
Approve a merge request
236 237 238 |
# File 'lib/gitlab/client/merge_request_approvals.rb', line 236 def approve_merge_request(project, merge_request, = {}) post("/projects/#{url_encode project}/merge_requests/#{merge_request}/approve", body: ) end |
#create_merge_request_level_rule(project, merge_request, options = {}) ⇒ Gitlab::ObjectifiedHash
Create merge request level rule
Important: When approval_project_rule_id is set, the name, users and groups of project-level rule are copied. The approvals_required specified is used.
168 169 170 |
# File 'lib/gitlab/client/merge_request_approvals.rb', line 168 def create_merge_request_level_rule(project, merge_request, = {}) post("/projects/#{url_encode project}/merge_requests/#{merge_request}/approval_rules", body: ) end |
#create_project_merge_request_approval_rule(project, options = {}) ⇒ Gitlab::ObjectifiedHash
Create MR Approval Rule for a project
57 58 59 |
# File 'lib/gitlab/client/merge_request_approvals.rb', line 57 def create_project_merge_request_approval_rule(project, = {}) post("/projects/#{url_encode project}/approval_rules", body: ) end |
#delete_merge_request_level_rule(project, merge_request, appr_rule_id) ⇒ void
This method returns an undefined value.
Delete merge request level rule
Important: Deleting a report_approver or code_owner rule is not allowed. These are system generated rules.
222 223 224 |
# File 'lib/gitlab/client/merge_request_approvals.rb', line 222 def delete_merge_request_level_rule(project, merge_request, appr_rule_id) delete("/projects/#{url_encode project}/merge_requests/#{merge_request}/approval_rules/#{appr_rule_id}") end |
#delete_project_merge_request_approval_rule(project, approval_rule_id) ⇒ void
This method returns an undefined value.
Delete MR Approval Rule for a project
86 87 88 |
# File 'lib/gitlab/client/merge_request_approvals.rb', line 86 def delete_project_merge_request_approval_rule(project, approval_rule_id) delete("/projects/#{url_encode project}/approval_rules/#{approval_rule_id}") end |
#edit_merge_request_approvals(project, merge_request, options = {}) ⇒ Gitlab::ObjectifiedHash
Change configuration for approvals on a specific merge request.
126 127 128 |
# File 'lib/gitlab/client/merge_request_approvals.rb', line 126 def edit_merge_request_approvals(project, merge_request, = {}) post("/projects/#{url_encode project}/merge_requests/#{merge_request}/approvals", body: ) end |
#edit_merge_request_approvers(project, merge_request, options = {}) ⇒ Gitlab::ObjectifiedHash
Since Gitlab 13.12 /approvers endpoints are removed!!!
Change allowed approvers and approver groups for a merge request See Gitlab.create_merge_request_level_rule
142 143 144 |
# File 'lib/gitlab/client/merge_request_approvals.rb', line 142 def edit_merge_request_approvers(project, merge_request, = {}) put("/projects/#{url_encode project}/merge_requests/#{merge_request}/approvers", body: ) end |
#edit_project_approvers(project, options = {}) ⇒ Gitlab::ObjectifiedHash
Since Gitlab 13.12 /approvers endpoints are removed!!!
Change allowed approvers and approver groups for a project See Gitlab.create_project_merge_request_approval_rule
101 102 103 |
# File 'lib/gitlab/client/merge_request_approvals.rb', line 101 def edit_project_approvers(project, = {}) put("/projects/#{url_encode project}/approvers", body: ) end |
#edit_project_merge_request_approvals(project, options = {}) ⇒ Gitlab::ObjectifiedHash
Change MR Approval Configuration for a project
30 31 32 |
# File 'lib/gitlab/client/merge_request_approvals.rb', line 30 def edit_project_merge_request_approvals(project, = {}) post("/projects/#{url_encode project}/approvals", body: ) end |
#merge_request_approval_state(project, id) ⇒ Array<Gitlab::ObjectifiedHash>
Get the approval state of merge requests
261 262 263 |
# File 'lib/gitlab/client/merge_request_approvals.rb', line 261 def merge_request_approval_state(project, id) get("/projects/#{url_encode project}/merge_requests/#{id}/approval_state") end |
#merge_request_approvals(project, merge_request) ⇒ Gitlab::ObjectifiedHash
Get Configuration for approvals on a specific Merge Request.
113 114 115 |
# File 'lib/gitlab/client/merge_request_approvals.rb', line 113 def merge_request_approvals(project, merge_request) get("/projects/#{url_encode project}/merge_requests/#{merge_request}/approvals") end |
#merge_request_level_rule(project, merge_request) ⇒ Gitlab::ObjectifiedHash
Get merge request level rule
180 181 182 |
# File 'lib/gitlab/client/merge_request_approvals.rb', line 180 def merge_request_level_rule(project, merge_request) get("/projects/#{url_encode project}/merge_requests/#{merge_request}/approval_rules") end |
#project_merge_request_approval_rules(project) ⇒ Gitlab::ObjectifiedHash
Gets MR Approval Rules for a project
41 42 43 |
# File 'lib/gitlab/client/merge_request_approvals.rb', line 41 def project_merge_request_approval_rules(project) get("/projects/#{url_encode project}/approval_rules") end |
#project_merge_request_approvals(project) ⇒ Gitlab::ObjectifiedHash
Gets MR Approval Configuration for a project
14 15 16 |
# File 'lib/gitlab/client/merge_request_approvals.rb', line 14 def project_merge_request_approvals(project) get("/projects/#{url_encode project}/approvals") end |
#unapprove_merge_request(project, merge_request, options = {}) ⇒ void
This method returns an undefined value.
Unapprove a merge request
249 250 251 |
# File 'lib/gitlab/client/merge_request_approvals.rb', line 249 def unapprove_merge_request(project, merge_request, = {}) post("/projects/#{url_encode project}/merge_requests/#{merge_request}/unapprove", body: ) end |
#update_merge_request_level_rule(project, merge_request, appr_rule_id, options = {}) ⇒ Gitlab::ObjectifiedHash
Update merge request level rule
Important: Approvers and groups not in the users/groups parameters are removed Important: Updating a report_approver or code_owner rule is not allowed. These are system generated rules.
206 207 208 |
# File 'lib/gitlab/client/merge_request_approvals.rb', line 206 def update_merge_request_level_rule(project, merge_request, appr_rule_id, = {}) put("/projects/#{url_encode project}/merge_requests/#{merge_request}/approval_rules/#{appr_rule_id}", body: ) end |
#update_project_merge_request_approval_rule(project, approval_rule_id, options = {}) ⇒ Gitlab::ObjectifiedHash
Update MR Approval Rule for a project
74 75 76 |
# File 'lib/gitlab/client/merge_request_approvals.rb', line 74 def update_project_merge_request_approval_rule(project, approval_rule_id, = {}) put("/projects/#{url_encode project}/approval_rules/#{approval_rule_id}", body: ) end |