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,72 +1,74 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Defines methods related to repositories.
4
- # @see https://docs.gitlab.com/ce/api/repositories.html
5
- module Repositories
6
- # Get file tree project (root level).
7
- #
8
- # @example
9
- # Gitlab.tree(42)
10
- # Gitlab.tree(42, { path: 'Gemfile' })
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 [String] :path The path inside repository.
15
- # @option options [String] :ref_name The name of a repository branch or tag.
16
- # @return [Gitlab::ObjectifiedHash]
17
- def tree(project, options = {})
18
- get("/projects/#{url_encode project}/repository/tree", query: options)
19
- end
20
- alias repo_tree tree
3
+ class Gitlab::Client
4
+ # Defines methods related to repositories.
5
+ # @see https://docs.gitlab.com/ce/api/repositories.html
6
+ module Repositories
7
+ # Get file tree project (root level).
8
+ #
9
+ # @example
10
+ # Gitlab.tree(42)
11
+ # Gitlab.tree(42, { path: 'Gemfile' })
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 [String] :path The path inside repository.
16
+ # @option options [String] :ref_name The name of a repository branch or tag.
17
+ # @return [Gitlab::ObjectifiedHash]
18
+ def tree(project, options = {})
19
+ get("/projects/#{url_encode project}/repository/tree", query: options)
20
+ end
21
+ alias repo_tree tree
21
22
 
22
- # Get project repository archive
23
- #
24
- # @example
25
- # Gitlab.repo_archive(42)
26
- # Gitlab.repo_archive(42, 'deadbeef')
27
- #
28
- # @param [Integer, String] project The ID or name of a project.
29
- # @param [String] ref The commit sha, branch, or tag to download.
30
- # @return [Gitlab::FileResponse]
31
- def repo_archive(project, ref = 'master')
32
- get("/projects/#{url_encode project}/repository/archive",
33
- format: nil,
34
- headers: { Accept: 'application/octet-stream' },
35
- query: { sha: ref },
36
- parser: proc { |body, _|
37
- if body.encoding == Encoding::ASCII_8BIT # binary response
38
- ::Gitlab::FileResponse.new StringIO.new(body, 'rb+')
39
- else # error with json response
40
- ::Gitlab::Request.parse(body)
41
- end
42
- })
43
- end
23
+ # Get project repository archive
24
+ #
25
+ # @example
26
+ # Gitlab.repo_archive(42)
27
+ # Gitlab.repo_archive(42, 'deadbeef')
28
+ #
29
+ # @param [Integer, String] project The ID or name of a project.
30
+ # @param [String] ref The commit sha, branch, or tag to download.
31
+ # @return [Gitlab::FileResponse]
32
+ def repo_archive(project, ref = 'master')
33
+ get("/projects/#{url_encode project}/repository/archive",
34
+ format: nil,
35
+ headers: { Accept: 'application/octet-stream' },
36
+ query: { sha: ref },
37
+ parser: proc { |body, _|
38
+ if body.encoding == Encoding::ASCII_8BIT # binary response
39
+ ::Gitlab::FileResponse.new StringIO.new(body, 'rb+')
40
+ else # error with json response
41
+ ::Gitlab::Request.parse(body)
42
+ end
43
+ })
44
+ end
44
45
 
45
- # Compares branches, tags or commits.
46
- #
47
- # @example
48
- # Gitlab.compare(42, 'master', 'feature/branch')
49
- # Gitlab.repo_compare(42, 'master', 'feature/branch')
50
- #
51
- # @param [Integer] project The ID of a project.
52
- # @param [String] from The commit SHA or branch name of from branch.
53
- # @param [String] to The commit SHA or branch name of to branch.
54
- # @return [Gitlab::ObjectifiedHash]
55
- def compare(project, from, to)
56
- get("/projects/#{url_encode project}/repository/compare", query: { from: from, to: to })
57
- end
58
- alias repo_compare compare
46
+ # Compares branches, tags or commits.
47
+ #
48
+ # @example
49
+ # Gitlab.compare(42, 'master', 'feature/branch')
50
+ # Gitlab.repo_compare(42, 'master', 'feature/branch')
51
+ #
52
+ # @param [Integer] project The ID of a project.
53
+ # @param [String] from The commit SHA or branch name of from branch.
54
+ # @param [String] to The commit SHA or branch name of to branch.
55
+ # @return [Gitlab::ObjectifiedHash]
56
+ def compare(project, from, to)
57
+ get("/projects/#{url_encode project}/repository/compare", query: { from: from, to: to })
58
+ end
59
+ alias repo_compare compare
59
60
 
