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.
-
#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
348 349 350 351 |
# File 'lib/gitlab/client/groups.rb', line 348 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
414 415 416 |
# File 'lib/gitlab/client/groups.rb', line 414 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
300 301 302 |
# File 'lib/gitlab/client/groups.rb', line 300 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
362 363 364 |
# File 'lib/gitlab/client/groups.rb', line 362 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
456 457 458 |
# File 'lib/gitlab/client/groups.rb', line 456 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
312 313 314 |
# File 'lib/gitlab/client/groups.rb', line 312 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.
263 264 265 |
# File 'lib/gitlab/client/groups.rb', line 263 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
444 445 446 |
# File 'lib/gitlab/client/groups.rb', line 444 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.
176 177 178 179 |
# File 'lib/gitlab/client/groups.rb', line 176 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.
335 336 337 |
# File 'lib/gitlab/client/groups.rb', line 335 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.
323 324 325 |
# File 'lib/gitlab/client/groups.rb', line 323 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
385 386 387 |
# File 'lib/gitlab/client/groups.rb', line 385 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.
275 276 277 |
# File 'lib/gitlab/client/groups.rb', line 275 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
226 227 228 |
# File 'lib/gitlab/client/groups.rb', line 226 def group_projects(id, = {}) get("/groups/#{url_encode id}/projects", query: ) end |
#group_search(search, options = {}) ⇒ Array<Gitlab::ObjectifiedHash>
Search for groups by name
215 216 217 218 |
# File 'lib/gitlab/client/groups.rb', line 215 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
244 245 246 |
# File 'lib/gitlab/client/groups.rb', line 244 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
373 374 375 |
# File 'lib/gitlab/client/groups.rb', line 373 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.
189 190 191 |
# File 'lib/gitlab/client/groups.rb', line 189 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
286 287 288 |
# File 'lib/gitlab/client/groups.rb', line 286 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
200 201 202 203 |
# File 'lib/gitlab/client/groups.rb', line 200 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 |