gitlab 4.6.0 → 4.6.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/lib/gitlab/client/access_requests.rb +92 -90
  3. data/lib/gitlab/client/award_emojis.rb +126 -124
  4. data/lib/gitlab/client/boards.rb +81 -79
  5. data/lib/gitlab/client/branches.rb +89 -87
  6. data/lib/gitlab/client/build_variables.rb +117 -115
  7. data/lib/gitlab/client/builds.rb +98 -96
  8. data/lib/gitlab/client/commits.rb +154 -152
  9. data/lib/gitlab/client/deployments.rb +29 -27
  10. data/lib/gitlab/client/environments.rb +80 -78
  11. data/lib/gitlab/client/events.rb +54 -52
  12. data/lib/gitlab/client/group_milestones.rb +85 -83
  13. data/lib/gitlab/client/groups.rb +178 -176
  14. data/lib/gitlab/client/issues.rb +190 -188
  15. data/lib/gitlab/client/jobs.rb +150 -148
  16. data/lib/gitlab/client/keys.rb +14 -12
  17. data/lib/gitlab/client/labels.rb +79 -77
  18. data/lib/gitlab/client/merge_request_approvals.rb +101 -99
  19. data/lib/gitlab/client/merge_requests.rb +279 -277
  20. data/lib/gitlab/client/milestones.rb +85 -83
  21. data/lib/gitlab/client/namespaces.rb +18 -16
  22. data/lib/gitlab/client/notes.rb +260 -258
  23. data/lib/gitlab/client/pipeline_schedules.rb +123 -121
  24. data/lib/gitlab/client/pipeline_triggers.rb +93 -91
  25. data/lib/gitlab/client/pipelines.rb +62 -60
  26. data/lib/gitlab/client/projects.rb +526 -524
  27. data/lib/gitlab/client/repositories.rb +67 -65
  28. data/lib/gitlab/client/repository_files.rb +103 -101
  29. data/lib/gitlab/client/runners.rb +114 -112
  30. data/lib/gitlab/client/services.rb +45 -43
  31. data/lib/gitlab/client/sidekiq.rb +32 -30
  32. data/lib/gitlab/client/snippets.rb +86 -84
  33. data/lib/gitlab/client/system_hooks.rb +57 -55
  34. data/lib/gitlab/client/tags.rb +88 -86
  35. data/lib/gitlab/client/todos.rb +40 -38
  36. data/lib/gitlab/client/users.rb +243 -241
  37. data/lib/gitlab/client/versions.rb +13 -11
  38. data/lib/gitlab/help.rb +1 -1
  39. data/lib/gitlab/version.rb +1 -1
  40. metadata +1 -1
@@ -1,88 +1,90 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Defines methods related to issue boards.
4
- # @see https://docs.gitlab.com/ce/api/boards.html
5
- module Boards
6
- # Gets a list of project's boards.
7
- #
8
- # @example
9
- # Gitlab.boards(5)
10
- # Gitlab.boards({ per_page: 40 })
11
- #
12
- # @param [Integer, String] project The ID or name of a project.
13
- # @param [Hash] options A customizable set of options.
14
- # @option options [Integer] :page The page number.
15
- # @option options [Integer] :per_page The number of results per page.
16
- # @return [Array<Gitlab::ObjectifiedHash>]
17
- def boards(project, options = {})
18
- get("/projects/#{url_encode project}/boards", query: options)
19
- end
3
+ class Gitlab::Client
4
+ # Defines methods related to issue boards.
5
+ # @see https://docs.gitlab.com/ce/api/boards.html
6
+ module Boards
7
+ # Gets a list of project's boards.
8
+ #
9
+ # @example
10
+ # Gitlab.boards(5)
11
+ # Gitlab.boards({ per_page: 40 })
12
+ #
13
+ # @param [Integer, String] project The ID or name of a project.
14
+ # @param [Hash] options A customizable set of options.
15
+ # @option options [Integer] :page The page number.
16
+ # @option options [Integer] :per_page The number of results per page.
17
+ # @return [Array<Gitlab::ObjectifiedHash>]
18
+ def boards(project, options = {})
19
+ get("/projects/#{url_encode project}/boards", query: options)
20
+ end
20
21
 
