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
@@ -22,12 +22,12 @@ describe Gitlab::Client do
22
22
 
23
23
  describe ".project_search" do
24
24
  before do
25
- stub_get("/projects/search/Gitlab", "project_search")
25
+ stub_get("/projects?search=Gitlab", "project_search")
26
26
  @project_search = Gitlab.project_search("Gitlab")
27
27
  end
28
28
 
29
29
  it "should get the correct resource" do
30
- expect(a_get("/projects/search/Gitlab")).to have_been_made
30
+ expect(a_get("/projects?search=Gitlab")).to have_been_made
31
31
  end
32
32
 
33
33
  it "should return a paginated response of projects found" do
@@ -315,17 +315,27 @@ describe Gitlab::Client do
315
315
  end
316
316
 
317
317
  describe ".edit_project" do
318
- before do
319
- stub_put("/projects/3", "project_edit").with(query: { name: "Gitlab-edit" })
320
- @edited_project = Gitlab.edit_project(3, name: "Gitlab-edit")
321
- end
318
+ context "using project ID" do
319
+ before do
320
+ stub_put("/projects/3", "project_edit").with(body: { name: "Gitlab-edit" })
321
+ @edited_project = Gitlab.edit_project(3, name: "Gitlab-edit")
322
+ end
322
323
 
323
- it "should get the correct resource" do
324
- expect(a_put("/projects/3").with(query: { name: "Gitlab-edit" })).to have_been_made
324
+ it "should get the correct resource" do
325
+ expect(a_put("/projects/3").with(body: { name: "Gitlab-edit" })).to have_been_made
326
+ end
327
+
328
+ it "should return information about an edited project" do
329
+ expect(@edited_project.name).to eq("Gitlab-edit")
330
+ end
325
331
  end
326
332
 
327
- it "should return information about an edited project" do
328
- expect(@edited_project.name).to eq("Gitlab-edit")
333
+ context "using namespaced project path" do
334
+ it "encodes the path properly" do
335
+ stub = stub_put("/projects/namespace%2Fpath", "project_edit").with(body: { name: "Gitlab-edit" })
336
+ Gitlab.edit_project('namespace/path', name: "Gitlab-edit")
337
+ expect(stub).to have_been_requested
338
+ end
329
339
  end
330
340
  end
331
341
 
@@ -22,7 +22,7 @@ describe Gitlab::Client do
22
22
  @file = Gitlab.get_file(3, 'README.md', 'master')
23
23
  end
24
24
 
25
- it "should create the correct resource" do
25
+ it "should get the correct resource" do
26
26
  expect(a_get("/projects/3/repository/files/README%2Emd?ref=master")).to have_been_made
27
27
  end
28
28
 
@@ -34,11 +34,17 @@ describe Gitlab::Client do
34
34
  end
35
35
 
36
36
  describe ".create_file" do
37
- let!(:request_stub) { stub_post("/projects/3/repository/files", "repository_file") }
38
- let!(:file) { Gitlab.create_file(3, "path", "branch", "content", "commit message") }
37
+ let(:api_path) { "/projects/3/repository/files/path" }
38
+ let!(:request_stub) { stub_post(api_path, "repository_file") }
39
+ let!(:file) { Gitlab.create_file(3, "path", "branch", "content", "commit message", author_name: "joe") }
39
40
 
40
41
  it "should create the correct resource" do
41
- expect(request_stub).to have_been_made
42
+ expected_parameters = {
43
+ author_name: "joe",
44
+ branch: "branch",
45
+ commit_message: "commit message"
46
+ }
47
+ expect(a_post(api_path).with(body: hash_including(expected_parameters))).to have_been_made
42
48
  end
43
49
 
44
50
  it "should return information about the new file" do
@@ -48,11 +54,17 @@ describe Gitlab::Client do
48
54
  end
49
55
 
50
56
  describe ".edit_file" do
51
- let!(:request_stub) { stub_put("/projects/3/repository/files", "repository_file") }
52
- let!(:file) { Gitlab.edit_file(3, "path", "branch", "content", "commit message") }
57
+ let(:api_path) { "/projects/3/repository/files/path" }
58
+ let!(:request_stub) { stub_put(api_path, "repository_file") }
59
+ let!(:file) { Gitlab.edit_file(3, "path", "branch", "content", "commit message", author_name: "joe") }
53
60
 
54
- it "should create the correct resource" do
55
- expect(request_stub).to have_been_made
61
+ it "should update the correct resource" do
62
+ expected_parameters = {
63
+ author_name: "joe",
64
+ branch: "branch",
65
+ commit_message: "commit message"
66
+ }
67
+ expect(a_put(api_path).with(body: hash_including(expected_parameters))).to have_been_made
56
68
  end
57
69
 
58
70
  it "should return information about the new file" do
