gitlab 4.1.0 → 4.2.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.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +17 -0
  3. data/lib/gitlab/client.rb +4 -0
  4. data/lib/gitlab/client/award_emojis.rb +135 -0
  5. data/lib/gitlab/client/boards.rb +88 -0
  6. data/lib/gitlab/client/branches.rb +12 -7
  7. data/lib/gitlab/client/commits.rb +6 -6
  8. data/lib/gitlab/client/environments.rb +87 -0
  9. data/lib/gitlab/client/labels.rb +33 -4
  10. data/lib/gitlab/client/merge_requests.rb +0 -59
  11. data/lib/gitlab/client/notes.rb +106 -0
  12. data/lib/gitlab/client/projects.rb +48 -44
  13. data/lib/gitlab/client/repository_files.rb +32 -26
  14. data/lib/gitlab/client/system_hooks.rb +5 -2
  15. data/lib/gitlab/client/todos.rb +44 -0
  16. data/lib/gitlab/version.rb +1 -1
  17. data/spec/fixtures/board_list.json +1 -0
  18. data/spec/fixtures/board_lists.json +1 -0
  19. data/spec/fixtures/boards.json +1 -0
  20. data/spec/fixtures/environment.json +6 -0
  21. data/spec/fixtures/environments.json +14 -0
  22. data/spec/fixtures/issue_award_emoji.json +16 -0
  23. data/spec/fixtures/issue_award_emojis.json +34 -0
  24. data/spec/fixtures/label.json +1 -1
  25. data/spec/fixtures/label_unsubscribe.json +1 -0
  26. data/spec/fixtures/merge_request_award_emoji.json +16 -0
  27. data/spec/fixtures/merge_request_award_emojis.json +34 -0
  28. data/spec/fixtures/note_award_emoji.json +16 -0
  29. data/spec/fixtures/note_award_emojis.json +18 -0
  30. data/spec/fixtures/snippet_award_emoji.json +16 -0
  31. data/spec/fixtures/snippet_award_emojis.json +34 -0
  32. data/spec/fixtures/todo.json +73 -0
  33. data/spec/fixtures/todos.json +148 -0
  34. data/spec/gitlab/client/award_emojis_spec.rb +391 -0
  35. data/spec/gitlab/client/boards_spec.rb +94 -0
  36. data/spec/gitlab/client/branches_spec.rb +22 -5
  37. data/spec/gitlab/client/commits_spec.rb +2 -2
  38. data/spec/gitlab/client/environments_spec.rb +132 -0
  39. data/spec/gitlab/client/groups_spec.rb +10 -12
  40. data/spec/gitlab/client/labels_spec.rb +32 -0
  41. data/spec/gitlab/client/notes_spec.rb +128 -0
  42. data/spec/gitlab/client/projects_spec.rb +20 -10
  43. data/spec/gitlab/client/repository_files_spec.rb +30 -12
  44. data/spec/gitlab/client/system_hooks_spec.rb +2 -2
  45. data/spec/gitlab/client/todos_spec.rb +45 -0
  46. metadata +46 -2
@@ -19,11 +19,14 @@ class Gitlab::Client
19
19
  # Gitlab.create_label(42, "Backlog", '#DD10AA')
20
20
  #
21
21
  # @param [Integer, String] project The ID or name of a project.
22
- # @option [String] name The name of a label.
23
- # @option [String] color The color of a label.
22
+ # @param [String] name The name of a label.
23
+ # @param [String] color The color of a label.
24
+ # @param [Hash] options A customizable set of options.
25
+ # @option options [String] :description The description of the label.
26
+ # @option options [String] :priority The priority of the label. Must be greater or equal than zero or null to remove the priority.
24
27
  # @return [Gitlab::ObjectifiedHash] Information about created label.
25
- def create_label(project, name, color)
26
- post("/projects/#{url_encode project}/labels", body: { name: name, color: color })
28
+ def create_label(project, name, color, options = {})
29
+ post("/projects/#{url_encode project}/labels", body: options.merge(name: name, color: color))
27
30
  end