21
- # Gets a board lists
22
- #
23
- # @example
24
- # Gitlab.board_lists(5, 42)
25
- #
26
- # @param [Integer, String] project The ID or name of a project.
27
- # @param [Integer] id The ID of a board.
28
- # @return [Gitlab::ObjectifiedHash]
29
- def board_lists(project, id)
30
- get("/projects/#{url_encode project}/boards/#{id}/lists")
31
- end
22
+ # Gets a board lists
23
+ #
24
+ # @example
25
+ # Gitlab.board_lists(5, 42)
26
+ #
27
+ # @param [Integer, String] project The ID or name of a project.
28
+ # @param [Integer] id The ID of a board.
29
+ # @return [Gitlab::ObjectifiedHash]
30
+ def board_lists(project, id)
31
+ get("/projects/#{url_encode project}/boards/#{id}/lists")
32
+ end
32
33
 
33
- #
34
- # Gets a single board list
35
- #
36
- # @example
37
- # Gitlab.board_list(5, 42, 25)
38
- #
39
- # @param [Integer, String] project The ID or name of a project.
40
- # @param [Integer] board_id The ID of a board.
41
- # @param [Integer] id The ID of a list.
42
- # @return [Gitlab::ObjectifiedHash]
43
- def board_list(project, board_id, id)
44
- get("/projects/#{url_encode project}/boards/#{board_id}/lists/#{id}")
45
- end
34
+ #
35
+ # Gets a single board list
36
+ #
37
+ # @example
38
+ # Gitlab.board_list(5, 42, 25)
39
+ #
40
+ # @param [Integer, String] project The ID or name of a project.
41
+ # @param [Integer] board_id The ID of a board.
42
+ # @param [Integer] id The ID of a list.
43
+ # @return [Gitlab::ObjectifiedHash]
44
+ def board_list(project, board_id, id)
45
+ get("/projects/#{url_encode project}/boards/#{board_id}/lists/#{id}")
46
+ end
46
47
 
47
- # Creates a new board list.
48
- # Only for admins and project owners
49
- #
50
- # @example
51
- # Gitlab.create_board_list(5, 42, 25)
52
- #
53
- # @param [Integer, String] project The ID or name of a project.
54
- # @param [Integer] id The ID of a board.
55
- # @param [Integer] label_id The ID of a label.
56
- # @return [Gitlab::ObjectifiedHash] Information about created list.
57
- def create_board_list(project, board_id, label_id)
58
- post("/projects/#{url_encode project}/boards/#{board_id}/lists", body: { label_id: label_id })
59
- end
48
+ # Creates a new board list.
49
+ # Only for admins and project owners
50
+ #
51
+ # @example
52
+ # Gitlab.create_board_list(5, 42, 25)
53
+ #
54
+ # @param [Integer, String] project The ID or name of a project.
55
+ # @param [Integer] id The ID of a board.
56
+ # @param [Integer] label_id The ID of a label.
57
+ # @return [Gitlab::ObjectifiedHash] Information about created list.
58
+ def create_board_list(project, board_id, label_id)
59
+ post("/projects/#{url_encode project}/boards/#{board_id}/lists", body: { label_id: label_id })
60
+ end
60
61
 
61
- # Updates a board list.
62
- # Only for admins and project owners
63
- #
64
- # @example
65
- # Gitlab.edit_board_list(6, 1, 12, 5)
66
- #
67
- # @param [Integer, String] project The ID or name of a project.
68
- # @param [Integer] board_id The ID of a board.
69
- # @param [Integer] id The ID of a list.
70
- # @return [Gitlab::ObjectifiedHash] Information about updated board list.
71
- def edit_board_list(project, board_id, id, position)
72
- put("/projects/#{url_encode project}/boards/#{board_id}/lists/#{id}", body: { position: position })
73
- end
62
+ # Updates a board list.
63
+ # Only for admins and project owners
64
+ #
65
+ # @example
66
+ # Gitlab.edit_board_list(6, 1, 12, 5)
67
+ #
68
+ # @param [Integer, String] project The ID or name of a project.
69
+ # @param [Integer] board_id The ID of a board.
70
+ # @param [Integer] id The ID of a list.
71
+ # @return [Gitlab::ObjectifiedHash] Information about updated board list.
72
+ def edit_board_list(project, board_id, id, position)
73
+ put("/projects/#{url_encode project}/boards/#{board_id}/lists/#{id}", body: { position: position })
74
+ end
74
75
 
