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_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.
-
#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_ldap_group_links(id, commonname, provider) ⇒ Gitlab::ObjectifiedHash
Delete LDAP group link.
-
#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, 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_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.
-
#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
306 307 308 309 |
# File 'lib/gitlab/client/groups.rb', line 306 def add_group_custom_attribute(key, value, group_id) url = "/groups/#{group_id}/custom_attributes/#{key}" put(url, body: { value: value }) end |
#add_group_member(team_id, user_id, access_level) ⇒ Gitlab::ObjectifiedHash
Adds a user to group.
122 123 124 |
# File 'lib/gitlab/client/groups.rb', line 122 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
258 259 260 |
# File 'lib/gitlab/client/groups.rb', line 258 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 |
#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
320 321 322 |
# File 'lib/gitlab/client/groups.rb', line 320 def delete_group_custom_attribute(key, group_id = nil) delete("/groups/#{group_id}/custom_attributes/#{key}") end |
#delete_ldap_group_links(id, commonname, provider) ⇒ Gitlab::ObjectifiedHash
Delete LDAP group link
270 271 272 |
# File 'lib/gitlab/client/groups.rb', line 270 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.
221 222 223 |
# File 'lib/gitlab/client/groups.rb', line 221 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.
135 136 137 |
# File 'lib/gitlab/client/groups.rb', line 135 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.
85 86 87 |
# File 'lib/gitlab/client/groups.rb', line 85 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.
293 294 295 |
# File 'lib/gitlab/client/groups.rb', line 293 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.
281 282 283 |
# File 'lib/gitlab/client/groups.rb', line 281 def group_custom_attributes(group_id) get("/groups/#{group_id}/custom_attributes") end |
#group_issues(group, options = {}) ⇒ Array<Gitlab::ObjectifiedHash>
Gets a list of issues of a group.
233 234 235 |
# File 'lib/gitlab/client/groups.rb', line 233 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.
97 98 99 |
# File 'lib/gitlab/client/groups.rb', line 97 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.
109 110 111 |
# File 'lib/gitlab/client/groups.rb', line 109 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
184 185 186 |
# File 'lib/gitlab/client/groups.rb', line 184 def group_projects(id, = {}) get("/groups/#{url_encode id}/projects", query: ) end |
#group_search(search, options = {}) ⇒ Array<Gitlab::ObjectifiedHash>
Search for groups by name
173 174 175 176 |
# File 'lib/gitlab/client/groups.rb', line 173 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
202 203 204 |
# File 'lib/gitlab/client/groups.rb', line 202 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.
147 148 149 |
# File 'lib/gitlab/client/groups.rb', line 147 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
244 245 246 |
# File 'lib/gitlab/client/groups.rb', line 244 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
158 159 160 161 |
# File 'lib/gitlab/client/groups.rb', line 158 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 |