gitlab 4.6.0 → 4.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/gitlab/client/access_requests.rb +92 -90
- data/lib/gitlab/client/award_emojis.rb +126 -124
- data/lib/gitlab/client/boards.rb +81 -79
- data/lib/gitlab/client/branches.rb +89 -87
- data/lib/gitlab/client/build_variables.rb +117 -115
- data/lib/gitlab/client/builds.rb +98 -96
- data/lib/gitlab/client/commits.rb +167 -152
- data/lib/gitlab/client/deployments.rb +29 -27
- data/lib/gitlab/client/environments.rb +80 -78
- data/lib/gitlab/client/events.rb +54 -52
- data/lib/gitlab/client/group_milestones.rb +85 -83
- data/lib/gitlab/client/groups.rb +178 -176
- data/lib/gitlab/client/issues.rb +212 -188
- data/lib/gitlab/client/jobs.rb +150 -148
- data/lib/gitlab/client/keys.rb +14 -12
- data/lib/gitlab/client/labels.rb +79 -77
- data/lib/gitlab/client/merge_request_approvals.rb +101 -99
- data/lib/gitlab/client/merge_requests.rb +291 -277
- data/lib/gitlab/client/milestones.rb +85 -83
- data/lib/gitlab/client/namespaces.rb +18 -16
- data/lib/gitlab/client/notes.rb +260 -258
- data/lib/gitlab/client/pipeline_schedules.rb +123 -121
- data/lib/gitlab/client/pipeline_triggers.rb +93 -91
- data/lib/gitlab/client/pipelines.rb +73 -60
- data/lib/gitlab/client/projects.rb +538 -524
- data/lib/gitlab/client/repositories.rb +67 -65
- data/lib/gitlab/client/repository_files.rb +103 -101
- data/lib/gitlab/client/runners.rb +114 -112
- data/lib/gitlab/client/services.rb +45 -43
- data/lib/gitlab/client/sidekiq.rb +32 -30
- data/lib/gitlab/client/snippets.rb +86 -84
- data/lib/gitlab/client/system_hooks.rb +57 -55
- data/lib/gitlab/client/tags.rb +88 -86
- data/lib/gitlab/client/todos.rb +40 -38
- data/lib/gitlab/client/users.rb +243 -241
- data/lib/gitlab/client/versions.rb +13 -11
- data/lib/gitlab/error.rb +1 -1
- data/lib/gitlab/help.rb +1 -1
- data/lib/gitlab/page_links.rb +1 -1
- data/lib/gitlab/version.rb +1 -1
- metadata +3 -3
data/lib/gitlab/client/tags.rb
CHANGED
@@ -1,95 +1,97 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
#
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
3
|
+
class Gitlab::Client
|
4
|
+
# Defines methods related to tags.
|
5
|
+
# @see https://docs.gitlab.com/ce/api/tags.html
|
6
|
+
module Tags
|
7
|
+
# Gets a list of project repository tags.
|
8
|
+
#
|
9
|
+
# @example
|
10
|
+
# Gitlab.tags(42)
|
11
|
+
#
|
12
|
+
# @param [Integer, String] project The ID or name of a project.
|
13
|
+
# @param [Hash] options A customizable set of options.
|
14
|
+
# @option options [Integer] :page The page number.
|
15
|
+
# @option options [Integer] :per_page The number of results per page.
|
16
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
17
|
+
def tags(project, options = {})
|
18
|
+
get("/projects/#{url_encode project}/repository/tags", query: options)
|
19
|
+
end
|
20
|
+
alias repo_tags tags
|
20
21
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
22
|
+
# Creates a new project repository tag.
|
23
|
+
#
|
24
|
+
# @example
|
25
|
+
# Gitlab.create_tag(42, 'new_tag', 'master')
|
26
|
+
# Gitlab.create_tag(42, 'v1.0', 'master', 'Release 1.0')
|
27
|
+
#
|
28
|
+
# @param [Integer, String] project The ID or name of a project.
|
29
|
+
# @param [String] tag_name The name of the new tag.
|
30
|
+
# @param [String] ref The ref (commit sha, branch name, or another tag) the tag will point to.
|
31
|
+
# @param [String] message Optional message for tag, creates annotated tag if specified.
|
32
|
+
# @param [String] description Optional release notes for tag.
|
33
|
+
# @return [Gitlab::ObjectifiedHash]
|
34
|
+
def create_tag(project, tag_name, ref, message = '', description = nil)
|
35
|
+
post("/projects/#{url_encode project}/repository/tags", body: { tag_name: tag_name, ref: ref, message: message, release_description: description })
|
36
|
+
end
|
37
|
+
alias repo_create_tag create_tag
|
37
38
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
39
|
+
# Gets information about a repository tag.
|
40
|
+
#
|
41
|
+
# @example
|
42
|
+
# Gitlab.tag(3, 'api')
|
43
|
+
# Gitlab.repo_tag(5, 'master')
|
44
|
+
#
|
45
|
+
# @param [Integer, String] project The ID or name of a project.
|
46
|
+
# @param [String] tag The name of the tag.
|
47
|
+
# @return [Gitlab::ObjectifiedHash]
|
48
|
+
def tag(project, tag)
|
49
|
+
get("/projects/#{url_encode project}/repository/tags/#{url_encode tag}")
|
50
|
+
end
|
51
|
+
alias repo_tag tag
|
51
52
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
53
|
+
# Deletes a repository tag. Requires Gitlab >= 6.8.x
|
54
|
+
#
|
55
|
+
# @example
|
56
|
+
# Gitlab.delete_tag(3, 'api')
|
57
|
+
# Gitlab.repo_delete_tag(5, 'master')
|
58
|
+
#
|
59
|
+
# @param [Integer, String] project The ID or name of a project.
|
60
|
+
# @param [String] tag The name of the tag to delete
|
61
|
+
# @return [Gitlab::ObjectifiedHash]
|
62
|
+
def delete_tag(project, tag)
|
63
|
+
delete("/projects/#{url_encode project}/repository/tags/#{url_encode tag}")
|
64
|
+
end
|
65
|
+
alias repo_delete_tag delete_tag
|
65
66
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
67
|
+
# Adds release notes to an existing repository tag. Requires Gitlab >= 8.2.0
|
68
|
+
#
|
69
|
+
# @example
|
70
|
+
# Gitlab.create_release(3, '1.0.0', 'This is ready for production')
|
71
|
+
# Gitlab.repo_create_release(5, '1.0.0', 'This is ready for production')
|
72
|
+
#
|
73
|
+
# @param [Integer, String] project The ID or name of a project.
|
74
|
+
# @param [String] tag The name of the new tag.
|
75
|
+
# @param [String] description Release notes with markdown support
|
76
|
+
# @return [Gitlab::ObjectifiedHash]
|
77
|
+
def create_release(project, tag, description)
|
78
|
+
post("/projects/#{url_encode project}/repository/tags/#{url_encode tag}/release", body: { description: description })
|
79
|
+
end
|
80
|
+
alias repo_create_release create_release
|
80
81
|
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
82
|
+
# Updates the release notes of a given release. Requires Gitlab >= 8.2.0
|
83
|
+
#
|
84
|
+
# @example
|
85
|
+
# Gitlab.update_release(3, '1.0.0', 'This is even more ready for production')
|
86
|
+
# Gitlab.repo_update_release(5, '1.0.0', 'This is even more ready for production')
|
87
|
+
#
|
88
|
+
# @param [Integer, String] project The ID or name of a project.
|
89
|
+
# @param [String] tag The name of the new tag.
|
90
|
+
# @param [String] description Release notes with markdown support
|
91
|
+
# @return [Gitlab::ObjectifiedHash]
|
92
|
+
def update_release(project, tag, description)
|
93
|
+
put("/projects/#{url_encode project}/repository/tags/#{url_encode tag}/release", body: { description: description })
|
94
|
+
end
|
95
|
+
alias repo_update_release update_release
|
93
96
|
end
|
94
|
-
alias repo_update_release update_release
|
95
97
|
end
|
data/lib/gitlab/client/todos.rb
CHANGED
@@ -1,44 +1,46 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
#
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
3
|
+
class Gitlab::Client
|
4
|
+
# Defines methods related to todos
|
5
|
+
# @see https://docs.gitlab.com/ce/api/todos.html
|
6
|
+
module Todos
|
7
|
+
# Gets a list of todos.
|
8
|
+
#
|
9
|
+
# @example
|
10
|
+
# Gitlab.todos
|
11
|
+
# Gitlab.todos({ action: 'assigned' })
|
12
|
+
# Gitlab.todos({ state: 'pending' })
|
13
|
+
#
|
14
|
+
# @param [Hash] options A customizable set of options.
|
15
|
+
# @option options [Integer] :action The action to be filtered. Can be `assigned`, `mentioned`, `build_failed`, `marked`, or `approval_required`.
|
16
|
+
# @option options [Integer] :author_id The ID of an author
|
17
|
+
# @option options [Integer] :project_id The ID of a project
|
18
|
+
# @option options [Integer] :state The state of the todo. Can be either `pending` or `done`
|
19
|
+
# @option options [Integer] :type The type of a todo. Can be either `Issue` or `MergeRequest`
|
20
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
21
|
+
def todos(options = {})
|
22
|
+
get('/todos', query: options)
|
23
|
+
end
|
23
24
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
25
|
+
# Marks a single pending todo for the current user as done.
|
26
|
+
#
|
27
|
+
# @example
|
28
|
+
# Gitlab.mark_todo_as_done(42)
|
29
|
+
#
|
30
|
+
# @param [Integer] id The ID of the todo.
|
31
|
+
# @return [Gitlab::ObjectifiedHash]
|
32
|
+
def mark_todo_as_done(id)
|
33
|
+
post("/todos/#{id}/mark_as_done")
|
34
|
+
end
|
34
35
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
36
|
+
# Marks all todos for the current user as done
|
37
|
+
#
|
38
|
+
# @example
|
39
|
+
# Gitlab.mark_all_todos_as_done
|
40
|
+
#
|
41
|
+
# @return [void] This API call returns an empty response body.
|
42
|
+
def mark_all_todos_as_done
|
43
|
+
post('/todos/mark_as_done')
|
44
|
+
end
|
43
45
|
end
|
44
46
|
end
|
data/lib/gitlab/client/users.rb
CHANGED
@@ -1,264 +1,266 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
#
|
5
|
-
# @see https://docs.gitlab.com/ce/api/
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
3
|
+
class Gitlab::Client
|
4
|
+
# Defines methods related to users.
|
5
|
+
# @see https://docs.gitlab.com/ce/api/users.html
|
6
|
+
# @see https://docs.gitlab.com/ce/api/session.html
|
7
|
+
module Users
|
8
|
+
# Gets a list of users.
|
9
|
+
#
|
10
|
+
# @example
|
11
|
+
# Gitlab.users
|
12
|
+
#
|
13
|
+
# @param [Hash] options A customizable set of options.
|
14
|
+
# @option options [Integer] :page The page number.
|
15
|
+
# @option options [Integer] :per_page The number of results per page.
|
16
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
17
|
+
def users(options = {})
|
18
|
+
get('/users', query: options)
|
19
|
+
end
|
19
20
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
21
|
+
# Gets information about a user.
|
22
|
+
# Will return information about an authorized user if no ID passed.
|
23
|
+
#
|
24
|
+
# @example
|
25
|
+
# Gitlab.user
|
26
|
+
# Gitlab.user(2)
|
27
|
+
#
|
28
|
+
# @param [Integer] id The ID of a user.
|
29
|
+
# @return [Gitlab::ObjectifiedHash]
|
30
|
+
def user(id = nil)
|
31
|
+
id.to_i.zero? ? get('/user') : get("/users/#{id}")
|
32
|
+
end
|
32
33
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
34
|
+
# Creates a new user.
|
35
|
+
# Requires authentication from an admin account.
|
36
|
+
#
|
37
|
+
# @example
|
38
|
+
# Gitlab.create_user('joe@foo.org', 'secret', 'joe', { name: 'Joe Smith' })
|
39
|
+
# or
|
40
|
+
# Gitlab.create_user('joe@foo.org', 'secret')
|
41
|
+
#
|
42
|
+
# @param [String] email The email of a user.
|
43
|
+
# @param [String] password The password of a user.
|
44
|
+
# @param [String] username The username of a user.
|
45
|
+
# @param [Hash] options A customizable set of options.
|
46
|
+
# @option options [String] :name The name of a user. Defaults to email.
|
47
|
+
# @option options [String] :skype The skype of a user.
|
48
|
+
# @option options [String] :linkedin The linkedin of a user.
|
49
|
+
# @option options [String] :twitter The twitter of a user.
|
50
|
+
# @option options [Integer] :projects_limit The limit of projects for a user.
|
51
|
+
# @return [Gitlab::ObjectifiedHash] Information about created user.
|
52
|
+
def create_user(*args)
|
53
|
+
options = args.last.is_a?(Hash) ? args.pop : {}
|
54
|
+
body = if args[2]
|
55
|
+
{ email: args[0], password: args[1], username: args[2] }
|
56
|
+
else
|
57
|
+
{ email: args[0], password: args[1], name: args[0] }
|
58
|
+
end
|
59
|
+
body.merge!(options)
|
60
|
+
post('/users', body: body)
|
61
|
+
end
|
61
62
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
63
|
+
# Updates a user.
|
64
|
+
#
|
65
|
+
# @example
|
66
|
+
# Gitlab.edit_user(15, { email: 'joe.smith@foo.org', projects_limit: 20 })
|
67
|
+
#
|
68
|
+
# @param [Integer] id The ID of a user.
|
69
|
+
# @param [Hash] options A customizable set of options.
|
70
|
+
# @option options [String] :email The email of a user.
|
71
|
+
# @option options [String] :password The password of a user.
|
72
|
+
# @option options [String] :name The name of a user. Defaults to email.
|
73
|
+
# @option options [String] :skype The skype of a user.
|
74
|
+
# @option options [String] :linkedin The linkedin of a user.
|
75
|
+
# @option options [String] :twitter The twitter of a user.
|
76
|
+
# @option options [Integer] :projects_limit The limit of projects for a user.
|
77
|
+
# @return [Gitlab::ObjectifiedHash] Information about created user.
|
78
|
+
def edit_user(user_id, options = {})
|
79
|
+
put("/users/#{user_id}", body: options)
|
80
|
+
end
|
80
81
|
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
82
|
+
# Deletes a user.
|
83
|
+
#
|
84
|
+
# @example
|
85
|
+
# Gitlab.delete_user(1)
|
86
|
+
#
|
87
|
+
# @param [Integer] id The ID of a user.
|
88
|
+
# @return [Gitlab::ObjectifiedHash] Information about deleted user.
|
89
|
+
def delete_user(user_id)
|
90
|
+
delete("/users/#{user_id}")
|
91
|
+
end
|
91
92
|
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
93
|
+
# Blocks the specified user. Available only for admin.
|
94
|
+
#
|
95
|
+
# @example
|
96
|
+
# Gitlab.block_user(15)
|
97
|
+
#
|
98
|
+
# @param [Integer] user_id The Id of user
|
99
|
+
# @return [Boolean] success or not
|
100
|
+
def block_user(user_id)
|
101
|
+
post("/users/#{user_id}/block")
|
102
|
+
end
|
102
103
|
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
104
|
+
# Unblocks the specified user. Available only for admin.
|
105
|
+
#
|
106
|
+
# @example
|
107
|
+
# Gitlab.unblock_user(15)
|
108
|
+
#
|
109
|
+
# @param [Integer] user_id The Id of user
|
110
|
+
# @return [Boolean] success or not
|
111
|
+
def unblock_user(user_id)
|
112
|
+
post("/users/#{user_id}/unblock")
|
113
|
+
end
|
113
114
|
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
115
|
+
# Creates a new user session.
|
116
|
+
#
|
117
|
+
# @example
|
118
|
+
# Gitlab.session('jack@example.com', 'secret12345')
|
119
|
+
#
|
120
|
+
# @param [String] email The email of a user.
|
121
|
+
# @param [String] password The password of a user.
|
122
|
+
# @return [Gitlab::ObjectifiedHash]
|
123
|
+
# @note This method doesn't require private_token to be set.
|
124
|
+
def session(email, password)
|
125
|
+
post('/session', body: { email: email, password: password }, unauthenticated: true)
|
126
|
+
end
|
126
127
|
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
128
|
+
# Gets a list of user's SSH keys.
|
129
|
+
#
|
130
|
+
# @example
|
131
|
+
# Gitlab.ssh_keys
|
132
|
+
# Gitlab.ssh_keys({ user_id: 2 })
|
133
|
+
#
|
134
|
+
# @param [Hash] options A customizable set of options.
|
135
|
+
# @option options [Integer] :page The page number.
|
136
|
+
# @option options [Integer] :per_page The number of results per page.
|
137
|
+
# @option options [Integer] :user_id The ID of the user to retrieve the keys for.
|
138
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
139
|
+
def ssh_keys(options = {})
|
140
|
+
user_id = options.delete :user_id
|
141
|
+
if user_id.to_i.zero?
|
142
|
+
get('/user/keys', query: options)
|
143
|
+
else
|
144
|
+
get("/users/#{user_id}/keys", query: options)
|
145
|
+
end
|
144
146
|
end
|
145
|
-
end
|
146
147
|
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
148
|
+
# Gets information about SSH key.
|
149
|
+
#
|
150
|
+
# @example
|
151
|
+
# Gitlab.ssh_key(1)
|
152
|
+
#
|
153
|
+
# @param [Integer] id The ID of a user's SSH key.
|
154
|
+
# @return [Gitlab::ObjectifiedHash]
|
155
|
+
def ssh_key(id)
|
156
|
+
get("/user/keys/#{id}")
|
157
|
+
end
|
157
158
|
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
159
|
+
# Creates a new SSH key.
|
160
|
+
#
|
161
|
+
# @example
|
162
|
+
# Gitlab.create_ssh_key('key title', 'key body')
|
163
|
+
#
|
164
|
+
# @param [String] title The title of an SSH key.
|
165
|
+
# @param [String] key The SSH key body.
|
166
|
+
# @param [Hash] options A customizable set of options.
|
167
|
+
# @option options [Integer] :user_id id of the user to associate the key with
|
168
|
+
# @return [Gitlab::ObjectifiedHash] Information about created SSH key.
|
169
|
+
def create_ssh_key(title, key, options = {})
|
170
|
+
user_id = options.delete :user_id
|
171
|
+
if user_id.to_i.zero?
|
172
|
+
post('/user/keys', body: { title: title, key: key })
|
173
|
+
else
|
174
|
+
post("/users/#{user_id}/keys", body: { title: title, key: key })
|
175
|
+
end
|
174
176
|
end
|
175
|
-
end
|
176
177
|
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
178
|
+
# Deletes an SSH key.
|
179
|
+
#
|
180
|
+
# @example
|
181
|
+
# Gitlab.delete_ssh_key(1)
|
182
|
+
#
|
183
|
+
# @param [Integer] id The ID of a user's SSH key.
|
184
|
+
# @param [Hash] options A customizable set of options.
|
185
|
+
# @option options [Integer] :user_id id of the user to associate the key with
|
186
|
+
# @return [Gitlab::ObjectifiedHash] Information about deleted SSH key.
|
187
|
+
def delete_ssh_key(id, options = {})
|
188
|
+
user_id = options.delete :user_id
|
189
|
+
if user_id.to_i.zero?
|
190
|
+
delete("/user/keys/#{id}")
|
191
|
+
else
|
192
|
+
delete("/users/#{user_id}/keys/#{id}")
|
193
|
+
end
|
192
194
|
end
|
193
|
-
end
|
194
195
|
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
196
|
+
# Gets user emails.
|
197
|
+
# Will return emails an authorized user if no user ID passed.
|
198
|
+
#
|
199
|
+
# @example
|
200
|
+
# Gitlab.emails
|
201
|
+
# Gitlab.emails(2)
|
202
|
+
#
|
203
|
+
# @param [Integer] user_id The ID of a user.
|
204
|
+
# @return [Gitlab::ObjectifiedHash]
|
205
|
+
def emails(user_id = nil)
|
206
|
+
url = user_id.to_i.zero? ? '/user/emails' : "/users/#{user_id}/emails"
|
207
|
+
get(url)
|
208
|
+
end
|
208
209
|
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
210
|
+
# Get a single email.
|
211
|
+
#
|
212
|
+
# @example
|
213
|
+
# Gitlab.email(3)
|
214
|
+
#
|
215
|
+
# @param [Integer] id The ID of a email.
|
216
|
+
# @return [Gitlab::ObjectifiedHash]
|
217
|
+
def email(id)
|
218
|
+
get("/user/emails/#{id}")
|
219
|
+
end
|
219
220
|
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
221
|
+
# Creates a new email
|
222
|
+
# Will create a new email an authorized user if no user ID passed.
|
223
|
+
#
|
224
|
+
# @example
|
225
|
+
# Gitlab.add_email('email@example.com')
|
226
|
+
# Gitlab.add_email('email@example.com', 2)
|
227
|
+
#
|
228
|
+
# @param [String] email Email address
|
229
|
+
# @param [Integer] user_id The ID of a user.
|
230
|
+
# @return [Gitlab::ObjectifiedHash]
|
231
|
+
def add_email(email, user_id = nil)
|
232
|
+
url = user_id.to_i.zero? ? '/user/emails' : "/users/#{user_id}/emails"
|
233
|
+
post(url, body: { email: email })
|
234
|
+
end
|
234
235
|
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
236
|
+
# Delete email
|
237
|
+
# Will delete a email an authorized user if no user ID passed.
|
238
|
+
#
|
239
|
+
# @example
|
240
|
+
# Gitlab.delete_email(2)
|
241
|
+
# Gitlab.delete_email(3, 2)
|
242
|
+
#
|
243
|
+
# @param [Integer] id Email address ID
|
244
|
+
# @param [Integer] user_id The ID of a user.
|
245
|
+
# @return [Boolean]
|
246
|
+
def delete_email(id, user_id = nil)
|
247
|
+
url = user_id.to_i.zero? ? "/user/emails/#{id}" : "/users/#{user_id}/emails/#{id}"
|
248
|
+
delete(url)
|
249
|
+
end
|
249
250
|
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
251
|
+
# Search for groups by name
|
252
|
+
#
|
253
|
+
# @example
|
254
|
+
# Gitlab.user_search('gitlab')
|
255
|
+
#
|
256
|
+
# @param [String] search A string to search for in user names and paths.
|
257
|
+
# @param [Hash] options A customizable set of options.
|
258
|
+
# @option options [String] :per_page Number of user to return per page
|
259
|
+
# @option options [String] :page The page to retrieve
|
260
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
261
|
+
def user_search(search, options = {})
|
262
|
+
options[:search] = search
|
263
|
+
get('/users', query: options)
|
264
|
+
end
|
263
265
|
end
|
264
266
|
end
|