75
- # Deletes a board list.
76
- # Only for admins and project owners
77
- #
78
- # @example
79
- # Gitlab.delete_board_list(3, 42, 32)
80
- #
81
- # @param [Integer, String] project The ID or name of a project.
82
- # @param [Integer] board_id The ID of a board.
83
- # @param [Integer] id The ID of a list.
84
- # @return [Gitlab::ObjectifiedHash] Information about deleted board list.
85
- def delete_board_list(project, board_id, id)
86
- delete("/projects/#{url_encode project}/boards/#{board_id}/lists/#{id}")
76
+ # Deletes a board list.
77
+ # Only for admins and project owners
78
+ #
79
+ # @example
80
+ # Gitlab.delete_board_list(3, 42, 32)
81
+ #
82
+ # @param [Integer, String] project The ID or name of a project.
83
+ # @param [Integer] board_id The ID of a board.
84
+ # @param [Integer] id The ID of a list.
85
+ # @return [Gitlab::ObjectifiedHash] Information about deleted board list.
86
+ def delete_board_list(project, board_id, id)
87
+ delete("/projects/#{url_encode project}/boards/#{board_id}/lists/#{id}")
88
+ end
87
89
  end
88
90
  end
@@ -1,96 +1,98 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Defines methods related to repositories.
4
- # @see https://docs.gitlab.com/ce/api/branches.html
5
- module Branches
6
- # Gets a list of project repositiory branches.
7
- #
8
- # @example
9
- # Gitlab.branches(42)
10
- #
11
- # @param [Integer, String] project The ID or name of a project.
12
- # @param [Hash] options A customizable set of options.
13
- # @option options [Integer] :page The page number.
14
- # @option options [Integer] :per_page The number of results per page.
15
- # @return [Array<Gitlab::ObjectifiedHash>]
16
- def branches(project, options = {})
17
- get("/projects/#{url_encode project}/repository/branches", query: options)
18
- end
19
- alias repo_branches branches
3
+ class Gitlab::Client
4
+ # Defines methods related to repositories.
5
+ # @see https://docs.gitlab.com/ce/api/branches.html
6
+ module Branches
7
+ # Gets a list of project repositiory branches.
8
+ #
9
+ # @example
10
+ # Gitlab.branches(42)
11
+ #
12
+ # @param [Integer, String] project The ID or name of a project.
13
+ # @param [Hash] options A customizable set of options.
14
+ # @option options [Integer] :page The page number.
15
+ # @option options [Integer] :per_page The number of results per page.
16
+ # @return [Array<Gitlab::ObjectifiedHash>]
17
+ def branches(project, options = {})
18
+ get("/projects/#{url_encode project}/repository/branches", query: options)
19
+ end
20
+ alias repo_branches branches
20
21
 
21
- # Gets information about a repository branch.
22
- #
23
- # @example
24
- # Gitlab.branch(3, 'api')
25
- # Gitlab.repo_branch(5, 'master')
26
- #
27
- # @param [Integer, String] project The ID or name of a project.
28
- # @param [String] branch The name of the branch.
29
- # @return [Gitlab::ObjectifiedHash]
30
- def branch(project, branch)
31
- get("/projects/#{url_encode project}/repository/branches/#{url_encode branch}")
32
- end
33
- alias repo_branch branch
22
+ # Gets information about a repository branch.
23
+ #
24
+ # @example
25
+ # Gitlab.branch(3, 'api')
26
+ # Gitlab.repo_branch(5, 'master')
27
+ #
28
+ # @param [Integer, String] project The ID or name of a project.
29
+ # @param [String] branch The name of the branch.
30
+ # @return [Gitlab::ObjectifiedHash]
31
+ def branch(project, branch)
32
+ get("/projects/#{url_encode project}/repository/branches/#{url_encode branch}")
33
+ end
34
+ alias repo_branch branch
34
35
 