60
- # Get the common ancestor for 2 refs (commit SHAs, branch names or tags).
61
- #
62
- # @example
63
- # Gitlab.merge_base(42, ['master', 'feature/branch'])
64
- # Gitlab.merge_base(42, ['master', 'feature/branch'])
65
- #
66
- # @param [Integer, String] project The ID or URL-encoded path of the project.
67
- # @param [Array] refs Array containing 2 commit SHAs, branch names, or tags.
68
- # @return [Gitlab::ObjectifiedHash]
69
- def merge_base(project, refs)
70
- get("/projects/#{url_encode project}/repository/merge_base", query: { refs: refs })
61
+ # Get the common ancestor for 2 refs (commit SHAs, branch names or tags).
62
+ #
63
+ # @example
64
+ # Gitlab.merge_base(42, ['master', 'feature/branch'])
65
+ # Gitlab.merge_base(42, ['master', 'feature/branch'])
66
+ #
67
+ # @param [Integer, String] project The ID or URL-encoded path of the project.
68
+ # @param [Array] refs Array containing 2 commit SHAs, branch names, or tags.
69
+ # @return [Gitlab::ObjectifiedHash]
70
+ def merge_base(project, refs)
71
+ get("/projects/#{url_encode project}/repository/merge_base", query: { refs: refs })
72
+ end
71
73
  end
72
74
  end
@@ -2,112 +2,114 @@
2
2
 
3
3
  require 'base64'
4
4
 
5
- # Defines methods related to repository files.
6
- # @see https://docs.gitlab.com/ce/api/repository_files.html
7
- module RepositoryFiles
8
- # Get the contents of a file
9
- #
10
- # @example
11
- # Gitlab.file_contents(42, 'Gemfile')
12
- # Gitlab.repo_file_contents(3, 'Gemfile', 'ed899a2f4b50b4370feeea94676502b42383c746')
13
- #
14
- # @param [Integer, String] project The ID or name of a project.
15
- # @param [String] filepath The relative path of the file in the repository
16
- # @param [String] ref The name of a repository branch or tag or if not given the default branch.
17
- # @return [String]
18
- def file_contents(project, filepath, ref = 'master')
19
- get "/projects/#{url_encode project}/repository/files/#{url_encode filepath}/raw",
20
- query: { ref: ref },
21
- format: nil,
22
- headers: { Accept: 'text/plain' },
23
- parser: ::Gitlab::Request::Parser
24
- end
25
- alias repo_file_contents file_contents
5
+ class Gitlab::Client
6
+ # Defines methods related to repository files.
7
+ # @see https://docs.gitlab.com/ce/api/repository_files.html
8
+ module RepositoryFiles
9
+ # Get the contents of a file
10
+ #
11
+ # @example
12
+ # Gitlab.file_contents(42, 'Gemfile')
13
+ # Gitlab.repo_file_contents(3, 'Gemfile', 'ed899a2f4b50b4370feeea94676502b42383c746')
14
+ #
15
+ # @param [Integer, String] project The ID or name of a project.
16
+ # @param [String] filepath The relative path of the file in the repository
17
+ # @param [String] ref The name of a repository branch or tag or if not given the default branch.
18
+ # @return [String]
19
+ def file_contents(project, filepath, ref = 'master')
20
+ get "/projects/#{url_encode project}/repository/files/#{url_encode filepath}/raw",
21
+ query: { ref: ref },
22
+ format: nil,
23
+ headers: { Accept: 'text/plain' },
24
+ parser: ::Gitlab::Request::Parser
25
+ end
26
+ alias repo_file_contents file_contents
26
27
 
27
- # Gets a repository file.
28
- #
29
- # @example
30
- # Gitlab.get_file(42, "README.md", "master")
31
- #
32
- # @param [Integer, String] project The ID or name of a project.
33
- # @param [String] file_path The full path of the file.
34
- # @param [String] ref The name of branch, tag or commit.
35
- # @return [Gitlab::ObjectifiedHash]
36
- def get_file(project, file_path, ref)
37
- get("/projects/#{url_encode project}/repository/files/#{url_encode file_path}", query: {
38
- ref: ref
39
- })
40
- end
28
+ # Gets a repository file.
29
+ #
30
+ # @example
31
+ # Gitlab.get_file(42, "README.md", "master")
32
+ #
33
+ # @param [Integer, String] project The ID or name of a project.
34
+ # @param [String] file_path The full path of the file.
35
+ # @param [String] ref The name of branch, tag or commit.
36
+ # @return [Gitlab::ObjectifiedHash]
37
+ def get_file(project, file_path, ref)
38
+ get("/projects/#{url_encode project}/repository/files/#{url_encode file_path}", query: {
39
+ ref: ref
40
+ })
41
+ end
41
42
 
42
- # Creates a new repository file.
43
- #
44
- # @example
45
- # Gitlab.create_file(42, "path", "branch", "content", "commit message")
46
- #
47
- # @param [Integer, String] project The ID or name of a project.
48
- # @param [String] path full path to new file.
49
- # @param [String] branch the name of the branch.
50
- # @param [String] content file content.
51
- # @param [String] commit_message ...commit message.
52
- # @param [Hash] options Optional additional details for commit
53
- # @option options [String] :author_name Commit author's name
54
- # @option options [String] :author_email Commit author's email address
55
- # @return [Gitlab::ObjectifiedHash]
56
- def create_file(project, path, branch, content, commit_message, options = {})
57
- post("/projects/#{url_encode project}/repository/files/#{url_encode path}", body: {
58
- branch: branch,
59
- commit_message: commit_message
60
- }.merge(options).merge(encoded_content_attributes(content)))
61
- end
43
+ # Creates a new repository file.
44
+ #
45
+ # @example
46
+ # Gitlab.create_file(42, "path", "branch", "content", "commit message")
47
+ #
48
+ # @param [Integer, String] project The ID or name of a project.
49
+ # @param [String] path full path to new file.
50
+ # @param [String] branch the name of the branch.
51
+ # @param [String] content file content.
52
+ # @param [String] commit_message ...commit message.
53
+ # @param [Hash] options Optional additional details for commit
54
+ # @option options [String] :author_name Commit author's name
55
+ # @option options [String] :author_email Commit author's email address
56
+ # @return [Gitlab::ObjectifiedHash]
57
+ def create_file(project, path, branch, content, commit_message, options = {})
58
+ post("/projects/#{url_encode project}/repository/files/#{url_encode path}", body: {
59
+ branch: branch,
60
+ commit_message: commit_message
61
+ }.merge(options).merge(encoded_content_attributes(content)))
62
+ end
62
63
 
63
- # Edits an existing repository file.
64
- #
65
- # @example
66
- # Gitlab.edit_file(42, "path", "branch", "content", "commit message")
67
- #
68
- # @param [Integer, String] project The ID or name of a project.
69
- # @param [String] path full path of file to update.
70
- # @param [String] branch the name of the branch to commit changes to.
71
- # @param [String] content new file content.
72
- # @param [String] commit_message ...commit message.
73
- # @param [Hash] options Optional additional details for commit
74
- # @option options [String] :author_name Commit author's name
75
- # @option options [String] :author_email Commit author's email address
76
- # @return [Gitlab::ObjectifiedHash]
77
- def edit_file(project, path, branch, content, commit_message, options = {})
78
- put("/projects/#{url_encode project}/repository/files/#{url_encode path}", body: {
79
- branch: branch,
80
- commit_message: commit_message
81
- }.merge(options).merge(encoded_content_attributes(content)))
82
- end
64
+ # Edits an existing repository file.
65
+ #
66
+ # @example
67
+ # Gitlab.edit_file(42, "path", "branch", "content", "commit message")
68
+ #
69
+ # @param [Integer, String] project The ID or name of a project.
70
+ # @param [String] path full path of file to update.
71
+ # @param [String] branch the name of the branch to commit changes to.
72
+ # @param [String] content new file content.
73
+ # @param [String] commit_message ...commit message.
74
+ # @param [Hash] options Optional additional details for commit
75
+ # @option options [String] :author_name Commit author's name
76
+ # @option options [String] :author_email Commit author's email address
77
+ # @return [Gitlab::ObjectifiedHash]
78
+ def edit_file(project, path, branch, content, commit_message, options = {})
79
+ put("/projects/#{url_encode project}/repository/files/#{url_encode path}", body: {
80
+ branch: branch,
81
+ commit_message: commit_message
82
+ }.merge(options).merge(encoded_content_attributes(content)))
83
+ end
83
84
 