28
31
 
29
32
  # Updates a label.
@@ -37,6 +40,8 @@ class Gitlab::Client
37
40
  # @param [Hash] options A customizable set of options.
38
41
  # @option options [String] :new_name The new name of a label.
39
42
  # @option options [String] :color The color of a label.
43
+ # @option options [String] :description The description of the label.
44
+ # @option options [String] :priority The priority of the label. Must be greater or equal than zero or null to remove the priority.
40
45
  # @return [Gitlab::ObjectifiedHash] Information about updated label.
41
46
  def edit_label(project, name, options={})
42
47
  put("/projects/#{url_encode project}/labels", body: options.merge(name: name))
@@ -53,5 +58,29 @@ class Gitlab::Client
53
58
  def delete_label(project, name)
54
59
  delete("/projects/#{url_encode project}/labels", body: { name: name })
55
60
  end
61
+
62
+ # Subscribes the user to a label to receive notifications
63
+ #
64
+ # @example
65
+ # Gitlab.subscribe_to_label(2, 'Backlog')
66
+ #
67
+ # @param [Integer, String] project The ID or name of a project.
68
+ # @param [String] name The name of a label.
69
+ # @return [Gitlab::ObjectifiedHash] Information about the label subscribed to.
70
+ def subscribe_to_label(project, name)
71
+ post("/projects/#{url_encode project}/labels/#{url_encode name}/subscribe")
72
+ end
73
+
74
+ # Unsubscribes the user from a label to not receive notifications from it
75
+ #
76
+ # @example
77
+ # Gitlab.unsubscribe_from_label(2, 'Backlog')
78
+ #
79
+ # @param [Integer, String] project The ID or name of a project.
80
+ # @param [String] name The name of a label.
81
+ # @return [Gitlab::ObjectifiedHash] Information about the label unsubscribed from.
82
+ def unsubscribe_from_label(project, name)
83
+ post("/projects/#{url_encode project}/labels/#{url_encode name}/unsubscribe")
84
+ end
56
85
  end
57
86
  end
@@ -82,65 +82,6 @@ class Gitlab::Client
82
82
  put("/projects/#{url_encode project}/merge_requests/#{id}/merge", body: options)
83
83
  end
84
84
 
85
- # Adds a comment to a merge request.
86
- #
87
- # @example
88
- # Gitlab.create_merge_request_comment(5, 1, "Awesome merge!")
89
- # Gitlab.create_merge_request_comment('gitlab', 1, "Awesome merge!")
90
- #
91
- # @param [Integer, String] project The ID or name of a project.
92
- # @param [Integer] id The ID of a merge request.
93
- # @param [String] note The content of a comment.
94
- # @return [Gitlab::ObjectifiedHash] Information about created merge request comment.
95
- def create_merge_request_comment(project, id, note)
96
- post("/projects/#{url_encode project}/merge_requests/#{id}/notes", body: { body: note })
97
- end
98
-
99
- # Adds a comment to a merge request.
100
- #
101
- # @example
102
- # Gitlab.edit_merge_request_comment(5, 1,2, "Awesome merge!")
103
- # Gitlab.edit_merge_request_comment('gitlab', 1, 2, "Awesome merge!")
104
- #
105
- # @param [Integer, String] project The ID or name of a project.
106
- # @param [Integer] id The ID of a merge request.
107
- # @param [Integer] id The ID of the merge-request comment
108
- # @param [String] note The content of a comment.
109
- # @return [Gitlab::ObjectifiedHash] Information about created merge request comment.
110
- def edit_merge_request_comment(project, id, note_id , note)
111
- put("/projects/#{url_encode project}/merge_requests/#{id}/notes/#{note_id}", body: { body: note })
112
- end
113
-
114
- # Deletes a comment from a merge request.
115
- #
116
- # @example
117
- # Gitlab.delete_merge_request_comment(5, 1,2)
118
- # Gitlab.delete_merge_request_comment('gitlab', 1, 2)
119
- #
120
- # @param [Integer, String] project The ID or name of a project.
121
- # @param [Integer] id The ID of a merge request.
122
- # @param [Integer] id The ID of the merge-request comment
123
- # @return [Gitlab::ObjectifiedHash] Information about created merge request comment.
124
- def delete_merge_request_comment(project, id, note_id)
125
- delete("/projects/#{url_encode project}/merge_requests/#{id}/notes/#{note_id}")
126
- end
127
-
128
- # Gets the comments on a merge request.
129
- #
130
- # @example
131
- # Gitlab.merge_request_comments(5, 1)
132
- # Gitlab.merge_request_comments(5, 1, { per_page: 10, page: 2 })
133
- #
134
- # @param [Integer, String] project The ID or name of a project.
135
- # @param [Integer] id The ID of a merge request.
136
- # @param [Hash] options A customizable set of options.
137
- # @option options [Integer] :page The page number.
138
- # @option options [Integer] :per_page The number of results per page.
139
- # @return [Gitlab::ObjectifiedHash] The merge request's comments.
140
- def merge_request_comments(project, id, options={})
141
- get("/projects/#{url_encode project}/merge_requests/#{id}/notes", query: options)
142
- end
143
-
144
85
  # Gets the changes of a merge request.