35
- # Protects a repository branch.
36
- #
37
- # @example
38
- # Gitlab.protect_branch(3, 'api')
39
- # Gitlab.repo_protect_branch(5, 'master')
40
- # Gitlab.protect_branch(5, 'api', developers_can_push: true)
41
- #
42
- # To update options, call `protect_branch` again with new options (i.e. `developers_can_push: false`)
43
- #
44
- # @param [Integer, String] project The ID or name of a project.
45
- # @param [String] branch The name of the branch.
46
- # @param [Hash] options A customizable set of options.
47
- # @option options [Boolean] :developers_can_push True to allow developers to push to the branch (default = false)
48
- # @option options [Boolean] :developers_can_merge True to allow developers to merge into the branch (default = false)
49
- # @return [Gitlab::ObjectifiedHash] Details about the branch
50
- def protect_branch(project, branch, options = {})
51
- post("/projects/#{url_encode project}/protected_branches", body: { name: branch }.merge(options))
52
- end
53
- alias repo_protect_branch protect_branch
36
+ # Protects a repository branch.
37
+ #
38
+ # @example
39
+ # Gitlab.protect_branch(3, 'api')
40
+ # Gitlab.repo_protect_branch(5, 'master')
41
+ # Gitlab.protect_branch(5, 'api', developers_can_push: true)
42
+ #
43
+ # To update options, call `protect_branch` again with new options (i.e. `developers_can_push: false`)
44
+ #
45
+ # @param [Integer, String] project The ID or name of a project.
46
+ # @param [String] branch The name of the branch.
47
+ # @param [Hash] options A customizable set of options.
48
+ # @option options [Boolean] :developers_can_push True to allow developers to push to the branch (default = false)
49
+ # @option options [Boolean] :developers_can_merge True to allow developers to merge into the branch (default = false)
50
+ # @return [Gitlab::ObjectifiedHash] Details about the branch
51
+ def protect_branch(project, branch, options = {})
52
+ post("/projects/#{url_encode project}/protected_branches", body: { name: branch }.merge(options))
53
+ end
54
+ alias repo_protect_branch protect_branch
54
55
 
55
- # Unprotects a repository branch.
56
- #
57
- # @example
58
- # Gitlab.unprotect_branch(3, 'api')
59
- # Gitlab.repo_unprotect_branch(5, 'master')
60
- #
61
- # @param [Integer, String] project The ID or name of a project.
62
- # @param [String] branch The name of the branch.
63
- # @return [Gitlab::ObjectifiedHash] Details about the branch
64
- def unprotect_branch(project, branch)
65
- delete("/projects/#{url_encode project}/protected_branches/#{url_encode branch}")
66
- end
67
- alias repo_unprotect_branch unprotect_branch
56
+ # Unprotects a repository branch.
57
+ #
58
+ # @example
59
+ # Gitlab.unprotect_branch(3, 'api')
60
+ # Gitlab.repo_unprotect_branch(5, 'master')
61
+ #
62
+ # @param [Integer, String] project The ID or name of a project.
63
+ # @param [String] branch The name of the branch.
64
+ # @return [Gitlab::ObjectifiedHash] Details about the branch
65
+ def unprotect_branch(project, branch)
66
+ delete("/projects/#{url_encode project}/protected_branches/#{url_encode branch}")
67
+ end
68
+ alias repo_unprotect_branch unprotect_branch
68
69
 
69
- # Creates a repository branch. Requires Gitlab >= 6.8.x
70
- #
71
- # @example
72
- # Gitlab.create_branch(3, 'api', 'feat/new-api')
73
- # Gitlab.repo_create_branch(5, 'master', 'develop')
74
- #
75
- # @param [Integer, String] project The ID or name of a project.
76
- # @param [String] branch The name of the new branch.
77
- # @param [String] ref Create branch from commit sha or existing branch
78
- # @return [Gitlab::ObjectifiedHash] Details about the branch
79
- def create_branch(project, branch, ref)
80
- post("/projects/#{url_encode project}/repository/branches", query: { branch: branch, ref: ref })
81
- end
82
- alias repo_create_branch create_branch
70
+ # Creates a repository branch. Requires Gitlab >= 6.8.x
71
+ #
72
+ # @example
73
+ # Gitlab.create_branch(3, 'api', 'feat/new-api')
74
+ # Gitlab.repo_create_branch(5, 'master', 'develop')
75
+ #
76
+ # @param [Integer, String] project The ID or name of a project.
77
+ # @param [String] branch The name of the new branch.
78
+ # @param [String] ref Create branch from commit sha or existing branch
79
+ # @return [Gitlab::ObjectifiedHash] Details about the branch
80
+ def create_branch(project, branch, ref)
81
+ post("/projects/#{url_encode project}/repository/branches", query: { branch: branch, ref: ref })
82
+ end
83
+ alias repo_create_branch create_branch
83
84
 