84
- # Removes an existing repository file.
85
- #
86
- # @example
87
- # Gitlab.remove_file(42, "path", "branch", "commit message")
88
- #
89
- # @param [Integer, String] project The ID or name of a project.
90
- # @param [String] path full path of file to delete.
91
- # @param [String] branch the name of the branch to commit the deletion to.
92
- # @param [String] commit_message ...a commit message ;)
93
- # @param [Hash] options Optional additional details for commit
94
- # @option options [String] :author_name Commit author's name
95
- # @option options [String] :author_email Commit author's email address
96
- # @return [Gitlab::ObjectifiedHash]
97
- def remove_file(project, path, branch, commit_message, options = {})
98
- delete("/projects/#{url_encode project}/repository/files/#{url_encode path}",
99
- body: {
100
- branch: branch,
101
- commit_message: commit_message
102
- }.merge(options))
103
- end
85
+ # Removes an existing repository file.
86
+ #
87
+ # @example
88
+ # Gitlab.remove_file(42, "path", "branch", "commit message")
89
+ #
90
+ # @param [Integer, String] project The ID or name of a project.
91
+ # @param [String] path full path of file to delete.
92
+ # @param [String] branch the name of the branch to commit the deletion to.
93
+ # @param [String] commit_message ...a commit message ;)
94
+ # @param [Hash] options Optional additional details for commit
95
+ # @option options [String] :author_name Commit author's name
96
+ # @option options [String] :author_email Commit author's email address
97
+ # @return [Gitlab::ObjectifiedHash]
98
+ def remove_file(project, path, branch, commit_message, options = {})
99
+ delete("/projects/#{url_encode project}/repository/files/#{url_encode path}",
100
+ body: {
101
+ branch: branch,
102
+ commit_message: commit_message
103
+ }.merge(options))
104
+ end
104
105
 
105
- private
106
+ private
106
107
 
107
- def encoded_content_attributes(content)
108
- {
109
- encoding: 'base64',
110
- content: Base64.encode64(content)
111
- }
108
+ def encoded_content_attributes(content)
109
+ {
110
+ encoding: 'base64',
111
+ content: Base64.encode64(content)
112
+ }
113
+ end
112
114
  end
113
115
  end
@@ -1,124 +1,126 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Defines methods related to runners.
4
- # @see https://docs.gitlab.com/ce/api/runners.html
5
- module Runners
6
- # Get a list of specific runners available to the user.
7
- # @see https://docs.gitlab.com/ce/api/runners.html#list-owned-runners
8
- #
9
- # @example
10
- # Gitlab.runners
11
- # Gitlab.runners(:active)
12
- # Gitlab.runners(:paused)
13
- #
14
- # @param [Hash] options A customizable set of options.
15
- # @option options [String] :scope The scope of specific runners to show, one of: active, paused, online; showing all runners if none provided
16
- # @return [Array<Gitlab::ObjectifiedHash>]
17
- def runners(options = {})
18
- get('/runners', query: options)
19
- end
3
+ class Gitlab::Client
4
+ # Defines methods related to runners.
5
+ # @see https://docs.gitlab.com/ce/api/runners.html
6
+ module Runners
7
+ # Get a list of specific runners available to the user.
8
+ # @see https://docs.gitlab.com/ce/api/runners.html#list-owned-runners
9
+ #
10
+ # @example
11
+ # Gitlab.runners
12
+ # Gitlab.runners(:active)
13
+ # Gitlab.runners(:paused)
14
+ #
15
+ # @param [Hash] options A customizable set of options.
16
+ # @option options [String] :scope The scope of specific runners to show, one of: active, paused, online; showing all runners if none provided
17
+ # @return [Array<Gitlab::ObjectifiedHash>]
18
+ def runners(options = {})
19
+ get('/runners', query: options)
20
+ end
20
21
 
21
- # Get a list of all runners in the GitLab instance (specific and shared). Access is restricted to users with admin privileges.
22
- # @see https://docs.gitlab.com/ce/api/runners.html#list-all-runners
23
- #
24
- # @example
25
- # Gitlab.all_runners
26
- #
27
- # @param [Hash] options A customizable set of options.
28
- # @option options [String] :scope The scope of runners to show, one of: specific, shared, active, paused, online; showing all runners if none provided
29
- # @return [Array<Gitlab::ObjectifiedHash>]
30
- def all_runners(options = {})
31
- get('/runners/all', query: options)
32
- end
22
+ # Get a list of all runners in the GitLab instance (specific and shared). Access is restricted to users with admin privileges.
23
+ # @see https://docs.gitlab.com/ce/api/runners.html#list-all-runners
24
+ #
25
+ # @example
26
+ # Gitlab.all_runners
27
+ #
28
+ # @param [Hash] options A customizable set of options.
29
+ # @option options [String] :scope The scope of runners to show, one of: specific, shared, active, paused, online; showing all runners if none provided
30
+ # @return [Array<Gitlab::ObjectifiedHash>]
31
+ def all_runners(options = {})
32
+ get('/runners/all', query: options)
33
+ end
33
34
 
34
- # Get details of a runner..
35
- # @see https://docs.gitlab.com/ce/api/runners.html#get-runners-details
36
- #
37
- # @example
38
- # Gitlab.runner(42)
39
- #
40
- # @param [Integer, String] id The ID of a runner
41
- # @return <Gitlab::ObjectifiedHash>
42
- def runner(id)
43
- get("/runners/#{id}")
44
- end
35
+ # Get details of a runner..
36
+ # @see https://docs.gitlab.com/ce/api/runners.html#get-runners-details
37
+ #
38
+ # @example
39
+ # Gitlab.runner(42)
40
+ #
41
+ # @param [Integer, String] id The ID of a runner
42
+ # @return <Gitlab::ObjectifiedHash>
43
+ def runner(id)
44
+ get("/runners/#{id}")
45
+ end
45
46
 
46
- # Update details of a runner.
47
- # @see https://docs.gitlab.com/ce/api/runners.html#update-runners-details
48
- #
49
- # @example
50
- # Gitlab.update_runner(42, { description: 'Awesome runner' })
51
- # Gitlab.update_runner(42, { active: false })
52
- # Gitlab.update_runner(42, { tag_list: [ 'awesome', 'runner' ] })
53
- #
54
- # @param [Integer, String] id The ID of a runner
55
- # @param [Hash] options A customizable set of options.
56
- # @option options [String] :active The state of a runner; can be set to true or false.
57
- # @option options [String] :tag_list The list of tags for a runner; put array of tags, that should be finally assigned to a runner
58
- # @return <Gitlab::ObjectifiedHash>
59
- def update_runner(id, options = {})
60
- put("/runners/#{id}", query: options)
61
- end
47
+ # Update details of a runner.
48
+ # @see https://docs.gitlab.com/ce/api/runners.html#update-runners-details
49
+ #
50
+ # @example
51
+ # Gitlab.update_runner(42, { description: 'Awesome runner' })
52
+ # Gitlab.update_runner(42, { active: false })
53
+ # Gitlab.update_runner(42, { tag_list: [ 'awesome', 'runner' ] })
54
+ #
55
+ # @param [Integer, String] id The ID of a runner
56
+ # @param [Hash] options A customizable set of options.
57
+ # @option options [String] :active The state of a runner; can be set to true or false.
58
+ # @option options [String] :tag_list The list of tags for a runner; put array of tags, that should be finally assigned to a runner
59
+ # @return <Gitlab::ObjectifiedHash>
60
+ def update_runner(id, options = {})
61
+ put("/runners/#{id}", query: options)
62
+ end
62
63
 
63
- # Remove a runner.
64
- # @see https://docs.gitlab.com/ce/api/runners.html#remove-a-runner
65
- #
66
- # @example
67
- # Gitlab.delete_runner(42)
68
- #
69
- # @param [Integer, String] id The ID of a runner
70
- # @return <Gitlab::ObjectifiedHash>
71
- def delete_runner(id)
72
- delete("/runners/#{id}")
73
- end
64
+ # Remove a runner.
65
+ # @see https://docs.gitlab.com/ce/api/runners.html#remove-a-runner
66
+ #
67
+ # @example
68
+ # Gitlab.delete_runner(42)
69
+ #
70
+ # @param [Integer, String] id The ID of a runner
71
+ # @return <Gitlab::ObjectifiedHash>
72
+ def delete_runner(id)
73
+ delete("/runners/#{id}")
74
+ end
74
75
 
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
76
+ # Gets a list of Jobs for a Runner
77
+ #
78
+ # @example
79
+ # Gitlab.runner_jobs(1)
80
+ #
81
+ # @param [Integer] id The ID of a runner.
82
+ # @return [Array<Gitlab::ObjectifiedHash>]
83
+ def runner_jobs(runner_id)
84
+ get("/runners/#{url_encode runner_id}/jobs")
85
+ end
85
86
 
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.
87
- # @see https://docs.gitlab.com/ce/api/runners.html#list-projects-runners
88
- #
89
- # @example
90
- # Gitlab.project_runners(42)
91
- #
92
- # @param [Integer, String] id The ID or name of a project.
93
- # @return [Array<Gitlab::ObjectifiedHash>]
94
- def project_runners(project_id)
95
- get("/projects/#{url_encode project_id}/runners")
96
- end
87
+ # 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.
88
+ # @see https://docs.gitlab.com/ce/api/runners.html#list-projects-runners
89
+ #
90
+ # @example
91
+ # Gitlab.project_runners(42)
92
+ #
93
+ # @param [Integer, String] id The ID or name of a project.
94
+ # @return [Array<Gitlab::ObjectifiedHash>]
95
+ def project_runners(project_id)
96
+ get("/projects/#{url_encode project_id}/runners")
97
+ end
97
98
 
98
- # Enable an available specific runner in the project.
99
- # @see https://docs.gitlab.com/ce/api/runners.html#enable-a-runner-in-project
100
- #
101
- # @example
102
- # Gitlab.project_enable_runner(2, 42)
103
- #
104
- # @param [Integer, String] id The ID or name of a project.
105
- # @param [Integer, String] id The ID of a runner.
106
- # @return <Gitlab::ObjectifiedHash>
107
- def project_enable_runner(project_id, id)
108
- body = { runner_id: id }
109
- post("/projects/#{url_encode project_id}/runners", body: body)
110
- end
99
+ # Enable an available specific runner in the project.
100
+ # @see https://docs.gitlab.com/ce/api/runners.html#enable-a-runner-in-project
101
+ #
102
+ # @example
103
+ # Gitlab.project_enable_runner(2, 42)
104
+ #
105
+ # @param [Integer, String] id The ID or name of a project.
106
+ # @param [Integer, String] id The ID of a runner.
107
+ # @return <Gitlab::ObjectifiedHash>
108
+ def project_enable_runner(project_id, id)
109
+ body = { runner_id: id }
110
+ post("/projects/#{url_encode project_id}/runners", body: body)
111
+ end
111
112
 
112
- # Disable a specific runner from the project. It works only if the project isn't the only project associated with the specified runner.
113
- # @see https://docs.gitlab.com/ce/api/runners.html#disable-a-runner-from-project
114
- #
115
- # @example
116
- # Gitlab.project_disable_runner(2, 42)
117
- #
118
- # @param [Integer, String] id The ID or name of a project.
119
- # @param [Integer, String] runner_id The ID of a runner.
120
- # @return <Gitlab::ObjectifiedHash>
121
- def project_disable_runner(id, runner_id)
122
- delete("/projects/#{url_encode id}/runners/#{runner_id}")
113
+ # Disable a specific runner from the project. It works only if the project isn't the only project associated with the specified runner.
114
+ # @see https://docs.gitlab.com/ce/api/runners.html#disable-a-runner-from-project
115
+ #
116
+ # @example
117
+ # Gitlab.project_disable_runner(2, 42)
118
+ #
119
+ # @param [Integer, String] id The ID or name of a project.
120
+ # @param [Integer, String] runner_id The ID of a runner.
121
+ # @return <Gitlab::ObjectifiedHash>
122
+ def project_disable_runner(id, runner_id)
123
+ delete("/projects/#{url_encode id}/runners/#{runner_id}")
124
+ end
123
125
  end
124
126
  end