145
86
  #
146
87
  # @example
@@ -56,6 +56,7 @@ class Gitlab::Client
56
56
  def merge_request_notes(project, merge_request, options={})
57
57
  get("/projects/#{url_encode project}/merge_requests/#{merge_request}/notes", query: options)
58
58
  end
59
+ alias_method :merge_request_comments, :merge_request_notes
59
60
 
60
61
  # Gets a single wall note.
61
62
  #
@@ -157,5 +158,110 @@ class Gitlab::Client
157
158
  def create_merge_request_note(project, merge_request, body)
158
159
  post("/projects/#{url_encode project}/merge_requests/#{merge_request}/notes", body: { body: body })
159
160
  end
161
+ alias_method :create_merge_request_comment, :create_merge_request_note
162
+
163
+ # Deletes a wall note.
164
+ #
165
+ # @example
166
+ # Gitlab.delete_note(5, 15)
167
+ #
168
+ # @param [Integer] project The ID of a project.
169
+ # @param [Integer] id The ID of a note.
170
+ # @return [Gitlab::ObjectifiedHash]
171
+ def delete_note(project, id)
172
+ delete("/projects/#{url_encode project}/notes/#{id}")
173
+ end
174
+
175
+ # Deletes an issue note.
176
+ #
177
+ # @example
178
+ # Gitlab.delete_issue_note(5, 10, 1)
179
+ #
180
+ # @param [Integer] project The ID of a project.
181
+ # @param [Integer] issue The ID of an issue.
182
+ # @param [Integer] id The ID of a note.
183
+ # @return [Gitlab::ObjectifiedHash]
184
+ def delete_issue_note(project, issue, id)
185
+ delete("/projects/#{url_encode project}/issues/#{issue}/notes/#{id}")
186
+ end
187
+
188
+ # Deletes a snippet note.
189
+ #
190
+ # @example
191
+ # Gitlab.delete_snippet_note(5, 11, 3)
192
+ #
193
+ # @param [Integer] project The ID of a project.
194
+ # @param [Integer] snippet The ID of a snippet.
195
+ # @param [Integer] id The ID of a note.
196
+ # @return [Gitlab::ObjectifiedHash]
197
+ def delete_snippet_note(project, snippet, id)
198
+ delete("/projects/#{url_encode project}/snippets/#{snippet}/notes/#{id}")
199
+ end
200
+
201
+ # Deletes a merge_request note.
202
+ #
203
+ # @example
204
+ # Gitlab.delete_merge_request_note(5, 11, 3)
205
+ #
206
+ # @param [Integer] project The ID of a project.
207
+ # @param [Integer] merge_request The ID of a merge_request.
208
+ # @param [Integer] id The ID of a note.
209
+ # @return [Gitlab::ObjectifiedHash]
210
+ def delete_merge_request_note(project, merge_request, id)
211
+ delete("/projects/#{url_encode project}/merge_requests/#{merge_request}/notes/#{id}")
212
+ end
213
+ alias_method :delete_merge_request_comment, :delete_merge_request_note
214
+
215
+ # Modifies a wall note.
216
+ #
217
+ # @example
218
+ # Gitlab.edit_note(5, 15, 'This is an edited note')
219
+ #
220
+ # @param [Integer] project The ID of a project.
221
+ # @param [Integer] id The ID of a note.
222
+ # @return [Gitlab::ObjectifiedHash]
223
+ def edit_note(project, id, body)
224
+ put("/projects/#{url_encode project}/notes/#{id}", body: body)
225
+ end
226
+
227
+ # Modifies an issue note.
228
+ #
229
+ # @example
230
+ # Gitlab.edit_issue_note(5, 10, 1, 'This is an edited issue note')
231
+ #
232
+ # @param [Integer] project The ID of a project.
233
+ # @param [Integer] issue The ID of an issue.
234
+ # @param [Integer] id The ID of a note.
235
+ # @return [Gitlab::ObjectifiedHash]
236
+ def edit_issue_note(project, issue, id, body)
237
+ put("/projects/#{url_encode project}/issues/#{issue}/notes/#{id}", body: body)
238
+ end
239
+
240
+ # Modifies a snippet note.
241
+ #
242
+ # @example
243
+ # Gitlab.edit_snippet_note(5, 11, 3, 'This is an edited snippet note')
244
+ #
245
+ # @param [Integer] project The ID of a project.
246
+ # @param [Integer] snippet The ID of a snippet.
247
+ # @param [Integer] id The ID of a note.
248
+ # @return [Gitlab::ObjectifiedHash]
249
+ def edit_snippet_note(project, snippet, id, body)
250
+ put("/projects/#{url_encode project}/snippets/#{snippet}/notes/#{id}", body: body)
251
+ end
252
+
253
+ # Modifies a merge_request note.
254
+ #
255
+ # @example
256
+ # Gitlab.edit_merge_request_note(5, 11, 3, 'This is an edited merge request note')
257
+ #
258
+ # @param [Integer] project The ID of a project.
259
+ # @param [Integer] merge_request The ID of a merge_request.
260
+ # @param [Integer] id The ID of a note.
261
+ # @return [Gitlab::ObjectifiedHash]
262
+ def edit_merge_request_note(project, merge_request, id, body)
263
+ put("/projects/#{url_encode project}/merge_requests/#{merge_request}/notes/#{id}", body: body)
264
+ end
265
+ alias_method :edit_merge_request_comment, :edit_merge_request_note
160
266
  end