84
- # Deletes a repository branch. Requires Gitlab >= 6.8.x
85
- #
86
- # @example
87
- # Gitlab.delete_branch(3, 'api')
88
- # Gitlab.repo_delete_branch(5, 'master')
89
- #
90
- # @param [Integer, String] project The ID or name of a project.
91
- # @param [String] branch The name of the branch to delete
92
- def delete_branch(project, branch)
93
- delete("/projects/#{url_encode project}/repository/branches/#{url_encode branch}")
85
+ # Deletes a repository branch. Requires Gitlab >= 6.8.x
86
+ #
87
+ # @example
88
+ # Gitlab.delete_branch(3, 'api')
89
+ # Gitlab.repo_delete_branch(5, 'master')
90
+ #
91
+ # @param [Integer, String] project The ID or name of a project.
92
+ # @param [String] branch The name of the branch to delete
93
+ def delete_branch(project, branch)
94
+ delete("/projects/#{url_encode project}/repository/branches/#{url_encode branch}")
95
+ end
96
+ alias repo_delete_branch delete_branch
94
97
  end
95
- alias repo_delete_branch delete_branch
96
98
  end
@@ -1,128 +1,130 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Defines methods related to builds.
4
- # @see https://docs.gitlab.com/ce/api/build_variables.html
5
- # @see https://docs.gitlab.com/ee/api/group_level_variables.html
6
- module BuildVariables
7
- # Gets a list of the project's build variables
8
- #
9
- # @example
10
- # Gitlab.variables(5)
11
- #
12
- # @param [Integer, String] project The ID or name of a project.
13
- # @return [Array<Gitlab::ObjectifiedHash>] The list of variables.
14
- def variables(project)
15
- get("/projects/#{url_encode project}/variables")
16
- end
3
+ class Gitlab::Client
4
+ # Defines methods related to builds.
5
+ # @see https://docs.gitlab.com/ce/api/build_variables.html
6
+ # @see https://docs.gitlab.com/ee/api/group_level_variables.html
7
+ module BuildVariables
8
+ # Gets a list of the project's build variables
9
+ #
10
+ # @example
11
+ # Gitlab.variables(5)
12
+ #
13
+ # @param [Integer, String] project The ID or name of a project.
14
+ # @return [Array<Gitlab::ObjectifiedHash>] The list of variables.
15
+ def variables(project)
16
+ get("/projects/#{url_encode project}/variables")
17
+ end
17
18
 
18
- # Gets details of a project's specific build variable.
19
- #
20
- # @example
21
- # Gitlab.variable(5, "TEST_VARIABLE_1")
22
- #
23
- # @param [Integer, String] project The ID or name of a project.
24
- # @param [String] key The key of a variable.
25
- # @return [Gitlab::ObjectifiedHash] The variable.
26
- def variable(project, key)
27
- get("/projects/#{url_encode project}/variables/#{key}")
28
- end
19
+ # Gets details of a project's specific build variable.
20
+ #
21
+ # @example
22
+ # Gitlab.variable(5, "TEST_VARIABLE_1")
23
+ #
24
+ # @param [Integer, String] project The ID or name of a project.
25
+ # @param [String] key The key of a variable.
26
+ # @return [Gitlab::ObjectifiedHash] The variable.
27
+ def variable(project, key)
28
+ get("/projects/#{url_encode project}/variables/#{key}")
29
+ end
29
30
 
