gitlab 4.3.0 → 4.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/.dockerignore +6 -0
  3. data/.travis.yml +1 -1
  4. data/Dockerfile +8 -0
  5. data/README.md +64 -0
  6. data/docker-compose.yml +19 -0
  7. data/docker.env +2 -0
  8. data/gitlab.gemspec +4 -4
  9. data/lib/gitlab/client.rb +4 -0
  10. data/lib/gitlab/client/access_requests.rb +94 -0
  11. data/lib/gitlab/client/branches.rb +3 -3
  12. data/lib/gitlab/client/commits.rb +18 -0
  13. data/lib/gitlab/client/events.rb +58 -0
  14. data/lib/gitlab/client/group_milestones.rb +93 -0
  15. data/lib/gitlab/client/groups.rb +11 -11
  16. data/lib/gitlab/client/labels.rb +2 -2
  17. data/lib/gitlab/client/merge_requests.rb +129 -1
  18. data/lib/gitlab/client/notes.rb +21 -4
  19. data/lib/gitlab/client/projects.rb +37 -15
  20. data/lib/gitlab/client/runners.rb +11 -0
  21. data/lib/gitlab/client/sidekiq.rb +37 -0
  22. data/lib/gitlab/client/snippets.rb +3 -1
  23. data/lib/gitlab/client/tags.rb +5 -5
  24. data/lib/gitlab/version.rb +1 -1
  25. data/spec/fixtures/access_request.json +8 -0
  26. data/spec/fixtures/access_requests.json +18 -0
  27. data/spec/fixtures/approved_access_request.json +8 -0
  28. data/spec/fixtures/default_approved_access_request.json +8 -0
  29. data/spec/fixtures/group_milestone.json +1 -0
  30. data/spec/fixtures/group_milestone_issues.json +1 -0
  31. data/spec/fixtures/group_milestone_merge_requests.json +1 -0
  32. data/spec/fixtures/group_milestones.json +1 -0
  33. data/spec/fixtures/merge_request_discussion.json +39 -0
  34. data/spec/fixtures/merge_request_discussion_note.json +33 -0
  35. data/spec/fixtures/merge_request_discussions.json +41 -0
  36. data/spec/fixtures/project_commit_merge_requests.json +1 -0
  37. data/spec/fixtures/project_events.json +81 -1
  38. data/spec/fixtures/project_forks.json +50 -0
  39. data/spec/fixtures/runner_jobs.json +63 -0
  40. data/spec/fixtures/sidekiq_compound_metrics.json +36 -0
  41. data/spec/fixtures/sidekiq_job_stats.json +7 -0
  42. data/spec/fixtures/sidekiq_process_metrics.json +25 -0
  43. data/spec/fixtures/sidekiq_queue_metrics.json +8 -0
  44. data/spec/fixtures/user_contribution_events.json +101 -0
  45. data/spec/fixtures/user_events.json +40 -0
  46. data/spec/fixtures/user_projects.json +153 -0
  47. data/spec/gitlab/client/access_requests_spec.rb +141 -0
  48. data/spec/gitlab/client/branches_spec.rb +4 -2
  49. data/spec/gitlab/client/commits_spec.rb +22 -0
  50. data/spec/gitlab/client/events_spec.rb +48 -0
  51. data/spec/gitlab/client/group_milestones_spec.rb +98 -0
  52. data/spec/gitlab/client/merge_requests_spec.rb +127 -0
  53. data/spec/gitlab/client/notes_spec.rb +4 -4
  54. data/spec/gitlab/client/projects_spec.rb +37 -20
  55. data/spec/gitlab/client/runners_spec.rb +10 -0
  56. data/spec/gitlab/client/sidekiq_spec.rb +64 -0
  57. data/spec/gitlab/client/snippets_spec.rb +2 -2
  58. data/spec/gitlab/client/tags_spec.rb +44 -0
  59. data/spec/gitlab/shell_spec.rb +1 -1
  60. metadata +67 -7
@@ -24,7 +24,7 @@ class Gitlab::Client
24
24
  # @param [Integer] id The ID of a group.
