Module: Gitlab::Client::Groups
- Included in:
- Gitlab::Client
- Defined in:
- lib/gitlab/client/groups.rb
Overview
Defines methods related to groups.
Instance Method Summary collapse
-
#add_group_member(team_id, user_id, access_level) ⇒ Gitlab::ObjectifiedHash
Adds a user to group.
-
#create_group(name, path, options = {}) ⇒ Gitlab::ObjectifiedHash
Creates a new group.
-
#delete_group(id) ⇒ Gitlab::ObjectifiedHash
Delete’s a group.
-
#edit_group(id, options = {}) ⇒ Gitlab::ObjectifiedHash
Updates an existing group.
-
#edit_group_member(team_id, user_id, access_level) ⇒ Gitlab::ObjectifiedHash
Edit a user of a group.
-
#group(id) ⇒ Gitlab::ObjectifiedHash
Gets a single group.
-
#group_member(team_id, user_id) ⇒ Gitlab::ObjectifiedHash
Get details of a single group member.
-
#group_members(id, options = {}) ⇒ Array<Gitlab::ObjectifiedHash>
Get a list of group members.
-
#group_projects(id, options = {}) ⇒ Array<Gitlab::ObjectifiedHash>
Get a list of projects under a group.
-
#group_search(search, options = {}) ⇒ Array<Gitlab::ObjectifiedHash>
Search for groups by name.
-
#group_subgroups(id, options = {}) ⇒ Array<Gitlab::ObjectifiedHash>
Get a list of subgroups under a group.
-
#groups(options = {}) ⇒ Array<Gitlab::ObjectifiedHash>
Gets a list of groups.
-
#remove_group_member(team_id, user_id) ⇒ Gitlab::ObjectifiedHash
Removes user from user group.
-
#transfer_project_to_group(id, project_id) ⇒ Object
Transfers a project to a group.
Instance Method Details
#add_group_member(team_id, user_id, access_level) ⇒ Gitlab::ObjectifiedHash
Adds a user to group.
92 93 94 |
# File 'lib/gitlab/client/groups.rb', line 92 def add_group_member(team_id, user_id, access_level) post("/groups/#{url_encode team_id}/members", body: { user_id: user_id, access_level: access_level }) end |
#create_group(name, path, options = {}) ⇒ Gitlab::ObjectifiedHash
Creates a new group.
41 42 43 44 |
# File 'lib/gitlab/client/groups.rb', line 41 def create_group(name, path, = {}) body = { name: name, path: path }.merge() post('/groups', body: body) end |
#delete_group(id) ⇒ Gitlab::ObjectifiedHash
Delete’s a group.
52 53 54 |
# File 'lib/gitlab/client/groups.rb', line 52 def delete_group(id) delete("/groups/#{url_encode id}") end |
#edit_group(id, options = {}) ⇒ Gitlab::ObjectifiedHash
Updates an existing group.
191 192 193 |
# File 'lib/gitlab/client/groups.rb', line 191 def edit_group(id, = {}) put("/groups/#{url_encode id}", body: ) end |
#edit_group_member(team_id, user_id, access_level) ⇒ Gitlab::ObjectifiedHash
Edit a user of a group.
105 106 107 |
# File 'lib/gitlab/client/groups.rb', line 105 def edit_group_member(team_id, user_id, access_level) put("/groups/#{url_encode team_id}/members/#{user_id}", body: { access_level: access_level }) end |
#group(id) ⇒ Gitlab::ObjectifiedHash
Gets a single group.
28 29 30 |
# File 'lib/gitlab/client/groups.rb', line 28 def group(id) get("/groups/#{url_encode id}") end |
#group_member(team_id, user_id) ⇒ Gitlab::ObjectifiedHash
Get details of a single group member.
79 80 81 |
# File 'lib/gitlab/client/groups.rb', line 79 def group_member(team_id, user_id) get("/groups/#{url_encode team_id}/members/#{user_id}") end |
#group_members(id, options = {}) ⇒ Array<Gitlab::ObjectifiedHash>
Get a list of group members.
67 68 69 |
# File 'lib/gitlab/client/groups.rb', line 67 def group_members(id, = {}) get("/groups/#{url_encode id}/members", query: ) end |
#group_projects(id, options = {}) ⇒ Array<Gitlab::ObjectifiedHash>
Get a list of projects under a group
154 155 156 |
# File 'lib/gitlab/client/groups.rb', line 154 def group_projects(id, = {}) get("/groups/#{url_encode id}/projects", query: ) end |
#group_search(search, options = {}) ⇒ Array<Gitlab::ObjectifiedHash>
Search for groups by name
143 144 145 146 |
# File 'lib/gitlab/client/groups.rb', line 143 def group_search(search, = {}) [:search] = search get('/groups', query: ) end |
#group_subgroups(id, options = {}) ⇒ Array<Gitlab::ObjectifiedHash>
Get a list of subgroups under a group
172 173 174 |
# File 'lib/gitlab/client/groups.rb', line 172 def group_subgroups(id, = {}) get("/groups/#{url_encode id}/subgroups", query: ) end |
#groups(options = {}) ⇒ Array<Gitlab::ObjectifiedHash>
Gets a list of groups.
17 18 19 |
# File 'lib/gitlab/client/groups.rb', line 17 def groups( = {}) get('/groups', query: ) end |
#remove_group_member(team_id, user_id) ⇒ Gitlab::ObjectifiedHash
Removes user from user group.
117 118 119 |
# File 'lib/gitlab/client/groups.rb', line 117 def remove_group_member(team_id, user_id) delete("/groups/#{url_encode team_id}/members/#{user_id}") end |
#transfer_project_to_group(id, project_id) ⇒ Object
Transfers a project to a group
128 129 130 131 |
# File 'lib/gitlab/client/groups.rb', line 128 def transfer_project_to_group(id, project_id) body = { id: id, project_id: project_id } post("/groups/#{url_encode id}/projects/#{project_id}", body: body) end |