gitlab 3.7.0 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +2 -0
  3. data/.travis.yml +2 -2
  4. data/CHANGELOG.md +24 -0
  5. data/README.md +7 -6
  6. data/gitlab.gemspec +4 -6
  7. data/lib/gitlab/client.rb +24 -0
  8. data/lib/gitlab/client/branches.rb +13 -13
  9. data/lib/gitlab/client/build_triggers.rb +9 -9
  10. data/lib/gitlab/client/build_variables.rb +11 -11
  11. data/lib/gitlab/client/builds.rb +16 -16
  12. data/lib/gitlab/client/commits.rb +39 -14
  13. data/lib/gitlab/client/groups.rb +1 -1
  14. data/lib/gitlab/client/issues.rb +40 -16
  15. data/lib/gitlab/client/labels.rb +9 -9
  16. data/lib/gitlab/client/merge_requests.rb +61 -24
  17. data/lib/gitlab/client/milestones.rb +25 -11
  18. data/lib/gitlab/client/namespaces.rb +2 -1
  19. data/lib/gitlab/client/notes.rb +16 -16
  20. data/lib/gitlab/client/pipelines.rb +68 -0
  21. data/lib/gitlab/client/projects.rb +111 -49
  22. data/lib/gitlab/client/repositories.rb +27 -23
  23. data/lib/gitlab/client/repository_files.rb +29 -10
  24. data/lib/gitlab/client/runners.rb +15 -15
  25. data/lib/gitlab/client/services.rb +8 -6
  26. data/lib/gitlab/client/snippets.rb +13 -13
  27. data/lib/gitlab/client/system_hooks.rb +1 -1
  28. data/lib/gitlab/client/tags.rb +13 -13
  29. data/lib/gitlab/client/users.rb +12 -5
  30. data/lib/gitlab/file_response.rb +1 -0
  31. data/lib/gitlab/version.rb +1 -1
  32. data/spec/fixtures/merge_request_closes_issues.json +1 -0
  33. data/spec/fixtures/milestone_merge_requests.json +1 -0
  34. data/spec/fixtures/pipeline.json +23 -0
  35. data/spec/fixtures/pipeline_cancel.json +23 -0
  36. data/spec/fixtures/pipeline_create.json +23 -0
  37. data/spec/fixtures/pipeline_retry.json +23 -0
  38. data/spec/fixtures/pipelines.json +48 -0
  39. data/spec/fixtures/project_commit_create.json +22 -0
  40. data/spec/fixtures/project_star.json +44 -0
  41. data/spec/fixtures/project_unstar.json +44 -0
  42. data/spec/fixtures/{git_hook.json → push_rule.json} +0 -0
  43. data/spec/gitlab/cli_spec.rb +9 -0
  44. data/spec/gitlab/client/client_spec.rb +11 -0
  45. data/spec/gitlab/client/commits_spec.rb +31 -0
  46. data/spec/gitlab/client/issues_spec.rb +48 -0
  47. data/spec/gitlab/client/merge_requests_spec.rb +57 -10
  48. data/spec/gitlab/client/milestones_spec.rb +16 -0
  49. data/spec/gitlab/client/pipelines_spec.rb +95 -0
  50. data/spec/gitlab/client/projects_spec.rb +116 -38
  51. data/spec/gitlab/client/repositories_spec.rb +0 -15
  52. data/spec/gitlab/client/repository_files_spec.rb +17 -2
  53. data/spec/gitlab/client/users_spec.rb +31 -13
  54. data/spec/gitlab/file_response_spec.rb +6 -1
  55. metadata +53 -43
@@ -24,21 +24,6 @@ describe Gitlab::Client do
24
24
  end
25
25
  end
26
26
 
27
- describe ".file_contents" do
28
- before do
29
- stub_get("/projects/3/repository/blobs/master?filepath=Gemfile", "raw_file")
30
- @file_contents = Gitlab.file_contents(3, "Gemfile")
31
- end
32
-
33
- it "should get the correct resource" do
34
- expect(a_get("/projects/3/repository/blobs/master?filepath=Gemfile")).to have_been_made
35
- end
36
-
37
- it "should return file contents" do
38
- expect(@file_contents).to eq("source 'https://rubygems.org'\ngem 'rails', '4.1.2'\n")
39
- end
40
- end
41
-
42
27
  describe ".create_tag" do