25
25
  # @return [Gitlab::ObjectifiedHash]
26
26
  def group(id)
27
- get("/groups/#{id}")
27
+ get("/groups/#{url_encode id}")
28
28
  end
29
29
 
30
30
  # Creates a new group.
@@ -48,7 +48,7 @@ class Gitlab::Client
48
48
  # @param [Integer] id The ID of a group
49
49
  # @return [Gitlab::ObjectifiedHash] Information about the deleted group.
50
50
  def delete_group(id)
51
- delete("/groups/#{id}")
51
+ delete("/groups/#{url_encode id}")
52
52
  end
53
53
 
54
54
  # Get a list of group members.
@@ -63,7 +63,7 @@ class Gitlab::Client
63
63
  # @option options [Integer] :per_page The number of results per page.
64
64
  # @return [Array<Gitlab::ObjectifiedHash>]
65
65
  def group_members(id, options={})
66
- get("/groups/#{id}/members", query: options)
66
+ get("/groups/#{url_encode id}/members", query: options)
67
67
  end
68
68
 
69
69
  # Get details of a single group member.
@@ -75,7 +75,7 @@ class Gitlab::Client
75
75
  # @param [Integer] user_id The user id of the member to find.
76
76
  # @return [Gitlab::ObjectifiedHash] (id, username, name, email, state, access_level ...)
77
77
  def group_member(team_id, user_id)
78
- get("/groups/#{team_id}/members/#{user_id}")
78
+ get("/groups/#{url_encode team_id}/members/#{user_id}")
79
79
  end
80
80
 
81
81
  # Adds a user to group.
@@ -88,7 +88,7 @@ class Gitlab::Client
88
88
  # @param [Integer] access_level Project access level.
89
89
  # @return [Gitlab::ObjectifiedHash] Information about added team member.
90
90
  def add_group_member(team_id, user_id, access_level)
91
- post("/groups/#{team_id}/members", body: { user_id: user_id, access_level: access_level })
91
+ post("/groups/#{url_encode team_id}/members", body: { user_id: user_id, access_level: access_level })
92
92
  end
93
93
 
94
94
  # Edit a user of a group.
@@ -101,7 +101,7 @@ class Gitlab::Client
101
101
  # @param [Integer] access_level Project access level.
102
102
  # @return [Gitlab::ObjectifiedHash] Information about edited team member.
103
103
  def edit_group_member(team_id, user_id, access_level)
104
- put("/groups/#{team_id}/members/#{user_id}", body: { access_level: access_level })
104
+ put("/groups/#{url_encode team_id}/members/#{user_id}", body: { access_level: access_level })
105
105
  end
106
106
 
107
107
  # Removes user from user group.
@@ -113,7 +113,7 @@ class Gitlab::Client
113
113
  # @param [Integer] user_id The ID of a user.
114
114
  # @return [Gitlab::ObjectifiedHash] Information about removed team member.
115
115
  def remove_group_member(team_id, user_id)
116
- delete("/groups/#{team_id}/members/#{user_id}")
116
+ delete("/groups/#{url_encode team_id}/members/#{user_id}")
117
117
  end
118
118
 
119
119
  # Transfers a project to a group
@@ -125,7 +125,7 @@ class Gitlab::Client
125
125
  # @param [Integer] project_id The ID of a project.
126
126
  def transfer_project_to_group(id, project_id)
127
127
  body = { id: id, project_id: project_id }
128
- post("/groups/#{id}/projects/#{project_id}", body: body)
128
+ post("/groups/#{url_encode id}/projects/#{project_id}", body: body)
129
129
  end
130
130
 
131
131
  # Search for groups by name
@@ -150,7 +150,7 @@ class Gitlab::Client
150
150
  # @param [Integer] id The ID of a group
151
151
  # @return [Array<Gitlab::ObjectifiedHash>] List of projects under a group
152
152
  def group_projects(id, options={})
153
- get("/groups/#{id}/projects", query: options)
153
+ get("/groups/#{url_encode id}/projects", query: options)
154
154
  end
155
155
 
