Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions lib/gitlab/client/projects.rb
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,18 @@ def share_project_with_group(project, id, group_access)
post("/projects/#{url_encode project}/share", body: { group_id: id, group_access: group_access })
end

# Unshare project with group.
#
# @example
# Gitlab.unshare_project_with_group('gitlab', 2)
#
# @param [Integer, String] project The ID or path of a project.
# @param [Integer] id The ID of a group.
# @return [void] This API call returns an empty response body.
def unshare_project_with_group(project, id)
delete("/projects/#{url_encode project}/share/#{id}")
end

# Stars a project.
# @see https://docs.gitlab.com/ce/api/projects.html#star-a-project
#
Expand Down
11 changes: 11 additions & 0 deletions spec/gitlab/client/projects_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,17 @@
end
end

describe ".unshare_project_with_group" do
before do
stub_delete("/projects/3/share/10", "group")
@group = Gitlab.unshare_project_with_group(3, 10)
end

it "gets the correct resource" do
expect(a_delete("/projects/3/share/10")).to have_been_made
end
end

describe ".star_project" do
before do
stub_post("/projects/3/star", "project_star")
Expand Down