43
28
  context "when lightweight" do
44
29
  before do
@@ -1,14 +1,29 @@
1
1
  require "spec_helper"
2
2
 
3
3
  describe Gitlab::Client do
4
+ describe ".file_contents" do
5
+ before do
6
+ stub_get("/projects/3/repository/files/Gemfile/raw?ref=master", "raw_file")
7
+ @file_contents = Gitlab.file_contents(3, "Gemfile")
8
+ end
9
+
10
+ it "should get the correct resource" do
11
+ expect(a_get("/projects/3/repository/files/Gemfile/raw?ref=master")).to have_been_made
12
+ end
13
+
14
+ it "should return file contents" do
15
+ expect(@file_contents).to eq("source 'https://rubygems.org'\ngem 'rails', '4.1.2'\n")
16
+ end
17
+ end
18
+
4
19
  describe ".get_file" do
5
20
  before do
6
- stub_get("/projects/3/repository/files?file_path=README.md&ref=master", "get_repository_file")
21
+ stub_get("/projects/3/repository/files/README%2Emd?ref=master", "get_repository_file")
7
22
  @file = Gitlab.get_file(3, 'README.md', 'master')
8
23
  end
9
24
 
10
25
  it "should create the correct resource" do
11
- expect(a_get("/projects/3/repository/files?file_path=README.md&ref=master")).to have_been_made
26
+ expect(a_get("/projects/3/repository/files/README%2Emd?ref=master")).to have_been_made
12
27
  end
13
28
 
14
29
  it "should return the base64 encoded file" do
@@ -132,12 +132,12 @@ describe Gitlab::Client do
132
132
 
133
133
  describe ".block_user" do
134
134
  before do
135
- stub_put("/users/1/block", "user_block_unblock")
135
+ stub_post("/users/1/block", "user_block_unblock")
136
136
  @result = Gitlab.block_user(1)
137
137
  end
138
138
 
139
139
  it "should get the correct resource" do
140
- expect(a_put("/users/1/block")).to have_been_made
140
+ expect(a_post("/users/1/block")).to have_been_made
141
141
  end
142
142
 
143
143
  it "should return boolean" do
@@ -147,12 +147,12 @@ describe Gitlab::Client do
147
147
 
148
148
  describe ".unblock_user" do
149
149
  before do
150
- stub_put("/users/1/unblock", "user_block_unblock")
150
+ stub_post("/users/1/unblock", "user_block_unblock")
151
151
  @result = Gitlab.unblock_user(1)
152
152
  end
153
153
 
154
154
  it "should get the correct resource" do
155
- expect(a_put("/users/1/unblock")).to have_been_made
155
+ expect(a_post("/users/1/unblock")).to have_been_made
156
156
  end
157
157
 
158
158
  it "should return boolean" do
@@ -201,18 +201,36 @@ describe Gitlab::Client do
201
201
  end
202
202
 
203
203
  describe ".ssh_keys" do
204
- before do
205
- stub_get("/user/keys", "keys")
206
- @keys = Gitlab.ssh_keys
207
- end
204
+ context "with user ID passed" do
205
+ before do
206
+ stub_get("/users/1/keys", "keys")
207
+ @keys = Gitlab.ssh_keys({ user_id: 1 })
208
+ end
208
209
 
209
- it "should get the correct resource" do
210
- expect(a_get("/user/keys")).to have_been_made
210
+ it "should get the correct resource" do
211
+ expect(a_get("/users/1/keys")).to have_been_made
212
+ end
213
+
214
+ it "should return a paginated response of SSH keys" do
215
+ expect(@keys).to be_a Gitlab::PaginatedResponse
216
+ expect(@keys.first.title).to eq("narkoz@helium")
217
+ end
211
218
  end
212
219
 
213
- it "should return a paginated response of SSH keys" do
214
- expect(@keys).to be_a Gitlab::PaginatedResponse
215
- expect(@keys.first.title).to eq("narkoz@helium")
220
+ context "without user ID passed" do
221
+ before do
222
+ stub_get("/user/keys", "keys")
223
+ @keys = Gitlab.ssh_keys
224
+ end
225
+
226
+ it "should get the correct resource" do
227
+ expect(a_get("/user/keys")).to have_been_made
228
+ end
229
+
230
+ it "should return a paginated response of SSH keys" do
231
+ expect(@keys).to be_a Gitlab::PaginatedResponse
232
+ expect(@keys.first.title).to eq("narkoz@helium")
233
+ end
216
234
  end
