gitlab 4.6.0 → 4.6.1

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