156
156
  # Get a list of subgroups under a group
@@ -168,7 +168,7 @@ class Gitlab::Client
168
168
  # @option options [String] :owned Limit to groups owned by the current user.
169
169
  # @return [Array<Gitlab::ObjectifiedHash>] List of subgroups under a group
170
170
  def group_subgroups(id, options={})
171
- get("/groups/#{id}/subgroups", query: options)
171
+ get("/groups/#{url_encode id}/subgroups", query: options)
172
172
  end
173
173
 
174
174
  # Updates an existing group.
@@ -187,7 +187,7 @@ class Gitlab::Client
187
187
  # @option options [String] :request_access_enabled Allow users to request member access.
188
188
  # @return [Gitlab::ObjectifiedHash] Information about the edited group.
189
189
  def edit_group(id, options={})
190
- put("/groups/#{id}", body: options)
190
+ put("/groups/#{url_encode id}", body: options)
191
191
  end
192
192
  end
193
193
  end
@@ -9,8 +9,8 @@ class Gitlab::Client
9
9
  #
10
10
  # @param [Integer, String] project The ID or name of a project.
11
11
  # @return [Array<Gitlab::ObjectifiedHash>]
12
- def labels(project)
13
- get("/projects/#{url_encode project}/labels")
12
+ def labels(project, options={})
13
+ get("/projects/#{url_encode project}/labels", query: options)
14
14
  end
15
15
 
16
16
  # Creates a new label.
@@ -2,11 +2,23 @@ class Gitlab::Client
2
2
  # Defines methods related to merge requests.
3
3
  # @see https://docs.gitlab.com/ce/api/merge_requests.html
4
4
  module MergeRequests
5
+ # Gets a list of all of the merge requests the authenticated user has access to.
6
+ #
7
+ # @example
8
+ # Gitlab.user_merge_requests
9
+ # Gitlab.user_merge_requests(state: :opened, scope: :all)
10
+ #
11
+ # @param [Hash] options A customizable set of options.
12
+ # @return [Array<Gitlab::ObjectifiedHash>]
13
+ def user_merge_requests(options = {})
14
+ get('/merge_requests', query: options)
15
+ end
16
+
5
17
  # Gets a list of project merge requests.
6
18
  #
7
19
  # @example
8
20
  # Gitlab.merge_requests(5)
9
- # Gitlab.merge_requests({ per_page: 40 })
21
+ # Gitlab.merge_requests(5, { per_page: 40 })
10
22
  #
11
23
  # @param [Integer, String] project The ID or name of a project.
12
24
  # @param [Hash] options A customizable set of options.
@@ -143,5 +155,121 @@ class Gitlab::Client
143
155
  def unsubscribe_from_merge_request(project, id)
144
156
  post("/projects/#{url_encode project}/merge_requests/#{id}/unsubscribe")
145
157
  end