217
235
  end
218
236
 
@@ -21,7 +21,12 @@ describe Gitlab::FileResponse do
21
21
 
22
22
  context '.parse_headers!' do
23
23
  it "should parse headers" do
24
- @file_response.parse_headers!('Content-Disposition' => "attachment; filename=artifacts.zip")
24
+ @file_response.parse_headers!('Content-Disposition' => 'attachment; filename=artifacts.zip')
25
+ expect(@file_response.filename).to eq "artifacts.zip"
26
+ end
27
+
28
+ it "should handle quoted filenames" do
29
+ @file_response.parse_headers!('Content-Disposition' => 'attachment; filename="artifacts.zip"')
25
30
  expect(@file_response.filename).to eq "artifacts.zip"
26
31
  end
27
32
  end
metadata CHANGED
@@ -1,110 +1,97 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitlab
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.7.0
5
- prerelease:
4
+ version: 4.0.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Nihad Abbasov
9
8
  autorequire:
10
9
  bindir: exe
11
10
  cert_chain: []
12
- date: 2016-08-16 00:00:00.000000000 Z
11
+ date: 2017-04-10 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: httparty
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ~>
17
+ - - ">="
20
18
  - !ruby/object:Gem::Version
21
- version: 0.13.0
19
+ version: '0'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ~>
24
+ - - ">="
28
25
  - !ruby/object:Gem::Version
29
- version: 0.13.0
26
+ version: '0'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: terminal-table
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - '='
36
32
  - !ruby/object:Gem::Version
37
- version: '0'
33
+ version: 1.7.1
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - '='
44
39
  - !ruby/object:Gem::Version
45
- version: '0'
40
+ version: 1.7.1
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: pry
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - ">="
52
46
  - !ruby/object:Gem::Version
53
47
  version: '0'
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - ">="
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: rake
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - ">="
68
60
  - !ruby/object:Gem::Version
69
61
  version: '0'
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - ">="
76
67
  - !ruby/object:Gem::Version
77
68
  version: '0'
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: rspec
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
- - - ! '>='
73
+ - - ">="
84
74
  - !ruby/object:Gem::Version
85
75
  version: '0'
86
76
  type: :development
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
- - - ! '>='
80
+ - - ">="
92
81
  - !ruby/object:Gem::Version
93
82
  version: '0'
94
83
  - !ruby/object:Gem::Dependency
95
84
  name: webmock
96
85
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
86
  requirements:
99
- - - ! '>='
87
+ - - ">="
100
88
  - !ruby/object:Gem::Version
101
89
  version: '0'
102
90
  type: :development
103
91
  prerelease: false
104
92
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
93
  requirements:
107
- - - ! '>='
94
+ - - ">="
108
95
  - !ruby/object:Gem::Version
109
96
  version: '0'
110
97
  description: Ruby client and CLI for GitLab API
@@ -115,8 +102,8 @@ executables:
115
102
  extensions: []
116
103
  extra_rdoc_files: []
117
104
  files:
118
- - .gitignore
119
- - .travis.yml
105
+ - ".gitignore"
106
+ - ".travis.yml"
120
107
  - CHANGELOG.md
121
108
  - CONTRIBUTING.md
122
109
  - Gemfile
@@ -144,6 +131,7 @@ files:
144
131
  - lib/gitlab/client/milestones.rb
145
132
  - lib/gitlab/client/namespaces.rb
146
133
  - lib/gitlab/client/notes.rb
134
+ - lib/gitlab/client/pipelines.rb
147
135
  - lib/gitlab/client/projects.rb
148
136
  - lib/gitlab/client/repositories.rb
149
137
  - lib/gitlab/client/repository_files.rb
@@ -178,7 +166,6 @@ files:
178
166
  - spec/fixtures/error_already_exists.json
179
167
  - spec/fixtures/error_project_not_found.json
180
168
  - spec/fixtures/get_repository_file.json
181
- - spec/fixtures/git_hook.json
182
169
  - spec/fixtures/group.json
183
170
  - spec/fixtures/group_create.json
184
171
  - spec/fixtures/group_create_with_description.json
@@ -198,20 +185,28 @@ files:
198
185
  - spec/fixtures/labels.json