30
- # Create a build variable for a project.
31
- #
32
- # @example
33
- # Gitlab.create_variable(5, "NEW_VARIABLE", "new value")
34
- #
35
- # @param [Integer, String] project The ID or name of a project.
36
- # @param [String] key The key of a variable; must have no more than 255 characters; only `A-Z`, `a-z`, `0-9` and `_` are allowed
37
- # @param [String] value The value of a variable
38
- # @return [Gitlab::ObjectifiedHash] The variable.
39
- def create_variable(project, key, value)
40
- post("/projects/#{url_encode project}/variables", body: { key: key, value: value })
41
- end
31
+ # Create a build variable for a project.
32
+ #
33
+ # @example
34
+ # Gitlab.create_variable(5, "NEW_VARIABLE", "new value")
35
+ #
36
+ # @param [Integer, String] project The ID or name of a project.
37
+ # @param [String] key The key of a variable; must have no more than 255 characters; only `A-Z`, `a-z`, `0-9` and `_` are allowed
38
+ # @param [String] value The value of a variable
39
+ # @return [Gitlab::ObjectifiedHash] The variable.
40
+ def create_variable(project, key, value)
41
+ post("/projects/#{url_encode project}/variables", body: { key: key, value: value })
42
+ end
42
43
 
43
- # Update a project's build variable.
44
- #
45
- # @example
46
- # Gitlab.update_variable(5, "NEW_VARIABLE", "updated value")
47
- #
48
- # @param [Integer, String] project The ID or name of a project.
49
- # @param [String] key The key of a variable
50
- # @param [String] value The value of a variable
51
- # @return [Gitlab::ObjectifiedHash] The variable.
52
- def update_variable(project, key, value)
53
- put("/projects/#{url_encode project}/variables/#{key}", body: { value: value })
54
- end
44
+ # Update a project's build variable.
45
+ #
46
+ # @example
47
+ # Gitlab.update_variable(5, "NEW_VARIABLE", "updated value")
48
+ #
49
+ # @param [Integer, String] project The ID or name of a project.
50
+ # @param [String] key The key of a variable
51
+ # @param [String] value The value of a variable
52
+ # @return [Gitlab::ObjectifiedHash] The variable.
53
+ def update_variable(project, key, value)
54
+ put("/projects/#{url_encode project}/variables/#{key}", body: { value: value })
55
+ end
55
56
 
56
- # Remove a project's build variable.
57
- #
58
- # @example
59
- # Gitlab.remove_variable(5, "VARIABLE_1")
60
- #
61
- # @param [Integer, String] project The ID or name of a project.
62
- # @param [String] key The key of a variable.
63
- # @return [Gitlab::ObjectifiedHash] The variable.
64
- def remove_variable(project, key)
65
- delete("/projects/#{url_encode project}/variables/#{key}")
66
- end
57
+ # Remove a project's build variable.
58
+ #
59
+ # @example
60
+ # Gitlab.remove_variable(5, "VARIABLE_1")
61
+ #
62
+ # @param [Integer, String] project The ID or name of a project.
63
+ # @param [String] key The key of a variable.
64
+ # @return [Gitlab::ObjectifiedHash] The variable.
65
+ def remove_variable(project, key)
66
+ delete("/projects/#{url_encode project}/variables/#{key}")
67
+ end
67
68
 
68
- # Gets a list of the group's build variables
69
- #
70
- # @example
71
- # Gitlab.group_variables(5)
72
- #
73
- # @param [Integer, String] group The ID or name of a group.
74
- # @return [Array<Gitlab::ObjectifiedHash>] The list of variables.
75
- def group_variables(group)
76
- get("/groups/#{url_encode group}/variables")
77
- end
69
+ # Gets a list of the group's build variables
70
+ #
71
+ # @example
72
+ # Gitlab.group_variables(5)
73
+ #
74
+ # @param [Integer, String] group The ID or name of a group.
75
+ # @return [Array<Gitlab::ObjectifiedHash>] The list of variables.
76
+ def group_variables(group)
77
+ get("/groups/#{url_encode group}/variables")
78
+ end
78
79
 