161
267
  end
@@ -34,7 +34,7 @@ class Gitlab::Client
34
34
  # @option options [String] :sort Return requests sorted in asc or desc order
35
35
  # @return [Array<Gitlab::ObjectifiedHash>]
36
36
  def project_search(query, options={})
37
- get("/projects/search/#{query}", query: options)
37
+ get("/projects", query: options.merge(search:query))
38
38
  end
39
39
  alias_method :search_projects, :project_search
40
40
 
@@ -44,7 +44,7 @@ class Gitlab::Client
44
44
  # Gitlab.project(3)
45
45
  # Gitlab.project('gitlab')
46
46
  #
47
- # @param [Integer, String] id The ID or name of a project.
47
+ # @param [Integer, String] id The ID or path of a project.
48
48
  # @return [Gitlab::ObjectifiedHash]
49
49
  def project(id)
50
50
  get("/projects/#{url_encode id}")
@@ -56,7 +56,7 @@ class Gitlab::Client
56
56
  # Gitlab.project_events(42)
57
57
  # Gitlab.project_events('gitlab')
58
58
  #
59
- # @param [Integer, String] project The ID or name of a project.
59
+ # @param [Integer, String] project The ID or path of a project.
60
60
  # @param [Hash] options A customizable set of options.
61
61
  # @option options [Integer] :page The page number.