199
186
  - spec/fixtures/merge_request.json
200
187
  - spec/fixtures/merge_request_changes.json
188
+ - spec/fixtures/merge_request_closes_issues.json
201
189
  - spec/fixtures/merge_request_comment.json
202
190
  - spec/fixtures/merge_request_comments.json
203
191
  - spec/fixtures/merge_request_commits.json
204
192
  - spec/fixtures/merge_requests.json
205
193
  - spec/fixtures/milestone.json
206
194
  - spec/fixtures/milestone_issues.json
195
+ - spec/fixtures/milestone_merge_requests.json
207
196
  - spec/fixtures/milestones.json
208
197
  - spec/fixtures/namespaces.json
209
198
  - spec/fixtures/note.json
210
199
  - spec/fixtures/notes.json
200
+ - spec/fixtures/pipeline.json
201
+ - spec/fixtures/pipeline_cancel.json
202
+ - spec/fixtures/pipeline_create.json
203
+ - spec/fixtures/pipeline_retry.json
204
+ - spec/fixtures/pipelines.json
211
205
  - spec/fixtures/project.json
212
206
  - spec/fixtures/project_commit.json
213
207
  - spec/fixtures/project_commit_comment.json
214
208
  - spec/fixtures/project_commit_comments.json
209
+ - spec/fixtures/project_commit_create.json
215
210
  - spec/fixtures/project_commit_diff.json
216
211
  - spec/fixtures/project_commit_status.json
217
212
  - spec/fixtures/project_commits.json
@@ -229,11 +224,14 @@ files:
229
224
  - spec/fixtures/project_runner_enable.json
230
225
  - spec/fixtures/project_runners.json
231
226
  - spec/fixtures/project_search.json
227
+ - spec/fixtures/project_star.json
232
228
  - spec/fixtures/project_tag_annotated.json
233
229
  - spec/fixtures/project_tag_lightweight.json
234
230
  - spec/fixtures/project_tags.json
231
+ - spec/fixtures/project_unstar.json
235
232
  - spec/fixtures/project_update_commit_status.json
236
233
  - spec/fixtures/projects.json
234
+ - spec/fixtures/push_rule.json
237
235
  - spec/fixtures/raw_file.json
238
236
  - spec/fixtures/release_create.json
239
237
  - spec/fixtures/release_update.json
@@ -275,6 +273,7 @@ files:
275
273
  - spec/gitlab/client/build_triggers_spec.rb
276
274
  - spec/gitlab/client/build_variables_spec.rb
277
275
  - spec/gitlab/client/builds_spec.rb
276
+ - spec/gitlab/client/client_spec.rb
278
277
  - spec/gitlab/client/commits_spec.rb
279
278
  - spec/gitlab/client/groups_spec.rb
280
279
  - spec/gitlab/client/issues_spec.rb
@@ -283,6 +282,7 @@ files:
283
282
  - spec/gitlab/client/milestones_spec.rb
284
283
  - spec/gitlab/client/namespaces_spec.rb
285
284
  - spec/gitlab/client/notes_spec.rb
285
+ - spec/gitlab/client/pipelines_spec.rb
286
286
  - spec/gitlab/client/projects_spec.rb
287
287
  - spec/gitlab/client/repositories_spec.rb
288
288
  - spec/gitlab/client/repository_files_spec.rb
@@ -306,27 +306,26 @@ files:
306
306
  homepage: https://github.com/narkoz/gitlab
307
307
  licenses:
308
308
  - BSD
309
+ metadata: {}
309
310
  post_install_message:
310
311
  rdoc_options: []
311
312
  require_paths:
312
313
  - lib
313
314
  required_ruby_version: !ruby/object:Gem::Requirement
314
- none: false
315
315
  requirements:
316
- - - ! '>='
316
+ - - ">="
317
317
  - !ruby/object:Gem::Version
318
- version: '0'
318
+ version: 2.0.0
319
319
  required_rubygems_version: !ruby/object:Gem::Requirement
320
- none: false
321
320
  requirements:
322
- - - ! '>='
321
+ - - ">="
323
322
  - !ruby/object:Gem::Version
324
323
  version: '0'
325
324
  requirements: []
326
325
  rubyforge_project:
327
- rubygems_version: 1.8.23
326
+ rubygems_version: 2.5.2
328
327
  signing_key:
