gitlab 4.5.0 → 4.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/stale.yml +18 -0
- data/.rubocop_todo.yml +46 -0
- data/Gemfile +2 -0
- data/README.md +22 -22
- data/Rakefile +3 -5
- data/bin/console +1 -0
- data/exe/gitlab +5 -1
- data/gitlab.gemspec +9 -6
- data/lib/gitlab.rb +6 -3
- data/lib/gitlab/api.rb +5 -3
- data/lib/gitlab/cli.rb +11 -5
- data/lib/gitlab/cli_helpers.rb +31 -22
- data/lib/gitlab/client.rb +7 -8
- data/lib/gitlab/client/access_requests.rb +100 -93
- data/lib/gitlab/client/award_emojis.rb +127 -127
- data/lib/gitlab/client/boards.rb +82 -82
- data/lib/gitlab/client/branches.rb +89 -89
- data/lib/gitlab/client/build_variables.rb +117 -117
- data/lib/gitlab/client/builds.rb +98 -98
- data/lib/gitlab/client/commits.rb +154 -154
- data/lib/gitlab/client/deployments.rb +29 -29
- data/lib/gitlab/client/environments.rb +80 -80
- data/lib/gitlab/client/events.rb +54 -54
- data/lib/gitlab/client/group_milestones.rb +85 -86
- data/lib/gitlab/client/groups.rb +178 -178
- data/lib/gitlab/client/issues.rb +195 -196
- data/lib/gitlab/client/jobs.rb +150 -150
- data/lib/gitlab/client/keys.rb +14 -14
- data/lib/gitlab/client/labels.rb +79 -79
- data/lib/gitlab/client/merge_request_approvals.rb +102 -102
- data/lib/gitlab/client/merge_requests.rb +281 -256
- data/lib/gitlab/client/milestones.rb +85 -85
- data/lib/gitlab/client/namespaces.rb +18 -18
- data/lib/gitlab/client/notes.rb +260 -260
- data/lib/gitlab/client/pipeline_schedules.rb +123 -123
- data/lib/gitlab/client/pipeline_triggers.rb +93 -93
- data/lib/gitlab/client/pipelines.rb +62 -62
- data/lib/gitlab/client/projects.rb +526 -505
- data/lib/gitlab/client/repositories.rb +68 -55
- data/lib/gitlab/client/repository_files.rb +103 -103
- data/lib/gitlab/client/runners.rb +113 -115
- data/lib/gitlab/client/services.rb +46 -45
- data/lib/gitlab/client/sidekiq.rb +32 -32
- data/lib/gitlab/client/snippets.rb +86 -86
- data/lib/gitlab/client/system_hooks.rb +57 -57
- data/lib/gitlab/client/tags.rb +87 -88
- data/lib/gitlab/client/todos.rb +41 -41
- data/lib/gitlab/client/users.rb +242 -228
- data/lib/gitlab/client/versions.rb +16 -0
- data/lib/gitlab/configuration.rb +7 -5
- data/lib/gitlab/error.rb +3 -1
- data/lib/gitlab/file_response.rb +4 -2
- data/lib/gitlab/help.rb +9 -9
- data/lib/gitlab/objectified_hash.rb +5 -4
- data/lib/gitlab/page_links.rb +9 -7
- data/lib/gitlab/paginated_response.rb +14 -4
- data/lib/gitlab/request.rb +8 -5
- data/lib/gitlab/shell.rb +6 -4
- data/lib/gitlab/shell_history.rb +7 -5
- data/lib/gitlab/version.rb +3 -1
- metadata +8 -5
data/lib/gitlab/client/groups.rb
CHANGED
@@ -1,193 +1,193 @@
|
|
1
|
-
|
2
|
-
# Defines methods related to groups.
|
3
|
-
# @see https://docs.gitlab.com/ce/api/groups.html
|
4
|
-
module Groups
|
5
|
-
# Gets a list of groups.
|
6
|
-
#
|
7
|
-
# @example
|
8
|
-
# Gitlab.groups
|
9
|
-
# Gitlab.groups({ per_page: 40, page: 2 })
|
10
|
-
#
|
11
|
-
# @param [Hash] options A customizable set of options.
|
12
|
-
# @option options [Integer] :page The page number.
|
13
|
-
# @option options [Integer] :per_page The number of results per page.
|
14
|
-
# @return [Array<Gitlab::ObjectifiedHash>]
|
15
|
-
def groups(options={})
|
16
|
-
get("/groups", query: options)
|
17
|
-
end
|
1
|
+
# frozen_string_literal: true
|
18
2
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
3
|
+
# Defines methods related to groups.
|
4
|
+
# @see https://docs.gitlab.com/ce/api/groups.html
|
5
|
+
module Groups
|
6
|
+
# Gets a list of groups.
|
7
|
+
#
|
8
|
+
# @example
|
9
|
+
# Gitlab.groups
|
10
|
+
# Gitlab.groups({ per_page: 40, page: 2 })
|
11
|
+
#
|
12
|
+
# @param [Hash] options A customizable set of options.
|
13
|
+
# @option options [Integer] :page The page number.
|
14
|
+
# @option options [Integer] :per_page The number of results per page.
|
15
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
16
|
+
def groups(options = {})
|
17
|
+
get('/groups', query: options)
|
18
|
+
end
|
29
19
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
body = { name: name, path: path }.merge(options)
|
41
|
-
post("/groups", body: body)
|
42
|
-
end
|
20
|
+
# Gets a single group.
|
21
|
+
#
|
22
|
+
# @example
|
23
|
+
# Gitlab.group(42)
|
24
|
+
#
|
25
|
+
# @param [Integer] id The ID of a group.
|
26
|
+
# @return [Gitlab::ObjectifiedHash]
|
27
|
+
def group(id)
|
28
|
+
get("/groups/#{url_encode id}")
|
29
|
+
end
|
43
30
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
31
|
+
# Creates a new group.
|
32
|
+
#
|
33
|
+
# @example
|
34
|
+
# Gitlab.create_group('new-group', 'group-path')
|
35
|
+
# Gitlab.create_group('gitlab', 'gitlab-path', { description: 'New Gitlab project' })
|
36
|
+
#
|
37
|
+
# @param [String] name The name of a group.
|
38
|
+
# @param [String] path The path of a group.
|
39
|
+
# @return [Gitlab::ObjectifiedHash] Information about created group.
|
40
|
+
def create_group(name, path, options = {})
|
41
|
+
body = { name: name, path: path }.merge(options)
|
42
|
+
post('/groups', body: body)
|
43
|
+
end
|
53
44
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
# @option options [Integer] :per_page The number of results per page.
|
64
|
-
# @return [Array<Gitlab::ObjectifiedHash>]
|
65
|
-
def group_members(id, options={})
|
66
|
-
get("/groups/#{url_encode id}/members", query: options)
|
67
|
-
end
|
45
|
+
# Delete's a group.
|
46
|
+
#
|
47
|
+
# @example
|
48
|
+
# Gitlab.delete_group(42)
|
49
|
+
# @param [Integer] id The ID of a group
|
50
|
+
# @return [Gitlab::ObjectifiedHash] Information about the deleted group.
|
51
|
+
def delete_group(id)
|
52
|
+
delete("/groups/#{url_encode id}")
|
53
|
+
end
|
68
54
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
55
|
+
# Get a list of group members.
|
56
|
+
#
|
57
|
+
# @example
|
58
|
+
# Gitlab.group_members(1)
|
59
|
+
# Gitlab.group_members(1, { per_page: 40 })
|
60
|
+
#
|
61
|
+
# @param [Integer] id The ID of a group.
|
62
|
+
# @param [Hash] options A customizable set of options.
|
63
|
+
# @option options [Integer] :page The page number.
|
64
|
+
# @option options [Integer] :per_page The number of results per page.
|
65
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
66
|
+
def group_members(id, options = {})
|
67
|
+
get("/groups/#{url_encode id}/members", query: options)
|
68
|
+
end
|
69
|
+
|
70
|
+
# Get details of a single group member.
|
71
|
+
#
|
72
|
+
# @example
|
73
|
+
# Gitlab.group_member(1, 10)
|
74
|
+
#
|
75
|
+
# @param [Integer] team_id The ID of the group to find a member in.
|
76
|
+
# @param [Integer] user_id The user id of the member to find.
|
77
|
+
# @return [Gitlab::ObjectifiedHash] (id, username, name, email, state, access_level ...)
|
78
|
+
def group_member(team_id, user_id)
|
79
|
+
get("/groups/#{url_encode team_id}/members/#{user_id}")
|
80
|
+
end
|
80
81
|
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
82
|
+
# Adds a user to group.
|
83
|
+
#
|
84
|
+
# @example
|
85
|
+
# Gitlab.add_group_member(1, 2, 40)
|
86
|
+
#
|
87
|
+
# @param [Integer] team_id The group id to add a member to.
|
88
|
+
# @param [Integer] user_id The user id of the user to add to the team.
|
89
|
+
# @param [Integer] access_level Project access level.
|
90
|
+
# @return [Gitlab::ObjectifiedHash] Information about added team member.
|
91
|
+
def add_group_member(team_id, user_id, access_level)
|
92
|
+
post("/groups/#{url_encode team_id}/members", body: { user_id: user_id, access_level: access_level })
|
93
|
+
end
|
93
94
|
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
95
|
+
# Edit a user of a group.
|
96
|
+
#
|
97
|
+
# @example
|
98
|
+
# Gitlab.edit_group_member(1, 2, 40)
|
99
|
+
#
|
100
|
+
# @param [Integer] team_id The group id of member to edit.
|
101
|
+
# @param [Integer] user_id The user id of the user to edit.
|
102
|
+
# @param [Integer] access_level Project access level.
|
103
|
+
# @return [Gitlab::ObjectifiedHash] Information about edited team member.
|
104
|
+
def edit_group_member(team_id, user_id, access_level)
|
105
|
+
put("/groups/#{url_encode team_id}/members/#{user_id}", body: { access_level: access_level })
|
106
|
+
end
|
106
107
|
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
108
|
+
# Removes user from user group.
|
109
|
+
#
|
110
|
+
# @example
|
111
|
+
# Gitlab.remove_group_member(1, 2)
|
112
|
+
#
|
113
|
+
# @param [Integer] team_id The group ID.
|
114
|
+
# @param [Integer] user_id The ID of a user.
|
115
|
+
# @return [Gitlab::ObjectifiedHash] Information about removed team member.
|
116
|
+
def remove_group_member(team_id, user_id)
|
117
|
+
delete("/groups/#{url_encode team_id}/members/#{user_id}")
|
118
|
+
end
|
118
119
|
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
120
|
+
# Transfers a project to a group
|
121
|
+
#
|
122
|
+
# @example
|
123
|
+
# Gitlab.transfer_project_to_group(3, 50)
|
124
|
+
#
|
125
|
+
# @param [Integer] id The ID of a group.
|
126
|
+
# @param [Integer] project_id The ID of a project.
|
127
|
+
def transfer_project_to_group(id, project_id)
|
128
|
+
body = { id: id, project_id: project_id }
|
129
|
+
post("/groups/#{url_encode id}/projects/#{project_id}", body: body)
|
130
|
+
end
|
130
131
|
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
132
|
+
# Search for groups by name
|
133
|
+
#
|
134
|
+
# @example
|
135
|
+
# Gitlab.group_search('gitlab')
|
136
|
+
#
|
137
|
+
# @param [String] search A string to search for in group names and paths.
|
138
|
+
# @param [Hash] options A customizable set of options.
|
139
|
+
# @option options [String] :per_page Number of projects to return per page
|
140
|
+
# @option options [String] :page The page to retrieve
|
141
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
142
|
+
def group_search(search, options = {})
|
143
|
+
options[:search] = search
|
144
|
+
get('/groups', query: options)
|
145
|
+
end
|
145
146
|
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
147
|
+
# Get a list of projects under a group
|
148
|
+
# @example
|
149
|
+
# Gitlab.group_projects(1)
|
150
|
+
#
|
151
|
+
# @param [Integer] id The ID of a group
|
152
|
+
# @return [Array<Gitlab::ObjectifiedHash>] List of projects under a group
|
153
|
+
def group_projects(id, options = {})
|
154
|
+
get("/groups/#{url_encode id}/projects", query: options)
|
155
|
+
end
|
155
156
|
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
157
|
+
# Get a list of subgroups under a group
|
158
|
+
# @example
|
159
|
+
# Gitlab.group_subgroups(1)
|
160
|
+
#
|
161
|
+
# @param [Integer] id the ID of a group
|
162
|
+
# @param [Hash] options A customizable set of options.
|
163
|
+
# @option options [String] :skip_groups Skip the group IDs passed.
|
164
|
+
# @option options [String] :all_available Show all the groups you have access to (defaults to false for authenticated users).
|
165
|
+
# @option options [String] :search Return the list of authorized groups matching the search criteria.
|
166
|
+
# @option options [String] :order_by Order groups by name or path. Default is name.
|
167
|
+
# @option options [String] :sort Order groups in asc or desc order. Default is asc.
|
168
|
+
# @option options [String] :statistics Include group statistics (admins only).
|
169
|
+
# @option options [String] :owned Limit to groups owned by the current user.
|
170
|
+
# @return [Array<Gitlab::ObjectifiedHash>] List of subgroups under a group
|
171
|
+
def group_subgroups(id, options = {})
|
172
|
+
get("/groups/#{url_encode id}/subgroups", query: options)
|
173
|
+
end
|
173
174
|
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
end
|
175
|
+
# Updates an existing group.
|
176
|
+
#
|
177
|
+
# @example
|
178
|
+
# Gitlab.edit_group(42)
|
179
|
+
# Gitlab.edit_group(42, { name: 'Group Name' })
|
180
|
+
#
|
181
|
+
# @param [Integer] group The ID.
|
182
|
+
# @param [Hash] options A customizable set of options
|
183
|
+
# @option options [String] :name The name of the group.
|
184
|
+
# @option options [String] :path The path of the group.
|
185
|
+
# @option options [String] :description The description of the group.
|
186
|
+
# @option options [String] :visibility The visibility level of the group. Can be private, internal, or public
|
187
|
+
# @option options [String] :lfs_enabled Enable/disable Large File Storage (LFS) for the projects in this groupr.
|
188
|
+
# @option options [String] :request_access_enabled Allow users to request member access.
|
189
|
+
# @return [Gitlab::ObjectifiedHash] Information about the edited group.
|
190
|
+
def edit_group(id, options = {})
|
191
|
+
put("/groups/#{url_encode id}", body: options)
|
192
192
|
end
|
193
193
|
end
|
data/lib/gitlab/client/issues.rb
CHANGED
@@ -1,208 +1,207 @@
|
|
1
|
-
|
2
|
-
# Defines methods related to issues.
|
3
|
-
# @see https://docs.gitlab.com/ce/api/issues.html
|
4
|
-
module Issues
|
5
|
-
# Gets a list of user's issues.
|
6
|
-
# Will return a list of project's issues if project ID passed.
|
7
|
-
#
|
8
|
-
# @example
|
9
|
-
# Gitlab.issues
|
10
|
-
# Gitlab.issues(5)
|
11
|
-
# Gitlab.issues({ per_page: 40 })
|
12
|
-
#
|
13
|
-
# @param [Integer, String] project The ID or name of a project.
|
14
|
-
# @param [Hash] options A customizable set of options.
|
15
|
-
# @option options [Integer] :page The page number.
|
16
|
-
# @option options [Integer] :per_page The number of results per page.
|
17
|
-
# @return [Array<Gitlab::ObjectifiedHash>]
|
18
|
-
def issues(project=nil, options={})
|
19
|
-
if project.to_s.empty? && project.to_i.zero?
|
20
|
-
get("/issues", query: options)
|
21
|
-
else
|
22
|
-
get("/projects/#{url_encode project}/issues", query: options)
|
23
|
-
end
|
24
|
-
end
|
1
|
+
# frozen_string_literal: true
|
25
2
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
3
|
+
# Defines methods related to issues.
|
4
|
+
# @see https://docs.gitlab.com/ce/api/issues.html
|
5
|
+
module Issues
|
6
|
+
# Gets a list of user's issues.
|
7
|
+
# Will return a list of project's issues if project ID passed.
|
8
|
+
#
|
9
|
+
# @example
|
10
|
+
# Gitlab.issues
|
11
|
+
# Gitlab.issues(5)
|
12
|
+
# Gitlab.issues({ per_page: 40 })
|
13
|
+
#
|
14
|
+
# @param [Integer, String] project The ID or name of a project.
|
15
|
+
# @param [Hash] options A customizable set of options.
|
16
|
+
# @option options [Integer] :page The page number.
|
17
|
+
# @option options [Integer] :per_page The number of results per page.
|
18
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
19
|
+
def issues(project = nil, options = {})
|
20
|
+
if project.to_s.empty? && project.to_i.zero?
|
21
|
+
get('/issues', query: options)
|
22
|
+
else
|
23
|
+
get("/projects/#{url_encode project}/issues", query: options)
|
36
24
|
end
|
25
|
+
end
|
37
26
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
# @option options [Integer] :milestone_id The ID of a milestone to assign issue.
|
50
|
-
# @option options [String] :labels Comma-separated label names for an issue.
|
51
|
-
# @return [Gitlab::ObjectifiedHash] Information about created issue.
|
52
|
-
def create_issue(project, title, options={})
|
53
|
-
body = { title: title }.merge(options)
|
54
|
-
post("/projects/#{url_encode project}/issues", body: body)
|
55
|
-
end
|
27
|
+
# Gets a single issue.
|
28
|
+
#
|
29
|
+
# @example
|
30
|
+
# Gitlab.issue(5, 42)
|
31
|
+
#
|
32
|
+
# @param [Integer, String] project The ID or name of a project.
|
33
|
+
# @param [Integer] id The ID of an issue.
|
34
|
+
# @return [Gitlab::ObjectifiedHash]
|
35
|
+
def issue(project, id)
|
36
|
+
get("/projects/#{url_encode project}/issues/#{id}")
|
37
|
+
end
|
56
38
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
39
|
+
# Creates a new issue.
|
40
|
+
#
|
41
|
+
# @example
|
42
|
+
# Gitlab.create_issue(5, 'New issue')
|
43
|
+
# Gitlab.create_issue(5, 'New issue', { description: 'This is a new issue', assignee_id: 42 })
|
44
|
+
#
|
45
|
+
# @param [Integer, String] project The ID or name of a project.
|
46
|
+
# @param [String] title The title of an issue.
|
47
|
+
# @param [Hash] options A customizable set of options.
|
48
|
+
# @option options [String] :description The description of an issue.
|
49
|
+
# @option options [Integer] :assignee_id The ID of a user to assign issue.
|
50
|
+
# @option options [Integer] :milestone_id The ID of a milestone to assign issue.
|
51
|
+
# @option options [String] :labels Comma-separated label names for an issue.
|
52
|
+
# @return [Gitlab::ObjectifiedHash] Information about created issue.
|
53
|
+
def create_issue(project, title, options = {})
|
54
|
+
body = { title: title }.merge(options)
|
55
|
+
post("/projects/#{url_encode project}/issues", body: body)
|
56
|
+
end
|
75
57
|
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
58
|
+
# Updates an issue.
|
59
|
+
#
|
60
|
+
# @example
|
61
|
+
# Gitlab.edit_issue(6, 1, { title: 'Updated title' })
|
62
|
+
#
|
63
|
+
# @param [Integer, String] project The ID or name of a project.
|
64
|
+
# @param [Integer] id The ID of an issue.
|
65
|
+
# @param [Hash] options A customizable set of options.
|
66
|
+
# @option options [String] :title The title of an issue.
|
67
|
+
# @option options [String] :description The description of an issue.
|
68
|
+
# @option options [Integer] :assignee_id The ID of a user to assign issue.
|
69
|
+
# @option options [Integer] :milestone_id The ID of a milestone to assign issue.
|
70
|
+
# @option options [String] :labels Comma-separated label names for an issue.
|
71
|
+
# @option options [String] :state_event The state event of an issue ('close' or 'reopen').
|
72
|
+
# @return [Gitlab::ObjectifiedHash] Information about updated issue.
|
73
|
+
def edit_issue(project, id, options = {})
|
74
|
+
put("/projects/#{url_encode project}/issues/#{id}", body: options)
|
75
|
+
end
|
87
76
|
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
77
|
+
# Closes an issue.
|
78
|
+
#
|
79
|
+
# @example
|
80
|
+
# Gitlab.close_issue(3, 42)
|
81
|
+
#
|
82
|
+
# @param [Integer, String] project The ID or name of a project.
|
83
|
+
# @param [Integer] id The ID of an issue.
|
84
|
+
# @return [Gitlab::ObjectifiedHash] Information about closed issue.
|
85
|
+
def close_issue(project, id)
|
86
|
+
put("/projects/#{url_encode project}/issues/#{id}", body: { state_event: 'close' })
|
87
|
+
end
|
99
88
|
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
89
|
+
# Reopens an issue.
|
90
|
+
#
|
91
|
+
# @example
|
92
|
+
# Gitlab.reopen_issue(3, 42)
|
93
|
+
#
|
94
|
+
# @param [Integer, String] project The ID or name of a project.
|
95
|
+
# @param [Integer] id The ID of an issue.
|
96
|
+
# @return [Gitlab::ObjectifiedHash] Information about reopened issue.
|
97
|
+
def reopen_issue(project, id)
|
98
|
+
put("/projects/#{url_encode project}/issues/#{id}", body: { state_event: 'reopen' })
|
99
|
+
end
|
111
100
|
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
101
|
+
# Subscribe to an issue.
|
102
|
+
#
|
103
|
+
# @example
|
104
|
+
# Gitlab.subscribe_to_issue(3, 42)
|
105
|
+
#
|
106
|
+
# @param [Integer, String] project The ID or name of a project.
|
107
|
+
# @param [Integer] id The ID of an issue.
|
108
|
+
# @return [Gitlab::ObjectifiedHash] Information about subscribed issue.
|
109
|
+
def subscribe_to_issue(project, id)
|
110
|
+
post("/projects/#{url_encode project}/issues/#{id}/subscribe")
|
111
|
+
end
|
123
112
|
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
end
|
113
|
+
# Unsubscribe from an issue.
|
114
|
+
#
|
115
|
+
# @example
|
116
|
+
# Gitlab.unsubscribe_from_issue(3, 42)
|
117
|
+
#
|
118
|
+
# @param [Integer, String] project The ID or name of a project.
|
119
|
+
# @param [Integer] id The ID of an issue.
|
120
|
+
# @return [Gitlab::ObjectifiedHash] Information about unsubscribed issue.
|
121
|
+
def unsubscribe_from_issue(project, id)
|
122
|
+
post("/projects/#{url_encode project}/issues/#{id}/unsubscribe")
|
123
|
+
end
|
136
124
|
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
125
|
+
# Deletes an issue.
|
126
|
+
# Only for admins and project owners
|
127
|
+
#
|
128
|
+
# @example
|
129
|
+
# Gitlab.delete_issue(3, 42)
|
130
|
+
#
|
131
|
+
# @param [Integer, String] project The ID or name of a project.
|
132
|
+
# @param [Integer] id The ID of an issue.
|
133
|
+
# @return [Gitlab::ObjectifiedHash] Information about deleted issue.
|
134
|
+
def delete_issue(project, id)
|
135
|
+
delete("/projects/#{url_encode project}/issues/#{id}")
|
136
|
+
end
|
137
|
+
|
138
|
+
# Move an issue.
|
139
|
+
#
|
140
|
+
# @example
|
141
|
+
# Gitlab.move_issue(3, 42, { to_project_id: '4' })
|
142
|
+
#
|
143
|
+
# @param [Integer, String] project The ID or name of a project.
|
144
|
+
# @param [Integer] id The ID of an issue.
|
145
|
+
# @option options [String] :to_project_id The ID of the new project.
|
146
|
+
# @return [Gitlab::ObjectifiedHash] Information about moved issue.
|
147
|
+
def move_issue(project, id, options = {})
|
148
|
+
post("/projects/#{url_encode project}/issues/#{id}/move", body: options)
|
149
|
+
end
|
150
|
+
|
151
|
+
# Sets an estimated time of work for an issue.
|
152
|
+
#
|
153
|
+
# @example
|
154
|
+
# Gitlab.estimate_time_of_issue(3, 42, '3h30m')
|
155
|
+
#
|
156
|
+
# @param [Integer, String] project The ID or name of a project.
|
157
|
+
# @param [Integer] id The ID of an issue.
|
158
|
+
# @param [String] duration The duration in human format. e.g: 3h30m
|
159
|
+
def estimate_time_of_issue(project, id, duration)
|
160
|
+
post("/projects/#{url_encode project}/issues/#{id}/time_estimate", body: { duration: url_encode(duration) })
|
161
|
+
end
|
162
|
+
|
163
|
+
# Resets the estimated time for an issue to 0 seconds.
|
164
|
+
#
|
165
|
+
# @example
|
166
|
+
# Gitlab.reset_time_estimate_of_issue(3, 42)
|
167
|
+
#
|
168
|
+
# @param [Integer, String] project The ID or name of a project.
|
169
|
+
# @param [Integer] id The ID of an issue.
|
170
|
+
def reset_time_estimate_of_issue(project, id)
|
171
|
+
post("/projects/#{url_encode project}/issues/#{id}/reset_time_estimate")
|
172
|
+
end
|
173
|
+
|
174
|
+
# Adds spent time for an issue
|
175
|
+
#
|
176
|
+
# @example
|
177
|
+
# Gitlab.estimate_time_of_issue(3, 42, '3h30m')
|
178
|
+
#
|
179
|
+
# @param [Integer, String] project The ID or name of a project.
|
180
|
+
# @param [Integer] id The ID of an issue.
|
181
|
+
# @param [String] duration The time spent in human format. e.g: 3h30m
|
182
|
+
def add_time_spent_on_issue(project, id, duration)
|
183
|
+
post("/projects/#{url_encode project}/issues/#{id}/add_spent_time", body: { duration: url_encode(duration) })
|
184
|
+
end
|
185
|
+
|
186
|
+
# Resets the total spent time for this issue to 0 seconds.
|
187
|
+
#
|
188
|
+
# @example
|
189
|
+
# Gitlab.reset_time_spent_on_issue(3, 42)
|
190
|
+
#
|
191
|
+
# @param [Integer, String] project The ID or name of a project.
|
192
|
+
# @param [Integer] id The ID of an issue.
|
193
|
+
def reset_time_spent_on_issue(project, id)
|
194
|
+
post("/projects/#{url_encode project}/issues/#{id}/reset_spent_time")
|
195
|
+
end
|
196
|
+
|
197
|
+
# Get time tracking stats for an issue
|
198
|
+
#
|
199
|
+
# @example
|
200
|
+
# @gitlab.time_stats_for_issue(3, 42)
|
201
|
+
#
|
202
|
+
# @param [Integer, String] project The ID or name of a project.
|
203
|
+
# @param [Integer] id The ID of an issue.
|
204
|
+
def time_stats_for_issue(project, id)
|
205
|
+
get("/projects/#{url_encode project}/issues/#{id}/time_stats")
|
207
206
|
end
|
208
207
|
end
|