79
- # Gets details of a group's specific build variable.
80
- #
81
- # @example
82
- # Gitlab.group_variable(5, "TEST_VARIABLE_1")
83
- #
84
- # @param [Integer, String] group The ID or name of a group.
85
- # @param [String] key The key of a variable.
86
- # @return [Gitlab::ObjectifiedHash] The variable.
87
- def group_variable(group, key)
88
- get("/groups/#{url_encode group}/variables/#{key}")
89
- end
80
+ # Gets details of a group's specific build variable.
81
+ #
82
+ # @example
83
+ # Gitlab.group_variable(5, "TEST_VARIABLE_1")
84
+ #
85
+ # @param [Integer, String] group The ID or name of a group.
86
+ # @param [String] key The key of a variable.
87
+ # @return [Gitlab::ObjectifiedHash] The variable.
88
+ def group_variable(group, key)
89
+ get("/groups/#{url_encode group}/variables/#{key}")
90
+ end
90
91
 
91
- # Create a build variable for a group.
92
- #
93
- # @example
94
- # Gitlab.create_group_variable(5, "NEW_VARIABLE", "new value")
95
- #
96
- # @param [Integer, String] group The ID or name of a group.
97
- # @param [String] key The key of a variable; must have no more than 255 characters; only `A-Z`, `a-z`, `0-9` and `_` are allowed
98
- # @param [String] value The value of a variable
99
- # @return [Gitlab::ObjectifiedHash] The variable.
100
- def create_group_variable(group, key, value)
101
- post("/groups/#{url_encode group}/variables", body: { key: key, value: value })
102
- end
92
+ # Create a build variable for a group.
93
+ #
94
+ # @example
95
+ # Gitlab.create_group_variable(5, "NEW_VARIABLE", "new value")
96
+ #
97
+ # @param [Integer, String] group The ID or name of a group.
98
+ # @param [String] key The key of a variable; must have no more than 255 characters; only `A-Z`, `a-z`, `0-9` and `_` are allowed
99
+ # @param [String] value The value of a variable
100
+ # @return [Gitlab::ObjectifiedHash] The variable.
101
+ def create_group_variable(group, key, value)
102
+ post("/groups/#{url_encode group}/variables", body: { key: key, value: value })
103
+ end
103
104
 
104
- # Update a group's build variable.
105
- #
106
- # @example
107
- # Gitlab.update_group_variable(5, "NEW_VARIABLE", "updated value")
108
- #
109
- # @param [Integer, String] group The ID or name of a group.
110
- # @param [String] key The key of a variable
111
- # @param [String] value The value of a variable
112
- # @return [Gitlab::ObjectifiedHash] The variable.
113
- def update_group_variable(group, key, value)
114
- put("/groups/#{url_encode group}/variables/#{key}", body: { value: value })
115
- end
105
+ # Update a group's build variable.
106
+ #
107
+ # @example
108
+ # Gitlab.update_group_variable(5, "NEW_VARIABLE", "updated value")
109
+ #
110
+ # @param [Integer, String] group The ID or name of a group.
111
+ # @param [String] key The key of a variable
112
+ # @param [String] value The value of a variable
113
+ # @return [Gitlab::ObjectifiedHash] The variable.
114
+ def update_group_variable(group, key, value)
115
+ put("/groups/#{url_encode group}/variables/#{key}", body: { value: value })
116
+ end
116
117
 
117
- # Remove a group's build variable.
118
- #
119
- # @example
120
- # Gitlab.remove_group_variable(5, "VARIABLE_1")
121
- #
122
- # @param [Integer, String] group The ID or name of a group.
123
- # @param [String] key The key of a variable.
124
- # @return [Gitlab::ObjectifiedHash] The variable.
125
- def remove_group_variable(group, key)
126
- delete("/groups/#{url_encode group}/variables/#{key}")
118
+ # Remove a group's build variable.
119
+ #
120
+ # @example
121
+ # Gitlab.remove_group_variable(5, "VARIABLE_1")
122
+ #
123
+ # @param [Integer, String] group The ID or name of a group.
124
+ # @param [String] key The key of a variable.
125
+ # @return [Gitlab::ObjectifiedHash] The variable.
126
+ def remove_group_variable(group, key)
127
+ delete("/groups/#{url_encode group}/variables/#{key}")
128
+ end
127
129
  end
128
130
  end