329
- specification_version: 3
328
+ specification_version: 4
330
329
  summary: A Ruby wrapper and CLI for the GitLab API
331
330
  test_files:
332
331
  - spec/fixtures/branch.json
@@ -343,7 +342,6 @@ test_files:
343
342
  - spec/fixtures/error_already_exists.json
344
343
  - spec/fixtures/error_project_not_found.json
345
344
  - spec/fixtures/get_repository_file.json
346
- - spec/fixtures/git_hook.json
347
345
  - spec/fixtures/group.json
348
346
  - spec/fixtures/group_create.json
349
347
  - spec/fixtures/group_create_with_description.json
@@ -363,20 +361,28 @@ test_files:
363
361
  - spec/fixtures/labels.json
364
362
  - spec/fixtures/merge_request.json
365
363
  - spec/fixtures/merge_request_changes.json
364
+ - spec/fixtures/merge_request_closes_issues.json
366
365
  - spec/fixtures/merge_request_comment.json
367
366
  - spec/fixtures/merge_request_comments.json
368
367
  - spec/fixtures/merge_request_commits.json
369
368
  - spec/fixtures/merge_requests.json
370
369
  - spec/fixtures/milestone.json
371
370
  - spec/fixtures/milestone_issues.json
371
+ - spec/fixtures/milestone_merge_requests.json
372
372
  - spec/fixtures/milestones.json
373
373
  - spec/fixtures/namespaces.json
374
374
  - spec/fixtures/note.json
375
375
  - spec/fixtures/notes.json
376
+ - spec/fixtures/pipeline.json
377
+ - spec/fixtures/pipeline_cancel.json
378
+ - spec/fixtures/pipeline_create.json
379
+ - spec/fixtures/pipeline_retry.json
380
+ - spec/fixtures/pipelines.json
376
381
  - spec/fixtures/project.json
377
382
  - spec/fixtures/project_commit.json
378
383
  - spec/fixtures/project_commit_comment.json
379
384
  - spec/fixtures/project_commit_comments.json
385
+ - spec/fixtures/project_commit_create.json
380
386
  - spec/fixtures/project_commit_diff.json
381
387
  - spec/fixtures/project_commit_status.json
382
388
  - spec/fixtures/project_commits.json
@@ -394,11 +400,14 @@ test_files:
394
400
  - spec/fixtures/project_runner_enable.json
395
401
  - spec/fixtures/project_runners.json
396
402
  - spec/fixtures/project_search.json
403
+ - spec/fixtures/project_star.json
397
404
  - spec/fixtures/project_tag_annotated.json
398
405
  - spec/fixtures/project_tag_lightweight.json
399
406
  - spec/fixtures/project_tags.json
407
+ - spec/fixtures/project_unstar.json
400
408
  - spec/fixtures/project_update_commit_status.json
401
409
  - spec/fixtures/projects.json
410
+ - spec/fixtures/push_rule.json
402
411
  - spec/fixtures/raw_file.json
403
412
  - spec/fixtures/release_create.json
404
413
  - spec/fixtures/release_update.json
@@ -440,6 +449,7 @@ test_files:
440
449
  - spec/gitlab/client/build_triggers_spec.rb
441
450
  - spec/gitlab/client/build_variables_spec.rb
442
451
  - spec/gitlab/client/builds_spec.rb
452
+ - spec/gitlab/client/client_spec.rb
443
453
  - spec/gitlab/client/commits_spec.rb
444
454
  - spec/gitlab/client/groups_spec.rb
445
455
  - spec/gitlab/client/issues_spec.rb
@@ -448,6 +458,7 @@ test_files:
448
458
  - spec/gitlab/client/milestones_spec.rb
449
459
  - spec/gitlab/client/namespaces_spec.rb
450
460
  - spec/gitlab/client/notes_spec.rb
461
+ - spec/gitlab/client/pipelines_spec.rb
451
462
  - spec/gitlab/client/projects_spec.rb
452
463
  - spec/gitlab/client/repositories_spec.rb
453
464
  - spec/gitlab/client/repository_files_spec.rb
@@ -468,4 +479,3 @@ test_files:
468
479
  - spec/gitlab/shell_spec.rb
469
480
  - spec/gitlab_spec.rb
470
481
  - spec/spec_helper.rb
471
- has_rdoc: