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_custom_attribute(key, value, group_id) ⇒ Gitlab::ObjectifiedHash
Creates a new custom_attribute.
-
#add_group_hook(group_id, url, options = {}) ⇒ Gitlab::ObjectifiedHash
Add a new group hook.
-
#add_group_member(team_id, user_id, access_level) ⇒ Gitlab::ObjectifiedHash
Adds a user to group.
-
#add_ldap_group_links(id, commonname, group_access, provider) ⇒ Gitlab::ObjectifiedHash
Add LDAP group link.
-
#all_group_members(id, options = {}) ⇒ Array<Gitlab::ObjectifiedHash>
Gets a list of all group members including inherited members.
-
#create_group(name, path, options = {}) ⇒ Gitlab::ObjectifiedHash
Creates a new group.
-
#delete_group(id) ⇒ Gitlab::ObjectifiedHash
Delete’s a group.
-
#delete_group_custom_attribute(key, group_id = nil) ⇒ Boolean
Delete custom_attribute Will delete a custom_attribute.
-
#delete_group_hook(group_id, hook_id) ⇒ Gitlab::ObjectifiedHash
Delete a group hook.
-
#delete_ldap_group_links(id, commonname, provider) ⇒ Gitlab::ObjectifiedHash
Delete LDAP group link.
-
#edit_group(id, options = {}) ⇒ Gitlab::ObjectifiedHash
Updates an existing group.
-
#edit_group_hook(group_id, hook_id, url, options = {}) ⇒ Gitlab::ObjectifiedHash
Edit a group hook.
-
#edit_group_member(team_id, user_id, access_level) ⇒ Gitlab::ObjectifiedHash
Edit a user of a group.
-
#group(id, options = {}) ⇒ Gitlab::ObjectifiedHash
Gets a single group.
-
#group_billable_members(id, options = {}) ⇒ Array<Gitlab::ObjectifiedHash>
Get a list of group members that are billable.
-
#group_custom_attribute(key, group_id) ⇒ Gitlab::ObjectifiedHash
Gets single group custom_attribute.
-
#group_custom_attributes(group_id) ⇒ Gitlab::ObjectifiedHash
Gets group custom_attributes.
-
#group_descendants(id, options = {}) ⇒ Array<Gitlab::ObjectifiedHash>
Get a list of descendant groups of a group.
-
#group_hook(group_id, hook_id) ⇒ Gitlab::ObjectifiedHash
get specified group hook.
-
#group_issues(group, options = {}) ⇒ Array<Gitlab::ObjectifiedHash>
Gets a list of issues of a 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_merge_requests(group, options = {}) ⇒ Array<Gitlab::ObjectifiedHash>
Gets a list of merge requests of a group.
-
#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.
-
#list_group_hooks(group_id) ⇒ Gitlab::PaginatedResponse
List all the specified groups hooks.
-
#remove_group_member(team_id, user_id) ⇒ Gitlab::ObjectifiedHash
Removes user from user group.
-
#sync_ldap_group(id) ⇒ Array<Gitlab::ObjectifiedHash>
Sync group with LDAP.
-
#transfer_project_to_group(id, project_id) ⇒ Object
Transfers a project to a group.
Instance Method Details
#add_group_custom_attribute(key, value, group_id) ⇒ Gitlab::ObjectifiedHash
Creates a new custom_attribute
340 341 342 343 |
# File 'lib/gitlab/client/groups.rb', line 340 def add_group_custom_attribute(key, value, group_id) url = "/groups/#{group_id}/custom_attributes/#{key}" put(url, body: { value: value }) end |
#add_group_hook(group_id, url, options = {}) ⇒ Gitlab::ObjectifiedHash
Add a new group hook
406 407 408 |
# File 'lib/gitlab/client/groups.rb', line 406 def add_group_hook(group_id, url, = {}) post("/groups/#{group_id}/hooks", body: .merge(url: url)) end |
#add_group_member(team_id, user_id, access_level) ⇒ Gitlab::ObjectifiedHash
Adds a user to group.
156 157 158 |
# File 'lib/gitlab/client/groups.rb', line 156 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 |
#add_ldap_group_links(id, commonname, group_access, provider) ⇒ Gitlab::ObjectifiedHash
Add LDAP group link
292 293 294 |
# File 'lib/gitlab/client/groups.rb', line 292 def add_ldap_group_links(id, commonname, group_access, provider) post("/groups/#{url_encode id}/ldap_group_links", body: { cn: commonname, group_access: group_access, provider: provider }) end |
#all_group_members(id, options = {}) ⇒ Array<Gitlab::ObjectifiedHash>
Gets a list of all group members including inherited members.
85 86 87 |
# File 'lib/gitlab/client/groups.rb', line 85 def all_group_members(id, = {}) get("/groups/#{url_encode id}/members/all", query: ) end |
#create_group(name, path, options = {}) ⇒ Gitlab::ObjectifiedHash
Creates a new group.
44 45 46 47 |
# File 'lib/gitlab/client/groups.rb', line 44 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.
55 56 57 |
# File 'lib/gitlab/client/groups.rb', line 55 def delete_group(id) delete("/groups/#{url_encode id}") end |
#delete_group_custom_attribute(key, group_id = nil) ⇒ Boolean
Delete custom_attribute Will delete a custom_attribute
354 355 356 |
# File 'lib/gitlab/client/groups.rb', line 354 def delete_group_custom_attribute(key, group_id = nil) delete("/groups/#{group_id}/custom_attributes/#{key}") end |
#delete_group_hook(group_id, hook_id) ⇒ Gitlab::ObjectifiedHash
Delete a group hook
448 449 450 |
# File 'lib/gitlab/client/groups.rb', line 448 def delete_group_hook(group_id, hook_id) delete("/groups/#{group_id}/hooks/#{hook_id}") end |
#delete_ldap_group_links(id, commonname, provider) ⇒ Gitlab::ObjectifiedHash
Delete LDAP group link
304 305 306 |
# File 'lib/gitlab/client/groups.rb', line 304 def delete_ldap_group_links(id, commonname, provider) delete("/groups/#{url_encode id}/ldap_group_links/#{url_encode provider}/#{url_encode commonname}") end |
#edit_group(id, options = {}) ⇒ Gitlab::ObjectifiedHash
Updates an existing group.
255 256 257 |
# File 'lib/gitlab/client/groups.rb', line 255 def edit_group(id, = {}) put("/groups/#{url_encode id}", body: ) end |
#edit_group_hook(group_id, hook_id, url, options = {}) ⇒ Gitlab::ObjectifiedHash
Edit a group hook
436 437 438 |
# File 'lib/gitlab/client/groups.rb', line 436 def edit_group_hook(group_id, hook_id, url, = {}) post("/groups/#{group_id}/hooks/#{hook_id}", body: .merge(url: url)) end |
#edit_group_member(team_id, user_id, access_level) ⇒ Gitlab::ObjectifiedHash
Edit a user of a group.
169 170 171 |
# File 'lib/gitlab/client/groups.rb', line 169 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, options = {}) ⇒ Gitlab::ObjectifiedHash
Gets a single group.
31 32 33 |
# File 'lib/gitlab/client/groups.rb', line 31 def group(id, = {}) get("/groups/#{url_encode id}", query: ) end |
#group_billable_members(id, options = {}) ⇒ Array<Gitlab::ObjectifiedHash>
Get a list of group members that are billable.
119 120 121 |
# File 'lib/gitlab/client/groups.rb', line 119 def group_billable_members(id, = {}) get("/groups/#{url_encode id}/billable_members", query: ) end |
#group_custom_attribute(key, group_id) ⇒ Gitlab::ObjectifiedHash
Gets single group custom_attribute.
327 328 329 |
# File 'lib/gitlab/client/groups.rb', line 327 def group_custom_attribute(key, group_id) get("/groups/#{group_id}/custom_attributes/#{key}") end |
#group_custom_attributes(group_id) ⇒ Gitlab::ObjectifiedHash
Gets group custom_attributes.
315 316 317 |
# File 'lib/gitlab/client/groups.rb', line 315 def group_custom_attributes(group_id) get("/groups/#{group_id}/custom_attributes") end |
#group_descendants(id, options = {}) ⇒ Array<Gitlab::ObjectifiedHash>
Get a list of descendant groups of a group.
104 105 106 |
# File 'lib/gitlab/client/groups.rb', line 104 def group_descendants(id, = {}) get("/groups/#{url_encode id}/descendant_groups", query: ) end |
#group_hook(group_id, hook_id) ⇒ Gitlab::ObjectifiedHash
get specified group hook
377 378 379 |
# File 'lib/gitlab/client/groups.rb', line 377 def group_hook(group_id, hook_id) get("/groups/#{group_id}/hooks/#{hook_id}") end |
#group_issues(group, options = {}) ⇒ Array<Gitlab::ObjectifiedHash>
Gets a list of issues of a group.
267 268 269 |
# File 'lib/gitlab/client/groups.rb', line 267 def group_issues(group, = {}) get("/groups/#{group}/issues", query: ) end |
#group_member(team_id, user_id) ⇒ Gitlab::ObjectifiedHash
Get details of a single group member.
131 132 133 |
# File 'lib/gitlab/client/groups.rb', line 131 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.
70 71 72 |
# File 'lib/gitlab/client/groups.rb', line 70 def group_members(id, = {}) get("/groups/#{url_encode id}/members", query: ) end |
#group_merge_requests(group, options = {}) ⇒ Array<Gitlab::ObjectifiedHash>
Gets a list of merge requests of a group.
143 144 145 |
# File 'lib/gitlab/client/groups.rb', line 143 def group_merge_requests(group, = {}) get("/groups/#{group}/merge_requests", query: ) end |
#group_projects(id, options = {}) ⇒ Array<Gitlab::ObjectifiedHash>
Get a list of projects under a group
218 219 220 |
# File 'lib/gitlab/client/groups.rb', line 218 def group_projects(id, = {}) get("/groups/#{url_encode id}/projects", query: ) end |
#group_search(search, options = {}) ⇒ Array<Gitlab::ObjectifiedHash>
Search for groups by name
207 208 209 210 |
# File 'lib/gitlab/client/groups.rb', line 207 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
236 237 238 |
# File 'lib/gitlab/client/groups.rb', line 236 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 |
#list_group_hooks(group_id) ⇒ Gitlab::PaginatedResponse
List all the specified groups hooks
365 366 367 |
# File 'lib/gitlab/client/groups.rb', line 365 def list_group_hooks(group_id) get("/groups/#{group_id}/hooks") end |
#remove_group_member(team_id, user_id) ⇒ Gitlab::ObjectifiedHash
Removes user from user group.
181 182 183 |
# File 'lib/gitlab/client/groups.rb', line 181 def remove_group_member(team_id, user_id) delete("/groups/#{url_encode team_id}/members/#{user_id}") end |
#sync_ldap_group(id) ⇒ Array<Gitlab::ObjectifiedHash>
Sync group with LDAP
278 279 280 |
# File 'lib/gitlab/client/groups.rb', line 278 def sync_ldap_group(id) post("/groups/#{url_encode id}/ldap_sync") end |
#transfer_project_to_group(id, project_id) ⇒ Object
Transfers a project to a group
192 193 194 195 |
# File 'lib/gitlab/client/groups.rb', line 192 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 |