62
62
  # @option options [Integer] :per_page The number of results per page.
@@ -76,6 +76,7 @@ class Gitlab::Client
76
76
  # @param [Hash] options A customizable set of options.
77
77
  # @option options [String] :description The description of a project.
78
78
  # @option options [String] :default_branch The default branch of a project.
79
+ # @option options [String] :path Repository name for new project. (Default is lowercase name with dashes)
79
80
  # @option options [String] :namespace_id The namespace in which to create a project.
80
81
  # @option options [Boolean] :wiki_enabled The wiki integration for a project (0 = false, 1 = true).
81
82
  # @option options [Boolean] :wall_enabled The wall functionality for a project (0 = false, 1 = true).
@@ -95,10 +96,10 @@ class Gitlab::Client
95
96
  # @example
96
97
  # Gitlab.delete_project(4)
97
98
  #
98
- # @param [Integer, String] id The ID or name of a project.
99
+ # @param [Integer, String] id The ID or path of a project.
99
100
  # @return [Gitlab::ObjectifiedHash] Information about deleted project.
100
101
  def delete_project(id)
101
- delete("/projects/#{id}")
102
+ delete("/projects/#{url_encode id}")
102
103
  end
103
104
 
104
105
  # Gets a list of project team members.
@@ -107,7 +108,7 @@ class Gitlab::Client
107
108
  # Gitlab.team_members(42)
108
109
  # Gitlab.team_members('gitlab')
109
110
  #
110
- # @param [Integer, String] project The ID or name of a project.
111
+ # @param [Integer, String] project The ID or path of a project.
111
112
  # @param [Hash] options A customizable set of options.
112
113
  # @option options [String] :query The search query.
113
114
  # @option options [Integer] :page The page number.
@@ -122,7 +123,7 @@ class Gitlab::Client
122
123
  # @example
123
124
  # Gitlab.team_member('gitlab', 2)
124
125
  #
125
- # @param [Integer, String] project The ID or name of a project.
126
+ # @param [Integer, String] project The ID or path of a project.
126
127
  # @param [Integer] id The ID of a project team member.
127
128
  # @return [Gitlab::ObjectifiedHash]
128
129
  def team_member(project, id)
@@ -134,7 +135,7 @@ class Gitlab::Client
134
135
  # @example
135
136
  # Gitlab.add_team_member('gitlab', 2, 40)
136
137
  #
137
- # @param [Integer, String] project The ID or name of a project.
138
+ # @param [Integer, String] project The ID or path of a project.
138
139
  # @param [Integer] id The ID of a user.
139
140
  # @param [Integer] access_level The access level to project.
140
141
  # @param [Hash] options A customizable set of options.
@@ -148,7 +149,7 @@ class Gitlab::Client
148
149
  # @example
149
150
  # Gitlab.edit_team_member('gitlab', 3, 20)
150
151
  #
151
- # @param [Integer, String] project The ID or name of a project.
152
+ # @param [Integer, String] project The ID or path of a project.
152
153
  # @param [Integer] id The ID of a user.
153
154
  # @param [Integer] access_level The access level to project.
154
155
  # @param [Hash] options A customizable set of options.
@@ -162,7 +163,7 @@ class Gitlab::Client
162
163
  # @example
163
164
  # Gitlab.remove_team_member('gitlab', 2)
164
165
  #
165
- # @param [Integer, String] project The ID or name of a project.
166
+ # @param [Integer, String] project The ID or path of a project.
166
167
  # @param [Integer] id The ID of a user.
167
168
  # @param [Hash] options A customizable set of options.
168
169
  # @return [Gitlab::ObjectifiedHash] Information about removed team member.
@@ -176,7 +177,7 @@ class Gitlab::Client
176
177
  # Gitlab.project_hooks(42)
177
178
  # Gitlab.project_hooks('gitlab')
178
179
  #
179
- # @param [Integer, String] project The ID or name of a project.
180
+ # @param [Integer, String] project The ID or path of a project.
180
181
  # @param [Hash] options A customizable set of options.
