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, options = {}) ⇒ 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, options = {}) ⇒ 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.
-
#override_group_member(team_id, user_id) ⇒ Object
Set LDAP override flag for a member of a group.
-
#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
359 360 361 362 |
# File 'lib/gitlab/client/groups.rb', line 359 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
425 426 427 |
# File 'lib/gitlab/client/groups.rb', line 425 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, options = {}) ⇒ Gitlab::ObjectifiedHash
Adds a user to group.
159 160 161 162 |
# File 'lib/gitlab/client/groups.rb', line 159 def add_group_member(team_id, user_id, access_level, = {}) body = { user_id: user_id, access_level: access_level }.merge() post("/groups/#{url_encode team_id}/members", body: body) end |
#add_ldap_group_links(id, commonname, group_access, provider) ⇒ Gitlab::ObjectifiedHash
Add LDAP group link
311 312 313 |
# File 'lib/gitlab/client/groups.rb', line 311 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
373 374 375 |
# File 'lib/gitlab/client/groups.rb', line 373 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
467 468 469 |
# File 'lib/gitlab/client/groups.rb', line 467 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
323 324 325 |
# File 'lib/gitlab/client/groups.rb', line 323 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.
274 275 276 |
# File 'lib/gitlab/client/groups.rb', line 274 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
455 456 457 |
# File 'lib/gitlab/client/groups.rb', line 455 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, options = {}) ⇒ Gitlab::ObjectifiedHash
Edit a user of a group.
187 188 189 190 |
# File 'lib/gitlab/client/groups.rb', line 187 def edit_group_member(team_id, user_id, access_level, = {}) body = { access_level: access_level }.merge() put("/groups/#{url_encode team_id}/members/#{user_id}", body: body) 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.
346 347 348 |
# File 'lib/gitlab/client/groups.rb', line 346 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.
334 335 336 |
# File 'lib/gitlab/client/groups.rb', line 334 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
396 397 398 |
# File 'lib/gitlab/client/groups.rb', line 396 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.
286 287 288 |
# File 'lib/gitlab/client/groups.rb', line 286 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
237 238 239 |
# File 'lib/gitlab/client/groups.rb', line 237 def group_projects(id, = {}) get("/groups/#{url_encode id}/projects", query: ) end |
#group_search(search, options = {}) ⇒ Array<Gitlab::ObjectifiedHash>
Search for groups by name
226 227 228 229 |
# File 'lib/gitlab/client/groups.rb', line 226 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
255 256 257 |
# File 'lib/gitlab/client/groups.rb', line 255 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
384 385 386 |
# File 'lib/gitlab/client/groups.rb', line 384 def list_group_hooks(group_id) get("/groups/#{group_id}/hooks") end |
#override_group_member(team_id, user_id) ⇒ Object
Set LDAP override flag for a member of a group
171 172 173 |
# File 'lib/gitlab/client/groups.rb', line 171 def override_group_member(team_id, user_id) post("/groups/#{url_encode team_id}/members/#{user_id}/override") end |
#remove_group_member(team_id, user_id) ⇒ Gitlab::ObjectifiedHash
Removes user from user group.
200 201 202 |
# File 'lib/gitlab/client/groups.rb', line 200 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
297 298 299 |
# File 'lib/gitlab/client/groups.rb', line 297 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
211 212 213 214 |
# File 'lib/gitlab/client/groups.rb', line 211 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 |