@@ -62,11 +74,17 @@ describe Gitlab::Client do
62
74
  end
63
75
 
64
76
  describe ".remove_file" do
65
- let!(:request_stub) { stub_delete("/projects/3/repository/files", "repository_file") }
66
- let!(:file) { Gitlab.remove_file(3, "path", "branch", "commit message") }
77
+ let(:api_path) { "/projects/3/repository/files/path" }
78
+ let!(:request_stub) { stub_delete(api_path, "repository_file") }
79
+ let!(:file) { Gitlab.remove_file(3, "path", "branch", "commit message", author_name: "joe") }
67
80
 
68
- it "should create the correct resource" do
69
- expect(request_stub).to have_been_made
81
+ it "should update the correct resource" do
82
+ expected_parameters = {
83
+ author_name: "joe",
84
+ branch: "branch",
85
+ commit_message: "commit message"
86
+ }
87
+ expect(a_delete(api_path).with(body: hash_including(expected_parameters))).to have_been_made
70
88
  end
71
89
 
72
90
  it "should return information about the new file" do
@@ -25,11 +25,11 @@ describe Gitlab::Client do
25
25
  describe ".add_hook" do
26
26
  before do
27
27
  stub_post("/hooks", "system_hook")
28
- @hook = Gitlab.add_hook("http://example.com/hook")
28
+ @hook = Gitlab.add_hook("http://example.com/hook", token: 'secret-token')
29
29
  end
30
30
 
31
31
  it "should get the correct resource" do
32
- expect(a_post("/hooks")).to have_been_made
32
+ expect(a_post("/hooks").with(body: hash_including(token: 'secret-token'))).to have_been_made
33
33
  end
34
34
 
35
35
  it "should return information about a added system hook" do
@@ -0,0 +1,45 @@
1
+ require 'spec_helper'
2
+
3
+ describe Gitlab::Client do
4
+ describe '.todos' do
5
+ before do
6
+ stub_get("/todos", "todos")
7
+ @todos = Gitlab.todos
8
+ end
9
+
10
+ it "should get the correct resources" do
11
+ expect(a_get("/todos")).to have_been_made
12
+ end
13
+
14
+ it "should return a paginated response of user's todos" do
15
+ expect(@todos).to be_a Gitlab::PaginatedResponse
16
+ end
17
+ end
18
+
19
+ describe '.mark_todo_as_done' do
20
+ before do
21
+ stub_post("/todos/102/mark_as_done", "todo")
22
+ @todo = Gitlab.mark_todo_as_done(102)
23
+ end
24
+
25
+ it "should get the correct resource" do
26
+ expect(a_post("/todos/102/mark_as_done")).to have_been_made
27
+ end
28
+
29
+ it "should return information about the todo marked as done" do
30
+ expect(@todo.id).to eq(102)
31
+ expect(@todo.state).to eq('done')
32
+ end
33
+ end
34
+
35
+ describe '.mark_all_todos_as_done' do
36
+ before do
37
+ stub_post("/todos/mark_as_done", "todos")
38
+ @todos = Gitlab.mark_all_todos_as_done
39
+ end
40
+
41
+ it "should get the correct resources" do
42
+ expect(a_post("/todos/mark_as_done")).to have_been_made
43
+ end
44
+ end
45
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitlab
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.0
4
+ version: 4.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nihad Abbasov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-05-26 00:00:00.000000000 Z
11
+ date: 2017-07-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -119,10 +119,13 @@ files:
119
119
  - lib/gitlab/cli.rb
120
120
  - lib/gitlab/cli_helpers.rb
121
121
  - lib/gitlab/client.rb
122
+ - lib/gitlab/client/award_emojis.rb
123
+ - lib/gitlab/client/boards.rb
122
124
  - lib/gitlab/client/branches.rb
123
125
  - lib/gitlab/client/build_variables.rb
124
126
  - lib/gitlab/client/builds.rb
125
127
  - lib/gitlab/client/commits.rb
128
+ - lib/gitlab/client/environments.rb
126
129
  - lib/gitlab/client/groups.rb
127
130
  - lib/gitlab/client/issues.rb
128
131
  - lib/gitlab/client/jobs.rb
@@ -142,6 +145,7 @@ files:
142
145
  - lib/gitlab/client/snippets.rb
143
146
  - lib/gitlab/client/system_hooks.rb
144
147
  - lib/gitlab/client/tags.rb
148
+ - lib/gitlab/client/todos.rb
145
149
  - lib/gitlab/client/users.rb
146
150
  - lib/gitlab/configuration.rb
147
151
  - lib/gitlab/error.rb
@@ -154,6 +158,9 @@ files:
154
158
  - lib/gitlab/shell.rb
155
159
  - lib/gitlab/shell_history.rb
156
160
  - lib/gitlab/version.rb