181
182
  # @option options [Integer] :page The page number.
182
183
  # @option options [Integer] :per_page The number of results per page.
@@ -191,7 +192,7 @@ class Gitlab::Client
191
192
  # Gitlab.project_hook(42, 5)
192
193
  # Gitlab.project_hook('gitlab', 5)
193
194
  #
194
- # @param [Integer, String] project The ID or name of a project.
195
+ # @param [Integer, String] project The ID or path of a project.
195
196
  # @param [Integer] id The ID of a hook.
196
197
  # @return [Gitlab::ObjectifiedHash]
197
198
  def project_hook(project, id)
@@ -203,7 +204,7 @@ class Gitlab::Client
203
204
  # @example
204
205
  # Gitlab.add_project_hook(42, 'https://api.example.net/v1/webhooks/ci')
205
206
  #
206
- # @param [Integer, String] project The ID or name of a project.
207
+ # @param [Integer, String] project The ID or path of a project.
207
208
  # @param [String] url The hook URL.
208
209
  # @param [Hash] options A customizable set of options.
209
210
  # @param option [Boolean] :push_events Trigger hook on push events (0 = false, 1 = true)
@@ -221,7 +222,7 @@ class Gitlab::Client
221
222
  # @example
222
223
  # Gitlab.edit_project_hook(42, 1, 'https://api.example.net/v1/webhooks/ci')
223
224
  #
224
- # @param [Integer, String] project The ID or name of a project.
225
+ # @param [Integer, String] project The ID or path of a project.
225
226
  # @param [Integer] id The ID of the hook.
226
227
  # @param [String] url The hook URL.
227
228
  # @param [Hash] options A customizable set of options.
@@ -240,7 +241,7 @@ class Gitlab::Client
240
241
  # @example
241
242
  # Gitlab.delete_project_hook('gitlab', 4)
242
243
  #
243
- # @param [Integer, String] project The ID or name of a project.
244
+ # @param [Integer, String] project The ID or path of a project.
244
245
  # @param [String] id The ID of the hook.
245
246
  # @return [Gitlab::ObjectifiedHash] Information about deleted hook.
246
247
  def delete_project_hook(project, id)
@@ -256,7 +257,7 @@ class Gitlab::Client
256
257
  # @param [Integer] id The ID of a project.
257
258
  # @return [Gitlab::ObjectifiedHash]
258
259
  def push_rule(id)
259
- get("/projects/#{id}/push_rule")
260
+ get("/projects/#{url_encode id}/push_rule")
260
261
  end
261
262
 
262
263
  # Adds a project push rule.
@@ -271,7 +272,7 @@ class Gitlab::Client
271
272
  # @param option [String] :commit_message_regex Commit message regex
272
273
  # @return [Gitlab::ObjectifiedHash] Information about added push rule.
273
274
  def add_push_rule(id, options={})
274
- post("/projects/#{id}/push_rule", body: options)
275
+ post("/projects/#{url_encode id}/push_rule", body: options)
275
276
  end
276
277
 
277
278
  # Updates a project push rule.
@@ -286,7 +287,7 @@ class Gitlab::Client
286
287
  # @param option [String] :commit_message_regex Commit message regex
287
288
  # @return [Gitlab::ObjectifiedHash] Information about updated push rule.
288
289
  def edit_push_rule(id, options={})
289
- put("/projects/#{id}/push_rule", body: options)
290
+ put("/projects/#{url_encode id}/push_rule", body: options)
290
291
  end
291
292
 
292
293
  # Deletes a push rule from a project.
@@ -298,7 +299,7 @@ class Gitlab::Client
298
299
  # @param [Integer] id The ID of a project.
299
300
  # @return [Gitlab::ObjectifiedHash] Information about deleted push rule.
300
301
  def delete_push_rule(id, options={})
301
- delete("/projects/#{id}/push_rule")
302
+ delete("/projects/#{url_encode id}/push_rule")
302
303
  end
303
304
 
304
305
  # Mark this project as forked from the other