158
+
159
+ # List project merge request discussions
160
+ #
161
+ # @example
162
+ # Gitlab.merge_request_discussions(5, 1)
163
+ # Gitlab.merge_request_discussions('gitlab', 1)
164
+ # @param [Integer, String] project The ID or name of a project.
165
+ # @param [Integer] id The ID of a merge request.
166
+ # @return [Gitlab::ObjectifiedHash] List of the merge request discussions.
167
+ def merge_request_discussions(project, merge_request_id)
168
+ get("/projects/#{url_encode project}/merge_requests/#{merge_request_id}/discussions")
169
+ end
170
+
171
+ # Get single merge request discussion
172
+ #
173
+ # @example
174
+ # Gitlab.merge_request_discussion(5, 1, 1)
175
+ # Gitlab.merge_request_discussion('gitlab', 1, 1)
176
+ # @param [Integer, String] project The ID or name of a project.
177
+ # @param [Integer] id The ID of a merge request.
178
+ # @param [Integer] discussion_id The ID of a discussion.
179
+ # @return [Gitlab::ObjectifiedHash] The merge request discussion.
180
+ def merge_request_discussion(project, merge_request_id, discussion_id)
181
+ get("/projects/#{url_encode project}/merge_requests/#{merge_request_id}/discussions/#{discussion_id}")
182
+ end
183
+
184
+ # Create new merge request discussion
185
+ #
186
+ # @example
187
+ # Gitlab.create_merge_request_discussion(5, 1, body: 'discuss')
188
+ # Gitlab.create_merge_request_discussion('gitlab', 1, body: 'discuss')
189
+ # @param [Integer, String] project The ID or name of a project.
190
+ # @param [Integer] id The ID of a merge request.
191
+ # @param [Hash] options A customizable set of options.
192
+ # * :body (String) The content of a discussion
193
+ # * :created_at (String) Date time string, ISO 8601 formatted, e.g. 2016-03-11T03:45:40Z
194
+ # * :position (Hash) Position when creating a diff note
195
+ # * :base_sha (String) Base commit SHA in the source branch
196
+ # * :start_sha (String) SHA referencing commit in target branch
197
+ # * :head_sha (String) SHA referencing HEAD of this merge request
198
+ # * :position_type (String) Type of the position reference', allowed values: 'text' or 'image'
199
+ # * :new_path (String) File path after change
200
+ # * :new_line (Integer) Line number after change (for 'text' diff notes)
201
+ # * :old_path (String) File path before change
202
+ # * :old_line (Integer) Line number before change (for 'text' diff notes)
203
+ # * :width (Integer) Width of the image (for 'image' diff notes)
204
+ # * :height (Integer) Height of the image (for 'image' diff notes)
205
+ # * :x (Integer) X coordinate (for 'image' diff notes)
206
+ # * :y (Integer) Y coordinate (for 'image' diff notes)
207
+ # @return [Gitlab::ObjectifiedHash] The created merge request discussion.
208
+ def create_merge_request_discussion(project, merge_request_id, options={})
209
+ post("/projects/#{url_encode project}/merge_requests/#{merge_request_id}/discussions", body: options)
210
+ end
211
+
212
+ # Resolve a merge request discussion
213
+ #
214
+ # @example
215
+ # Gitlab.resolve_merge_request_discussion(5, 1, 1, true)
216
+ # Gitlab.resolve_merge_request_discussion('gitlab', 1, 1, false)
217
+ # @param [Integer, String] project The ID or name of a project.
218
+ # @param [Integer] id The ID of a merge request.
219
+ # @param [Integer] discussion_id The ID of a discussion.
220
+ # @param [Hash] options A customizable set of options.
221
+ # @option options [Boolean] :resolved Resolve/unresolve the discussion.
222
+ # @return [Gitlab::ObjectifiedHash] The merge request discussion.
223
+ def resolve_merge_request_discussion(project, merge_request_id, discussion_id, options)
224
+ put("/projects/#{url_encode project}/merge_requests/#{merge_request_id}/discussions/#{discussion_id}", body: options)
225
+ end
226
+
227
+ # Add note to existing merge request discussion
228
+ #
229
+ # @example
230
+ # Gitlab.create_merge_request_discussion_note(5, 1, 1, note_id: 1, body: 'note')
231
+ # Gitlab.create_merge_request_discussion_note('gitlab', 1, 1, note_id: 1, body: 'note')
232
+ # @param [Integer, String] project The ID or name of a project.
233
+ # @param [Integer] id The ID of a merge request.
234
+ # @param [Integer] discussion_id The ID of a discussion.
235
+ # @param [Hash] options A customizable set of options.
236
+ # @option options [Integer] :note_id The ID of a discussion note.
237
+ # @option options [String] :body The content of a discussion.
238
+ # @option options [String] :created_at Date time string, ISO 8601 formatted, e.g. 2016-03-11T03:45:40Z.
239
+ # @return [Gitlab::ObjectifiedHash] The merge request discussion note.
240
+ def create_merge_request_discussion_note(project, merge_request_id, discussion_id, options)
241
+ post("/projects/#{url_encode project}/merge_requests/#{merge_request_id}/discussions/#{discussion_id}/notes", body: options)
242
+ end
243
+
244
+ # Modify an existing merge request discussion note
245
+ #
246
+ # @example
247
+ # Gitlab.update_merge_request_discussion_note(5, 1, 1, 1, body: 'note')
248
+ # Gitlab.update_merge_request_discussion_note('gitlab', 1, 1, 1, body: 'note')
249
+ # @param [Integer, String] project The ID or name of a project.
250
+ # @param [Integer] id The ID of a merge request.
251
+ # @param [Integer] discussion_id The ID of a discussion.
252
+ # @param [Integer] note_id The ID of a discussion note.
253
+ # @param [Hash] options A customizable set of options.
254
+ # @option options [String] :body The content of a discussion.
255
+ # @option options [Boolean] :resolved Resolve/unresolve the note.
256
+ # @return [Gitlab::ObjectifiedHash] The merge request discussion note.
257
+ def update_merge_request_discussion_note(project, merge_request_id, discussion_id, note_id, options)
258
+ put("/projects/#{url_encode project}/merge_requests/#{merge_request_id}/discussions/#{discussion_id}/notes/#{note_id}", body: options)
259
+ end
260
+
261
+ # Delete a merge request discussion note
262
+ #
263
+ # @example
264
+ # Gitlab.delete_merge_request_discussion_note(5, 1, 1, 1)
265
+ # Gitlab.delete_merge_request_discussion_note('gitlab', 1, 1, 1)
266
+ # @param [Integer, String] project The ID or name of a project.
267
+ # @param [Integer] id The ID of a merge request.
268
+ # @param [Integer] discussion_id The ID of a discussion.
269
+ # @param [Integer] note_id The ID of a discussion note.
270
+ # @return [Gitlab::ObjectifiedHash] An empty response.
271
+ def delete_merge_request_discussion_note(project, merge_request_id, discussion_id, note_id)
272
+ delete("/projects/#{url_encode project}/merge_requests/#{merge_request_id}/discussions/#{discussion_id}/notes/#{note_id}")
273
+ end
146
274
  end
147
275
  end
@@ -219,9 +219,10 @@ class Gitlab::Client
219
219
  #
220
220
  # @param [Integer] project The ID of a project.
221
221
  # @param [Integer] id The ID of a note.
222
+ # @param [String] body The content of a note.
222
223
  # @return [Gitlab::ObjectifiedHash]
223
224
  def edit_note(project, id, body)
224
- put("/projects/#{url_encode project}/notes/#{id}", body: body)
225
+ put("/projects/#{url_encode project}/notes/#{id}", body: note_content(body))
225
226
  end
226
227
 
227
228
  # Modifies an issue note.
@@ -232,9 +233,10 @@ class Gitlab::Client
232
233
  # @param [Integer] project The ID of a project.
233
234
  # @param [Integer] issue The ID of an issue.
234
235
  # @param [Integer] id The ID of a note.
236
+ # @param [String] body The content of a note.
235
237
  # @return [Gitlab::ObjectifiedHash]
236
238
  def edit_issue_note(project, issue, id, body)
237
- put("/projects/#{url_encode project}/issues/#{issue}/notes/#{id}", body: body)
239
+ put("/projects/#{url_encode project}/issues/#{issue}/notes/#{id}", body: note_content(body))
238
240
  end
239
241
 
240
242
  # Modifies a snippet note.
@@ -245,9 +247,10 @@ class Gitlab::Client
245
247
  # @param [Integer] project The ID of a project.
246
248
  # @param [Integer] snippet The ID of a snippet.
247
249
  # @param [Integer] id The ID of a note.
250
+ # @param [String] body The content of a note.
248
251
  # @return [Gitlab::ObjectifiedHash]
249
252
  def edit_snippet_note(project, snippet, id, body)
250
- put("/projects/#{url_encode project}/snippets/#{snippet}/notes/#{id}", body: body)
253
+ put("/projects/#{url_encode project}/snippets/#{snippet}/notes/#{id}", body: note_content(body))
251
254
  end
252
255
 
253
256
  # Modifies a merge_request note.
@@ -258,10 +261,24 @@ class Gitlab::Client
258
261
  # @param [Integer] project The ID of a project.
259
262
  # @param [Integer] merge_request The ID of a merge_request.
260
263
  # @param [Integer] id The ID of a note.
264
+ # @param [String] body The content of a note.
261
265
  # @return [Gitlab::ObjectifiedHash]
262
266
  def edit_merge_request_note(project, merge_request, id, body)
263
- put("/projects/#{url_encode project}/merge_requests/#{merge_request}/notes/#{id}", body: body)
267
+ put("/projects/#{url_encode project}/merge_requests/#{merge_request}/notes/#{id}", body: note_content(body))
264
268
  end
265
269
  alias_method :edit_merge_request_comment, :edit_merge_request_note
270
+
271
+ private
272
+
273
+ # TODO: Remove this method after a couple deprecation cycles. Replace calls with the code
274
+ # in the 'else'.
275
+ def note_content(body)
276
+ if body.is_a?(Hash)
277
+ STDERR.puts "Passing the note body as a Hash is deprecated. You should just pass the String."
278
+ body
279
+ else
280
+ { body: body }
281
+ end
282
+ end
266
283
  end
267
284
  end
@@ -50,21 +50,6 @@ class Gitlab::Client
50
50
  get("/projects/#{url_encode id}")
51
51
  end
52
52
 
53
- # Gets a list of project events.
54
- #
55
- # @example
56
- # Gitlab.project_events(42)
57
- # Gitlab.project_events('gitlab')
58
- #
59
- # @param [Integer, String] project The ID or path of a project.
60
- # @param [Hash] options A customizable set of options.
61
- # @option options [Integer] :page The page number.
62
- # @option options [Integer] :per_page The number of results per page.
63
- # @return [Array<Gitlab::ObjectifiedHash>]
64
- def project_events(project, options={})
65
- get("/projects/#{url_encode project}/events", query: options)
66
- end
67
-
68
53
  # Creates a new project.
69
54
  #
70
55
  # @example
@@ -415,6 +400,24 @@ class Gitlab::Client
415
400
  post("/projects/#{url_encode id}/fork", body: options)
416
401
  end
417
402
 
403
+ # Get a list of all visible projects across GitLab for the authenticated user.
404
+ # When accessed without authentication, only public projects are returned.
405
+ #
406
+ # Note: This feature was introduced in GitLab 10.1
407
+ #
408
+ # @example
409
+ # Gitlab.project_forks(42)
410
+ #
411
+ # @param [Hash] options A customizable set of options.
412
+ # @option options [Integer] :page The page number.
413
+ # @option options [Integer] :per_page The number of results per page.
414
+ # @option options [String] :order_by Return requests ordered by id, name, created_at or last_activity_at fields
415
+ # @option options [String] :sort Return requests sorted in asc or desc order
416
+ # @return [Array<Gitlab::ObjectifiedHash>]
417
+ def project_forks(id, options={})
418
+ get("/projects/#{url_encode id}/forks", query: options)
419
+ end
420
+
418
421
  # Updates an existing project.
419
422
  #
420
423
  # @example
@@ -471,5 +474,24 @@ class Gitlab::Client
471
474
  def unstar_project(id)
472
475
  delete("/projects/#{url_encode id}/star")
473
476
  end
477
+
478
+ # Get a list of visible projects for the given user.
479
+ # @see https://docs.gitlab.com/ee/api/projects.html#list-user-projects
480
+ #
481
+ # @example
482
+ # Gitlab.user_projects(1)
483
+ # Gitlab.user_projects(1, { order_by: 'last_activity_at' })
484
+ # Gitlab.user_projects('username', { order_by: 'name', sort: 'asc' })
485
+ #
486
+ # @param [Integer, String] user_id The ID or username of the user.
487
+ # @param [Hash] options A customizable set of options.
488
+ # @option options [String] :per_page Number of projects to return per page
489
+ # @option options [String] :page The page to retrieve
490
+ # @option options [String] :order_by Return projects ordered by id, name, path, created_at, updated_at, or last_activity_at fields.
491
+ # @option options [String] :sort Return projects sorted in asc or desc order.
492
+ # @return [Array<Gitlab::ObjectifiedHash>]
493
+ def user_projects(user_id, options={})
494
+ get("/users/#{url_encode user_id}/projects", query: options)
495
+ end
474
496
  end
