Skip to content

Commit

Permalink
Added .unshare_project_with_group to projects (NARKOZ#395)
Browse files Browse the repository at this point in the history
  • Loading branch information
akkee authored and asedge committed Jul 12, 2018
1 parent f4b4be4 commit b543f25
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
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

0 comments on commit b543f25

Please sign in to comment.