@@ -306,7 +307,7 @@ class Gitlab::Client
306
307
  # @example
307
308
  # Gitlab.make_forked(42, 24)
308
309
  #
309
- # @param [Integer, String] project The ID or name of a project.
310
+ # @param [Integer, String] project The ID or path of a project.
310
311
  # @param [Integer] id The ID of the project it is forked from.
311
312
  # @return [Gitlab::ObjectifiedHash] Information about the forked project.
312
313
  def make_forked_from(project, id)
@@ -318,7 +319,7 @@ class Gitlab::Client
318
319
  # @example
319
320
  # Gitlab.remove_forked(42)
320
321
  #
321
- # @param [Integer, String] project The ID or name of a project.
322
+ # @param [Integer, String] project The ID or path of a project.
322
323
  # @param [Integer] project The ID of the project it is forked from
323
324
  # @return [Gitlab::ObjectifiedHash] Information about the forked project.
324
325
  def remove_forked(project)
@@ -330,7 +331,7 @@ class Gitlab::Client
330
331
  # @example
331
332
  # Gitlab.deploy_keys(42)
332
333
  #
333
- # @param [Integer, String] project The ID or name of a project.
334
+ # @param [Integer, String] project The ID or path of a project.
334
335
  # @param [Hash] options A customizable set of options.
335
336
  # @option options [Integer] :page The page number.
336
337
  # @option options [Integer] :per_page The number of results per page.
@@ -344,7 +345,7 @@ class Gitlab::Client
344
345
  # @example
345
346
  # Gitlab.deploy_key(42, 1)
346
347
  #
347
- # @param [Integer, String] project The ID or name of a project.
348
+ # @param [Integer, String] project The ID or path of a project.
348
349
  # @param [Integer] id The ID of a deploy key.
349
350
  # @return [Gitlab::ObjectifiedHash]
350
351
  def deploy_key(project, id)
@@ -356,7 +357,7 @@ class Gitlab::Client
356
357
  # @example
357
358
  # Gitlab.create_deploy_key(42, 'My Key', 'Key contents')
358
359
  #
359
- # @param [Integer, String] project The ID or name of a project.
360
+ # @param [Integer, String] project The ID or path of a project.
360
361
  # @param [String] title The title of a deploy key.
361
362
  # @param [String] key The content of a deploy key.
362
363
  # @return [Gitlab::ObjectifiedHash] Information about created deploy key.
@@ -369,7 +370,7 @@ class Gitlab::Client
369
370
  # @example
370
371
  # Gitlab.enable_deploy_key(42, 66)
371
372
  #
372
- # @param [Integer, String] project The ID or name of a project.
373
+ # @param [Integer, String] project The ID or path of a project.
373
374
  # @param [Integer] key The ID of a deploy key.
374
375
  # @return [Gitlab::ObjectifiedHash] Information about the enabled deploy key.
375
376
  def enable_deploy_key(project, key)
@@ -381,7 +382,7 @@ class Gitlab::Client
381
382
  # @example
382
383
  # Gitlab.disable_deploy_key(42, 66)
383
384
  #
384
- # @param [Integer, String] project The ID or name of a project.
385
+ # @param [Integer, String] project The ID or path of a project.
385
386
  # @param [Integer] key The ID of a deploy key.
386
387
  # @return [Gitlab::ObjectifiedHash] Information about the disabled deploy key.
387
388
  def disable_deploy_key(project, key)
@@ -393,7 +394,7 @@ class Gitlab::Client
393
394
  # @example
394
395
  # Gitlab.delete_deploy_key(42, 1)
395
396
  #
396
- # @param [Integer, String] project The ID or name of a project.
397
+ # @param [Integer, String] project The ID or path of a project.
397
398
  # @param [Integer] id The ID of a deploy key.
398
399
  # @return [Gitlab::ObjectifiedHash] Information about deleted deploy key.
399
400
  def delete_deploy_key(project, id)
@@ -406,28 +407,31 @@ class Gitlab::Client
406
407
  # Gitlab.create_fork(42)
407
408
  # Gitlab.create_fork(42, { sudo: 'another_username' })
408
409
  #
409
- # @param [Integer, String] project The ID or name of a project.
410
+ # @param [Integer, String] project The ID or path of a project.
410
411
  # @param [Hash] options A customizable set of options.
411
412
  # @option options [String] :sudo The username the project will be forked for
412
413
  # @return [Gitlab::ObjectifiedHash] Information about the forked project.
413
414
  def create_fork(id, options={})
414
- post("/projects/#{id}/fork", body: options)
415
+ post("/projects/#{url_encode id}/fork", body: options)
415
416
  end
416
417
 
417
418
  # Updates an existing project.
418
419
  #
419
420
  # @example
420
421
  # Gitlab.edit_project(42)
421
- # Gitlab.edit_project(42, { name: 'project_name' })
422
+ # Gitlab.edit_project(42, { name: 'Project Name' })
423
+ # Gitlab.edit_project('project-name', { name: 'New Project Name', path: 'new-project-patth' })
422
424
  #
423
- # @param [Integer, String] project The ID or name of a project.
424
- # @param [Hash] options A customizable set of options.
425
+ # @param [Integer, String] project The ID or path of a project.
426
+ # @param [Hash] options A customizable set of options
425
427
  # @option options [String] :name The name of a project
426
- # @option options [String] :path The name of a project
427
- # @option options [String] :description The name of a project
428
+ # @option options [String] :path The project's repository name, also used in Gitlab's URLs
429
+ # @option options [String] :description The description to show in Gitlab
430
+ # (Any provided options will be passed to Gitlab. See {https://docs.gitlab.com/ce/api/projects.html#edit-project Gitlab docs} for all valid options)
431
+ #
428
432
  # @return [Gitlab::ObjectifiedHash] Information about the edited project.
429
433
  def edit_project(id, options={})
430
- put("/projects/#{id}", query: options)
434
+ put("/projects/#{url_encode id}", body: options)
431
435
  end
432
436
 
433
437
  # Share project with group.
@@ -435,7 +439,7 @@ class Gitlab::Client
435
439
  # @example
436
440
  # Gitlab.share_project_with_group('gitlab', 2, 40)
437
441
  #
438
- # @param [Integer, String] project The ID or name of a project.
442
+ # @param [Integer, String] project The ID or path of a project.
439
443
  # @param [Integer] id The ID of a group.
440
444
  # @param [Integer] group_access The access level to project.
441
445
  def share_project_with_group(project, id, group_access)
@@ -444,28 +448,28 @@ class Gitlab::Client
444
448
 
445
449
  # Stars a project.
446
450
  # @see https://docs.gitlab.com/ce/api/projects.html#star-a-project
447
- #
451
+ #
448
452
  # @example
449
453
  # Gitlab.star_project(42)
450
454
  # Gitlab.star_project('gitlab-org/gitlab-ce')
451
- #
452
- # @param [Integer, String] id The ID or name of a project.
455
+ #
456
+ # @param [Integer, String] id The ID or path of a project.
453
457
  # @return [Gitlab::ObjectifiedHash] Information about starred project.
454
458
  def star_project(id)
455
- post("/projects/#{id}/star")
459
+ post("/projects/#{url_encode id}/star")
456
460
  end
457
461
 
458
462
  # Unstars a project.
459
463
  # @see https://docs.gitlab.com/ce/api/projects.html#unstar-a-project
460
- #
464
+ #
461
465
  # @example
462
466
  # Gitlab.unstar_project(42)
463
467
  # Gitlab.unstar_project('gitlab-org/gitlab-ce')
464
- #
465
- # @param [Integer, String] id The ID or name of a project.
468
+ #
469
+ # @param [Integer, String] id The ID or path of a project.
466
470
  # @return [Gitlab::ObjectifiedHash] Information about unstarred project.
467
471
  def unstar_project(id)
468
- delete("/projects/#{id}/star")
472
+ delete("/projects/#{url_encode id}/star")
469
473
  end
470
474
  end
471
475
  end