475
497
  end
@@ -72,6 +72,17 @@ class Gitlab::Client
72
72
  delete("/runners/#{id}")
73
73
  end
74
74
 
75
+ # Gets a list of Jobs for a Runner
76
+ #
77
+ # @example
78
+ # Gitlab.runner_jobs(1)
79
+ #
80
+ # @param [Integer] id The ID of a runner.
81
+ # @return [Array<Gitlab::ObjectifiedHash>]
82
+ def runner_jobs(runner_id)
83
+ get("/runners/#{url_encode runner_id}/jobs")
84
+ end
85
+
75
86
  # List all runners (specific and shared) available in the project. Shared runners are listed if at least one shared runner is defined and shared runners usage is enabled in the project's settings.
76
87
  # @see https://docs.gitlab.com/ce/api/runners.html#list-projects-runners
77
88
  #
@@ -0,0 +1,37 @@
1
+ class Gitlab::Client
2
+ # Defines methods related to sidekiq metrics.
3
+ # @see https://docs.gitlab.com/ce/api/sidekiq_metrics.html
4
+ module Sidekiq
5
+ # Get the current Queue Metrics
6
+ #
7
+ # @example
8
+ # Gitlab.sidekiq_queue_metrics
9
+ def sidekiq_queue_metrics
10
+ get('/sidekiq/queue_metrics')
11
+ end
12
+
13
+ # Get the current Process Metrics
14
+ #
15
+ # @example
16
+ # Gitlab.sidekiq_process_metrics
17
+ def sidekiq_process_metrics
18
+ get('/sidekiq/process_metrics')
19
+ end
20
+
21
+ # Get the current Job Statistics
22
+ #
23
+ # @example
24
+ # Gitlab.sidekiq_job_stats
25
+ def sidekiq_job_stats
26
+ get('/sidekiq/job_stats')
27
+ end
28
+
29
+ # Get a compound response of all the previously mentioned metrics
30
+ #
31
+ # @example
32
+ # Gitlab.sidekiq_compound_metrics
33
+ def sidekiq_compound_metrics
34
+ get('/sidekiq/compound_metrics')
35
+ end
36
+ end
37
+ end
@@ -31,7 +31,7 @@ class Gitlab::Client
31
31
  # Creates a new snippet.
32
32
  #
33
33
  # @example
34
- # Gitlab.create_snippet(42, { title: 'REST', file_name: 'api.rb', code: 'some code' })
34
+ # Gitlab.create_snippet(42, { title: 'REST', file_name: 'api.rb', code: 'some code', visibility: 'public'})
35
35
  #
36
36
  # @param [Integer, String] project The ID or name of a project.
37
37
  # @param [Hash] options A customizable set of options.
@@ -39,6 +39,7 @@ class Gitlab::Client
39
39
  # @option options [String] :file_name (required) The name of a snippet file.
40
40
  # @option options [String] :code (required) The content of a snippet.
41
41
  # @option options [String] :lifetime (optional) The expiration date of a snippet.
42
+ # @option options [String] :visibility (required) The visibility of a snippet
42
43
  # @return [Gitlab::ObjectifiedHash] Information about created snippet.
43
44
  def create_snippet(project, options={})
44
45
  post("/projects/#{url_encode project}/snippets", body: options)
@@ -56,6 +57,7 @@ class Gitlab::Client
56
57
  # @option options [String] :file_name The name of a snippet file.
57
58
  # @option options [String] :code The content of a snippet.
58
59
  # @option options [String] :lifetime The expiration date of a snippet.
60
+ # @option options [String] :visibility (optional) The visibility of a snippet
59
61
  # @return [Gitlab::ObjectifiedHash] Information about updated snippet.
60
62
  def edit_snippet(project, id, options={})
61
63
  put("/projects/#{url_encode project}/snippets/#{id}", body: options)