Merge new upstream release 4.17.0+git20201231.3df8f13.
Debian Janitor
2 years ago
16 | 16 | Exclude: |
17 | 17 | - 'spec/**/*' |
18 | 18 | |
19 | Metrics/ParameterLists: | |
20 | MaxOptionalParameters: 4 | |
21 | ||
19 | 22 | Style/Documentation: |
20 | 23 | Enabled: false |
21 | 24 |
0 | ruby-gitlab (4.17.0+git20201231.3df8f13-1) UNRELEASED; urgency=low | |
1 | -- Debian Janitor <janitor@jelmer.uk> Sun, 28 Mar 2021 03:42:21 -0000 | |
2 | ||
0 | 3 | ruby-gitlab (4.17.0-2) unstable; urgency=medium |
1 | 4 | |
2 | 5 | * Team upload |
269 | 269 | def delete_ldap_group_links(id, commonname, provider) |
270 | 270 | delete("/groups/#{url_encode id}/ldap_group_links/#{url_encode provider}/#{url_encode commonname}") |
271 | 271 | end |
272 | ||
273 | # Gets group custom_attributes. | |
274 | # | |
275 | # @example | |
276 | # Gitlab.group_custom_attributes(2) | |
277 | # | |
278 | # @param [Integer] group_id The ID of a group. | |
279 | # @return [Gitlab::ObjectifiedHash] | |
280 | def group_custom_attributes(group_id) | |
281 | get("/groups/#{group_id}/custom_attributes") | |
282 | end | |
283 | ||
284 | # Gets single group custom_attribute. | |
285 | # | |
286 | # @example | |
287 | # Gitlab.group_custom_attribute('key', 2) | |
288 | # | |
289 | # @param [String] key The custom_attributes key | |
290 | # @param [Integer] group_id The ID of a group. | |
291 | # @return [Gitlab::ObjectifiedHash] | |
292 | def group_custom_attribute(key, group_id) | |
293 | get("/groups/#{group_id}/custom_attributes/#{key}") | |
294 | end | |
295 | ||
296 | # Creates a new custom_attribute | |
297 | # | |
298 | # @example | |
299 | # Gitlab.add_custom_attribute('some_new_key', 'some_new_value', 2) | |
300 | # | |
301 | # @param [String] key The custom_attributes key | |
302 | # @param [String] value The custom_attributes value | |
303 | # @param [Integer] group_id The ID of a group. | |
304 | # @return [Gitlab::ObjectifiedHash] | |
305 | def add_group_custom_attribute(key, value, group_id) | |
306 | url = "/groups/#{group_id}/custom_attributes/#{key}" | |
307 | put(url, body: { value: value }) | |
308 | end | |
309 | ||
310 | # Delete custom_attribute | |
311 | # Will delete a custom_attribute | |
312 | # | |
313 | # @example | |
314 | # Gitlab.delete_group_custom_attribute('somekey', 2) | |
315 | # | |
316 | # @param [String] key The custom_attribute key to delete | |
317 | # @param [Integer] group_id The ID of a group. | |
318 | # @return [Boolean] | |
319 | def delete_group_custom_attribute(key, group_id = nil) | |
320 | delete("/groups/#{group_id}/custom_attributes/#{key}") | |
321 | end | |
272 | 322 | end |
273 | 323 | end |
13 | 13 | def key(id) |
14 | 14 | get("/keys/#{id}") |
15 | 15 | end |
16 | ||
17 | # Gets information about a key by key fingerprint. | |
18 | # | |
19 | # @example | |
20 | # Gitlab.key_by_fingerprint("9f:70:33:b3:50:4d:9a:a3:ef:ea:13:9b:87:0f:7f:7e") | |
21 | # | |
22 | # @param [String] fingerprint The Fingerprint of a key. | |
23 | # @return [Gitlab::ObjectifiedHash] | |
24 | def key_by_fingerprint(fingerprint) | |
25 | get('/keys', query: { fingerprint: fingerprint }) | |
26 | end | |
16 | 27 | end |
17 | 28 | end |
639 | 639 | def unarchive_project(id) |
640 | 640 | post("/projects/#{url_encode id}/unarchive") |
641 | 641 | end |
642 | ||
643 | # Gets project custom_attributes. | |
644 | # | |
645 | # @example | |
646 | # Gitlab.project_custom_attributes(2) | |
647 | # | |
648 | # @param [Integer] project_id The ID of a project. | |
649 | # @return [Gitlab::ObjectifiedHash] | |
650 | def project_custom_attributes(project_id) | |
651 | get("/projects/#{project_id}/custom_attributes") | |
652 | end | |
653 | ||
654 | # Gets single project custom_attribute. | |
655 | # | |
656 | # @example | |
657 | # Gitlab.project_custom_attribute(key, 2) | |
658 | # | |
659 | # @param [String] key The custom_attributes key | |
660 | # @param [Integer] project_id The ID of a project. | |
661 | # @return [Gitlab::ObjectifiedHash] | |
662 | def project_custom_attribute(key, project_id) | |
663 | get("/projects/#{project_id}/custom_attributes/#{key}") | |
664 | end | |
665 | ||
666 | # Creates a new custom_attribute | |
667 | # | |
668 | # @example | |
669 | # Gitlab.add_custom_attribute('some_new_key', 'some_new_value', 2) | |
670 | # | |
671 | # @param [String] key The custom_attributes key | |
672 | # @param [String] value The custom_attributes value | |
673 | # @param [Integer] project_id The ID of a project. | |
674 | # @return [Gitlab::ObjectifiedHash] | |
675 | def add_project_custom_attribute(key, value, project_id) | |
676 | url = "/projects/#{project_id}/custom_attributes/#{key}" | |
677 | put(url, body: { value: value }) | |
678 | end | |
679 | ||
680 | # Delete custom_attribute | |
681 | # Will delete a custom_attribute | |
682 | # | |
683 | # @example | |
684 | # Gitlab.delete_project_custom_attribute('somekey', 2) | |
685 | # | |
686 | # @param [String] key The custom_attribute key to delete | |
687 | # @param [Integer] project_id The ID of a project. | |
688 | # @return [Boolean] | |
689 | def delete_project_custom_attribute(key, project_id = nil) | |
690 | delete("/projects/#{project_id}/custom_attributes/#{key}") | |
691 | end | |
642 | 692 | end |
643 | 693 | end |
278 | 278 | options[:search] = search |
279 | 279 | get('/users', query: options) |
280 | 280 | end |
281 | ||
282 | # Gets user custom_attributes. | |
283 | # | |
284 | # @example | |
285 | # Gitlab.user_custom_attributes(2) | |
286 | # | |
287 | # @param [Integer] user_id The ID of a user. | |
288 | # @return [Gitlab::ObjectifiedHash] | |
289 | def user_custom_attributes(user_id) | |
290 | get("/users/#{user_id}/custom_attributes") | |
291 | end | |
292 | ||
293 | # Gets single user custom_attribute. | |
294 | # | |
295 | # @example | |
296 | # Gitlab.user_custom_attribute(key, 2) | |
297 | # | |
298 | # @param [String] key The custom_attributes key | |
299 | # @param [Integer] user_id The ID of a user. | |
300 | # @return [Gitlab::ObjectifiedHash] | |
301 | def user_custom_attribute(key, user_id) | |
302 | get("/users/#{user_id}/custom_attributes/#{key}") | |
303 | end | |
304 | ||
305 | # Creates a new custom_attribute | |
306 | # | |
307 | # @example | |
308 | # Gitlab.add_custom_attribute('some_new_key', 'some_new_value', 2) | |
309 | # | |
310 | # @param [String] key The custom_attributes key | |
311 | # @param [String] value The custom_attributes value | |
312 | # @param [Integer] user_id The ID of a user. | |
313 | # @return [Gitlab::ObjectifiedHash] | |
314 | def add_user_custom_attribute(key, value, user_id) | |
315 | url = "/users/#{user_id}/custom_attributes/#{key}" | |
316 | put(url, body: { value: value }) | |
317 | end | |
318 | ||
319 | # Delete custom_attribute | |
320 | # Will delete a custom_attribute | |
321 | # | |
322 | # @example | |
323 | # Gitlab.delete_user_custom_attribute('somekey', 2) | |
324 | # | |
325 | # @param [String] key The custom_attribute key to delete | |
326 | # @param [Integer] user_id The ID of a user. | |
327 | # @return [Boolean] | |
328 | def delete_user_custom_attribute(key, user_id) | |
329 | delete("/users/#{user_id}/custom_attributes/#{key}") | |
330 | end | |
281 | 331 | end |
282 | 332 | end |
0 | {"key":"some_new_key","value":"some_new_value"} |
0 | [{"key":"somekey","value":"somevalue"},{"key":"somekey2","value":"somevalue2"}] |
0 | {"key":"some_new_key","value":"some_new_value"} |
0 | [{"key":"somekey","value":"somevalue"},{"key":"somekey2","value":"somevalue2"}] |
0 | {"key":"some_new_key","value":"some_new_value"} |
0 | [{"key":"somekey","value":"somevalue"},{"key":"somekey2","value":"somevalue2"}] |
344 | 344 | expect(a_delete('/groups/1/ldap_group_links/ldap/all')).to have_been_made |
345 | 345 | end |
346 | 346 | end |
347 | ||
348 | describe '.group_custom_attributes' do | |
349 | before do | |
350 | stub_get('/groups/2/custom_attributes', 'group_custom_attributes') | |
351 | @custom_attributes = Gitlab.group_custom_attributes(2) | |
352 | end | |
353 | ||
354 | it 'gets the correct resource' do | |
355 | expect(a_get('/groups/2/custom_attributes')).to have_been_made | |
356 | end | |
357 | ||
358 | it 'returns a information about a custom_attribute of group' do | |
359 | expect(@custom_attributes.first.key).to eq 'somekey' | |
360 | expect(@custom_attributes.last.value).to eq('somevalue2') | |
361 | end | |
362 | end | |
363 | ||
364 | describe '.group_custom_attribute' do | |
365 | before do | |
366 | stub_get('/groups/2/custom_attributes/some_new_key', 'group_custom_attribute') | |
367 | @custom_attribute = Gitlab.group_custom_attribute('some_new_key', 2) | |
368 | end | |
369 | ||
370 | it 'gets the correct resource' do | |
371 | expect(a_get('/groups/2/custom_attributes/some_new_key')).to have_been_made | |
372 | end | |
373 | ||
374 | it 'returns a information about the single custom_attribute of group' do | |
375 | expect(@custom_attribute.key).to eq 'some_new_key' | |
376 | expect(@custom_attribute.value).to eq('some_new_value') | |
377 | end | |
378 | end | |
379 | ||
380 | describe '.add_custom_attribute' do | |
381 | describe 'with group ID' do | |
382 | before do | |
383 | stub_put('/groups/2/custom_attributes/some_new_key', 'group_custom_attribute') | |
384 | @custom_attribute = Gitlab.add_group_custom_attribute('some_new_key', 'some_new_value', 2) | |
385 | end | |
386 | ||
387 | it 'gets the correct resource' do | |
388 | body = { value: 'some_new_value' } | |
389 | expect(a_put('/groups/2/custom_attributes/some_new_key').with(body: body)).to have_been_made | |
390 | expect(a_put('/groups/2/custom_attributes/some_new_key')).to have_been_made | |
391 | end | |
392 | ||
393 | it 'returns information about a new custom attribute' do | |
394 | expect(@custom_attribute.key).to eq 'some_new_key' | |
395 | expect(@custom_attribute.value).to eq 'some_new_value' | |
396 | end | |
397 | end | |
398 | end | |
399 | ||
400 | describe '.delete_custom_attribute' do | |
401 | describe 'with group ID' do | |
402 | before do | |
403 | stub_delete('/groups/2/custom_attributes/some_new_key', 'group_custom_attribute') | |
404 | @custom_attribute = Gitlab.delete_group_custom_attribute('some_new_key', 2) | |
405 | end | |
406 | ||
407 | it 'gets the correct resource' do | |
408 | expect(a_delete('/groups/2/custom_attributes/some_new_key')).to have_been_made | |
409 | end | |
410 | ||
411 | it 'returns information about a deleted custom_attribute' do | |
412 | expect(@custom_attribute).to be_truthy | |
413 | end | |
414 | end | |
415 | end | |
347 | 416 | end |
17 | 17 | expect(@key.title).to eq('narkoz@helium') |
18 | 18 | end |
19 | 19 | end |
20 | ||
21 | describe '.key_by_fingerprint' do | |
22 | before do | |
23 | stub_get('/keys?fingerprint=9f:70:33:b3:50:4d:9a:a3:ef:ea:13:9b:87:0f:7f:7e', 'key') | |
24 | @key = Gitlab.key_by_fingerprint('9f:70:33:b3:50:4d:9a:a3:ef:ea:13:9b:87:0f:7f:7e') | |
25 | end | |
26 | ||
27 | it 'gets the correct resource' do | |
28 | expect(a_get('/keys?fingerprint=9f:70:33:b3:50:4d:9a:a3:ef:ea:13:9b:87:0f:7f:7e')).to have_been_made | |
29 | end | |
30 | ||
31 | it 'returns information about a key' do | |
32 | expect(@key.id).to eq(1) | |
33 | expect(@key.title).to eq('narkoz@helium') | |
34 | end | |
35 | end | |
20 | 36 | end |
839 | 839 | expect(@unarchived_project.archived).to eq(false) |
840 | 840 | end |
841 | 841 | end |
842 | ||
843 | describe '.project_custom_attributes' do | |
844 | before do | |
845 | stub_get('/projects/2/custom_attributes', 'project_custom_attributes') | |
846 | @custom_attributes = Gitlab.project_custom_attributes(2) | |
847 | end | |
848 | ||
849 | it 'gets the correct resource' do | |
850 | expect(a_get('/projects/2/custom_attributes')).to have_been_made | |
851 | end | |
852 | ||
853 | it 'returns a information about a custom_attribute of project' do | |
854 | expect(@custom_attributes.first.key).to eq 'somekey' | |
855 | expect(@custom_attributes.last.value).to eq('somevalue2') | |
856 | end | |
857 | end | |
858 | ||
859 | describe '.project_custom_attribute' do | |
860 | before do | |
861 | stub_get('/projects/2/custom_attributes/some_new_key', 'project_custom_attribute') | |
862 | @custom_attribute = Gitlab.project_custom_attribute('some_new_key', 2) | |
863 | end | |
864 | ||
865 | it 'gets the correct resource' do | |
866 | expect(a_get('/projects/2/custom_attributes/some_new_key')).to have_been_made | |
867 | end | |
868 | ||
869 | it 'returns a information about the single custom_attribute of project' do | |
870 | expect(@custom_attribute.key).to eq 'some_new_key' | |
871 | expect(@custom_attribute.value).to eq('some_new_value') | |
872 | end | |
873 | end | |
874 | ||
875 | describe '.add_custom_attribute' do | |
876 | describe 'with project ID' do | |
877 | before do | |
878 | stub_put('/projects/2/custom_attributes/some_new_key', 'project_custom_attribute') | |
879 | @custom_attribute = Gitlab.add_project_custom_attribute('some_new_key', 'some_new_value', 2) | |
880 | end | |
881 | ||
882 | it 'gets the correct resource' do | |
883 | body = { value: 'some_new_value' } | |
884 | expect(a_put('/projects/2/custom_attributes/some_new_key').with(body: body)).to have_been_made | |
885 | expect(a_put('/projects/2/custom_attributes/some_new_key')).to have_been_made | |
886 | end | |
887 | ||
888 | it 'returns information about a new custom attribute' do | |
889 | expect(@custom_attribute.key).to eq 'some_new_key' | |
890 | expect(@custom_attribute.value).to eq 'some_new_value' | |
891 | end | |
892 | end | |
893 | end | |
894 | ||
895 | describe '.delete_custom_attribute' do | |
896 | describe 'with project ID' do | |
897 | before do | |
898 | stub_delete('/projects/2/custom_attributes/some_new_key', 'project_custom_attribute') | |
899 | @custom_attribute = Gitlab.delete_project_custom_attribute('some_new_key', 2) | |
900 | end | |
901 | ||
902 | it 'gets the correct resource' do | |
903 | expect(a_delete('/projects/2/custom_attributes/some_new_key')).to have_been_made | |
904 | end | |
905 | ||
906 | it 'returns information about a deleted custom_attribute' do | |
907 | expect(@custom_attribute).to be_truthy | |
908 | end | |
909 | end | |
910 | end | |
842 | 911 | end |
477 | 477 | expect(@users.last.id).to eq(2) |
478 | 478 | end |
479 | 479 | end |
480 | ||
481 | describe '.user_custom_attributes' do | |
482 | before do | |
483 | stub_get('/users/2/custom_attributes', 'user_custom_attributes') | |
484 | @custom_attributes = Gitlab.user_custom_attributes(2) | |
485 | end | |
486 | ||
487 | it 'gets the correct resource' do | |
488 | expect(a_get('/users/2/custom_attributes')).to have_been_made | |
489 | end | |
490 | ||
491 | it 'returns a information about a custom_attribute of user' do | |
492 | expect(@custom_attributes.first.key).to eq 'somekey' | |
493 | expect(@custom_attributes.last.value).to eq('somevalue2') | |
494 | end | |
495 | end | |
496 | ||
497 | describe '.user_custom_attribute' do | |
498 | before do | |
499 | stub_get('/users/2/custom_attributes/some_new_key', 'user_custom_attribute') | |
500 | @custom_attribute = Gitlab.user_custom_attribute('some_new_key', 2) | |
501 | end | |
502 | ||
503 | it 'gets the correct resource' do | |
504 | expect(a_get('/users/2/custom_attributes/some_new_key')).to have_been_made | |
505 | end | |
506 | ||
507 | it 'returns a information about the single custom_attribute of user' do | |
508 | expect(@custom_attribute.key).to eq 'some_new_key' | |
509 | expect(@custom_attribute.value).to eq('some_new_value') | |
510 | end | |
511 | end | |
512 | ||
513 | describe '.add_custom_attribute' do | |
514 | describe 'with user ID' do | |
515 | before do | |
516 | stub_put('/users/2/custom_attributes/some_new_key', 'user_custom_attribute') | |
517 | @custom_attribute = Gitlab.add_user_custom_attribute('some_new_key', 'some_new_value', 2) | |
518 | end | |
519 | ||
520 | it 'gets the correct resource' do | |
521 | body = { value: 'some_new_value' } | |
522 | expect(a_put('/users/2/custom_attributes/some_new_key').with(body: body)).to have_been_made | |
523 | expect(a_put('/users/2/custom_attributes/some_new_key')).to have_been_made | |
524 | end | |
525 | ||
526 | it 'returns information about a new custom attribute' do | |
527 | expect(@custom_attribute.key).to eq 'some_new_key' | |
528 | expect(@custom_attribute.value).to eq 'some_new_value' | |
529 | end | |
530 | end | |
531 | end | |
532 | ||
533 | describe '.delete_custom_attribute' do | |
534 | describe 'with user ID' do | |
535 | before do | |
536 | stub_delete('/users/2/custom_attributes/some_new_key', 'user_custom_attribute') | |
537 | @custom_attribute = Gitlab.delete_user_custom_attribute('some_new_key', 2) | |
538 | end | |
539 | ||
540 | it 'gets the correct resource' do | |
541 | expect(a_delete('/users/2/custom_attributes/some_new_key')).to have_been_made | |
542 | end | |
543 | ||
544 | it 'returns information about a deleted custom_attribute' do | |
545 | expect(@custom_attribute).to be_truthy | |
546 | end | |
547 | end | |
548 | end | |
480 | 549 | end |