161
+ - spec/fixtures/board_list.json
162
+ - spec/fixtures/board_lists.json
163
+ - spec/fixtures/boards.json
157
164
  - spec/fixtures/branch.json
158
165
  - spec/fixtures/branch_delete.json
159
166
  - spec/fixtures/branches.json
@@ -166,6 +173,8 @@ files:
166
173
  - spec/fixtures/builds_commits.json
167
174
  - spec/fixtures/compare_merge_request_diff.json
168
175
  - spec/fixtures/empty.json
176
+ - spec/fixtures/environment.json
177
+ - spec/fixtures/environments.json
169
178
  - spec/fixtures/error_already_exists.json
170
179
  - spec/fixtures/error_project_not_found.json
171
180
  - spec/fixtures/get_repository_file.json
@@ -181,6 +190,8 @@ files:
181
190
  - spec/fixtures/group_search.json
182
191
  - spec/fixtures/groups.json
183
192
  - spec/fixtures/issue.json
193
+ - spec/fixtures/issue_award_emoji.json
194
+ - spec/fixtures/issue_award_emojis.json
184
195
  - spec/fixtures/issues.json
185
196
  - spec/fixtures/job.json
186
197
  - spec/fixtures/job_trace.json
@@ -188,8 +199,11 @@ files:
188
199
  - spec/fixtures/key.json
189
200
  - spec/fixtures/keys.json
190
201
  - spec/fixtures/label.json
202
+ - spec/fixtures/label_unsubscribe.json
191
203
  - spec/fixtures/labels.json
192
204
  - spec/fixtures/merge_request.json
205
+ - spec/fixtures/merge_request_award_emoji.json
206
+ - spec/fixtures/merge_request_award_emojis.json
193
207
  - spec/fixtures/merge_request_changes.json
194
208
  - spec/fixtures/merge_request_closes_issues.json
195
209
  - spec/fixtures/merge_request_comment.json
@@ -202,6 +216,8 @@ files:
202
216
  - spec/fixtures/milestones.json
203
217
  - spec/fixtures/namespaces.json
204
218
  - spec/fixtures/note.json
219
+ - spec/fixtures/note_award_emoji.json
220
+ - spec/fixtures/note_award_emojis.json
205
221
  - spec/fixtures/notes.json
206
222
  - spec/fixtures/pipeline.json
207
223
  - spec/fixtures/pipeline_cancel.json
@@ -253,6 +269,8 @@ files:
253
269
  - spec/fixtures/session.json
254
270
  - spec/fixtures/shell_history.json
255
271
  - spec/fixtures/snippet.json
272
+ - spec/fixtures/snippet_award_emoji.json
273
+ - spec/fixtures/snippet_award_emojis.json
256
274
  - spec/fixtures/snippet_content.json
257
275
  - spec/fixtures/snippets.json
258
276
  - spec/fixtures/system_hook.json
@@ -264,6 +282,8 @@ files:
264
282
  - spec/fixtures/tags.json
265
283
  - spec/fixtures/team_member.json
266
284
  - spec/fixtures/team_members.json
285
+ - spec/fixtures/todo.json
286
+ - spec/fixtures/todos.json
267
287
  - spec/fixtures/tree.json
268
288
  - spec/fixtures/trigger.json
269
289
  - spec/fixtures/triggers.json
@@ -277,11 +297,14 @@ files:
277
297
  - spec/fixtures/variables.json
278
298
  - spec/gitlab/cli_helpers_spec.rb
279
299
  - spec/gitlab/cli_spec.rb
300
+ - spec/gitlab/client/award_emojis_spec.rb
301
+ - spec/gitlab/client/boards_spec.rb
280
302
  - spec/gitlab/client/branches_spec.rb
281
303
  - spec/gitlab/client/build_variables_spec.rb
282
304
  - spec/gitlab/client/builds_spec.rb
283
305
  - spec/gitlab/client/client_spec.rb
284
306
  - spec/gitlab/client/commits_spec.rb
307
+ - spec/gitlab/client/environments_spec.rb
285
308
  - spec/gitlab/client/groups_spec.rb
286
309
  - spec/gitlab/client/issues_spec.rb
287
310
  - spec/gitlab/client/jobs_spec.rb
@@ -301,6 +324,7 @@ files:
301
324
  - spec/gitlab/client/snippets_spec.rb
302
325
  - spec/gitlab/client/system_hooks_spec.rb
303
326
  - spec/gitlab/client/tags_spec.rb
327
+ - spec/gitlab/client/todos_spec.rb
304
328
  - spec/gitlab/client/users_spec.rb
305
329
  - spec/gitlab/error_spec.rb
306
330
  - spec/gitlab/file_response_spec.rb
@@ -338,6 +362,9 @@ signing_key:
338
362
  specification_version: 4
339
363
  summary: A Ruby wrapper and CLI for the GitLab API
340
364
  test_files:
365
+ - spec/fixtures/board_list.json
366
+ - spec/fixtures/board_lists.json
367
+ - spec/fixtures/boards.json
341
368
  - spec/fixtures/branch.json
342
369
  - spec/fixtures/branch_delete.json
343
370
  - spec/fixtures/branches.json
@@ -350,6 +377,8 @@ test_files:
350
377
  - spec/fixtures/builds_commits.json
351
378
  - spec/fixtures/compare_merge_request_diff.json
352
379
  - spec/fixtures/empty.json
380
+ - spec/fixtures/environment.json
381
+ - spec/fixtures/environments.json
353
382
  - spec/fixtures/error_already_exists.json
354
383
  - spec/fixtures/error_project_not_found.json
355
384
  - spec/fixtures/get_repository_file.json
@@ -365,6 +394,8 @@ test_files:
365
394
  - spec/fixtures/group_search.json
366
395
  - spec/fixtures/groups.json
367
396
  - spec/fixtures/issue.json
397
+ - spec/fixtures/issue_award_emoji.json
398
+ - spec/fixtures/issue_award_emojis.json
368
399
  - spec/fixtures/issues.json
369
400
  - spec/fixtures/job.json
370
401
  - spec/fixtures/job_trace.json
@@ -372,8 +403,11 @@ test_files:
372
403
  - spec/fixtures/key.json
373
404
  - spec/fixtures/keys.json
374
405
  - spec/fixtures/label.json
406
+ - spec/fixtures/label_unsubscribe.json
375
407
  - spec/fixtures/labels.json
376
408
  - spec/fixtures/merge_request.json
409
+ - spec/fixtures/merge_request_award_emoji.json
410
+ - spec/fixtures/merge_request_award_emojis.json
377
411
  - spec/fixtures/merge_request_changes.json
378
412
  - spec/fixtures/merge_request_closes_issues.json
379
413
  - spec/fixtures/merge_request_comment.json
@@ -386,6 +420,8 @@ test_files:
386
420
  - spec/fixtures/milestones.json
387
421
  - spec/fixtures/namespaces.json
388
422
  - spec/fixtures/note.json
423
+ - spec/fixtures/note_award_emoji.json
424
+ - spec/fixtures/note_award_emojis.json
389
425
  - spec/fixtures/notes.json
390
426
  - spec/fixtures/pipeline.json
391
427
  - spec/fixtures/pipeline_cancel.json
@@ -437,6 +473,8 @@ test_files:
437
473
  - spec/fixtures/session.json
438
474
  - spec/fixtures/shell_history.json
439
475
  - spec/fixtures/snippet.json
476
+ - spec/fixtures/snippet_award_emoji.json
477
+ - spec/fixtures/snippet_award_emojis.json
440
478
  - spec/fixtures/snippet_content.json
441
479
  - spec/fixtures/snippets.json
442
480
  - spec/fixtures/system_hook.json
@@ -448,6 +486,8 @@ test_files:
448
486
  - spec/fixtures/tags.json
449
487
  - spec/fixtures/team_member.json
450
488
  - spec/fixtures/team_members.json
489
+ - spec/fixtures/todo.json
490
+ - spec/fixtures/todos.json
451
491
  - spec/fixtures/tree.json
452
492
  - spec/fixtures/trigger.json
453
493
  - spec/fixtures/triggers.json
@@ -461,11 +501,14 @@ test_files:
461
501
  - spec/fixtures/variables.json
462
502
  - spec/gitlab/cli_helpers_spec.rb
463
503
  - spec/gitlab/cli_spec.rb
504
+ - spec/gitlab/client/award_emojis_spec.rb
505
+ - spec/gitlab/client/boards_spec.rb
464
506
  - spec/gitlab/client/branches_spec.rb
465
507
  - spec/gitlab/client/build_variables_spec.rb
466
508
  - spec/gitlab/client/builds_spec.rb
467
509
  - spec/gitlab/client/client_spec.rb
468
510
  - spec/gitlab/client/commits_spec.rb
511
+ - spec/gitlab/client/environments_spec.rb
469
512
  - spec/gitlab/client/groups_spec.rb
470
513
  - spec/gitlab/client/issues_spec.rb
471
514
  - spec/gitlab/client/jobs_spec.rb
@@ -485,6 +528,7 @@ test_files:
485
528
  - spec/gitlab/client/snippets_spec.rb
486
529
  - spec/gitlab/client/system_hooks_spec.rb
487
530
  - spec/gitlab/client/tags_spec.rb
531
+ - spec/gitlab/client/todos_spec.rb
488
532
  - spec/gitlab/client/users_spec.rb
489
533
  - spec/gitlab/error_spec.rb
490
534
  - spec/gitlab/file_response_spec.rb