gitlab 4.5.0 → 4.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/.github/stale.yml +18 -0
  3. data/.rubocop_todo.yml +46 -0
  4. data/Gemfile +2 -0
  5. data/README.md +22 -22
  6. data/Rakefile +3 -5
  7. data/bin/console +1 -0
  8. data/exe/gitlab +5 -1
  9. data/gitlab.gemspec +9 -6
  10. data/lib/gitlab.rb +6 -3
  11. data/lib/gitlab/api.rb +5 -3
  12. data/lib/gitlab/cli.rb +11 -5
  13. data/lib/gitlab/cli_helpers.rb +31 -22
  14. data/lib/gitlab/client.rb +7 -8
  15. data/lib/gitlab/client/access_requests.rb +100 -93
  16. data/lib/gitlab/client/award_emojis.rb +127 -127
  17. data/lib/gitlab/client/boards.rb +82 -82
  18. data/lib/gitlab/client/branches.rb +89 -89
  19. data/lib/gitlab/client/build_variables.rb +117 -117
  20. data/lib/gitlab/client/builds.rb +98 -98
  21. data/lib/gitlab/client/commits.rb +154 -154
  22. data/lib/gitlab/client/deployments.rb +29 -29
  23. data/lib/gitlab/client/environments.rb +80 -80
  24. data/lib/gitlab/client/events.rb +54 -54
  25. data/lib/gitlab/client/group_milestones.rb +85 -86
  26. data/lib/gitlab/client/groups.rb +178 -178
  27. data/lib/gitlab/client/issues.rb +195 -196
  28. data/lib/gitlab/client/jobs.rb +150 -150
  29. data/lib/gitlab/client/keys.rb +14 -14
  30. data/lib/gitlab/client/labels.rb +79 -79
  31. data/lib/gitlab/client/merge_request_approvals.rb +102 -102
  32. data/lib/gitlab/client/merge_requests.rb +281 -256
  33. data/lib/gitlab/client/milestones.rb +85 -85
  34. data/lib/gitlab/client/namespaces.rb +18 -18
  35. data/lib/gitlab/client/notes.rb +260 -260
  36. data/lib/gitlab/client/pipeline_schedules.rb +123 -123
  37. data/lib/gitlab/client/pipeline_triggers.rb +93 -93
  38. data/lib/gitlab/client/pipelines.rb +62 -62
  39. data/lib/gitlab/client/projects.rb +526 -505
  40. data/lib/gitlab/client/repositories.rb +68 -55
  41. data/lib/gitlab/client/repository_files.rb +103 -103
  42. data/lib/gitlab/client/runners.rb +113 -115
  43. data/lib/gitlab/client/services.rb +46 -45
  44. data/lib/gitlab/client/sidekiq.rb +32 -32
  45. data/lib/gitlab/client/snippets.rb +86 -86
  46. data/lib/gitlab/client/system_hooks.rb +57 -57
  47. data/lib/gitlab/client/tags.rb +87 -88
  48. data/lib/gitlab/client/todos.rb +41 -41
  49. data/lib/gitlab/client/users.rb +242 -228
  50. data/lib/gitlab/client/versions.rb +16 -0
  51. data/lib/gitlab/configuration.rb +7 -5
  52. data/lib/gitlab/error.rb +3 -1
  53. data/lib/gitlab/file_response.rb +4 -2
  54. data/lib/gitlab/help.rb +9 -9
  55. data/lib/gitlab/objectified_hash.rb +5 -4
  56. data/lib/gitlab/page_links.rb +9 -7
  57. data/lib/gitlab/paginated_response.rb +14 -4
  58. data/lib/gitlab/request.rb +8 -5
  59. data/lib/gitlab/shell.rb +6 -4
  60. data/lib/gitlab/shell_history.rb +7 -5
  61. data/lib/gitlab/version.rb +3 -1
  62. metadata +8 -5
@@ -1,59 +1,72 @@
1
- class Gitlab::Client
2
- # Defines methods related to repositories.
3
- # @see https://docs.gitlab.com/ce/api/repositories.html
4
- module Repositories
5
- # Get file tree project (root level).
6
- #
7
- # @example
8
- # Gitlab.tree(42)
9
- # Gitlab.tree(42, { path: 'Gemfile' })
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 [String] :path The path inside repository.
14
- # @option options [String] :ref_name The name of a repository branch or tag.
15
- # @return [Gitlab::ObjectifiedHash]
16
- def tree(project, options={})
17
- get("/projects/#{url_encode project}/repository/tree", query: options)
18
- end
19
- alias_method :repo_tree, :tree
1
+ # frozen_string_literal: true
20
2
 
21
- # Get project repository archive
22
- #
23
- # @example
24
- # Gitlab.repo_archive(42)
25
- # Gitlab.repo_archive(42, 'deadbeef')
26
- #
27
- # @param [Integer, String] project The ID or name of a project.
28
- # @param [String] ref The commit sha, branch, or tag to download.
29
- # @return [Gitlab::FileResponse]
30
- def repo_archive(project, ref = 'master')
31
- get("/projects/#{url_encode project}/repository/archive",
32
- format: nil,
33
- headers: { Accept: 'application/octet-stream' },
34
- query: { sha: ref },
35
- parser: proc { |body, _|
36
- if body.encoding == Encoding::ASCII_8BIT # binary response
37
- ::Gitlab::FileResponse.new StringIO.new(body, 'rb+')
38
- else # error with json response
39
- ::Gitlab::Request.parse(body)
40
- end
41
- })
42
- end
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
21
+
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
44
+
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
43
59
 
44
- # Compares branches, tags or commits.
45
- #
46
- # @example
47
- # Gitlab.compare(42, 'master', 'feature/branch')
48
- # Gitlab.repo_compare(42, 'master', 'feature/branch')
49
- #
50
- # @param [Integer] project The ID of a project.
51
- # @param [String] from The commit SHA or branch name of from branch.
52
- # @param [String] to The commit SHA or branch name of to branch.
53
- # @return [Gitlab::ObjectifiedHash]
54
- def compare(project, from, to)
55
- get("/projects/#{url_encode project}/repository/compare", query: { from: from, to: to })
56
- end
57
- alias_method :repo_compare, :compare
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 })
58
71
  end
59
72
  end
@@ -1,113 +1,113 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'base64'
2
4
 
3
- class Gitlab::Client
4
- # Defines methods related to repository files.
5
- # @see https://docs.gitlab.com/ce/api/repository_files.html
6
- module RepositoryFiles
7
- # Get the contents of a file
8
- #
9
- # @example
10
- # Gitlab.file_contents(42, 'Gemfile')
11
- # Gitlab.repo_file_contents(3, 'Gemfile', 'ed899a2f4b50b4370feeea94676502b42383c746')
12
- #
13
- # @param [Integer, String] project The ID or name of a project.
14
- # @param [String] filepath The relative path of the file in the repository
15
- # @param [String] ref The name of a repository branch or tag or if not given the default branch.
16
- # @return [String]
17
- def file_contents(project, filepath, ref='master')
18
- get "/projects/#{url_encode project}/repository/files/#{url_encode filepath}/raw",
19
- query: { ref: ref},
20
- format: nil,
21
- headers: { Accept: 'text/plain' },
22
- parser: ::Gitlab::Request::Parser
23
- end
24
- alias_method :repo_file_contents, :file_contents
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
25
26
 
26
- # Gets a repository file.
27
- #
28
- # @example
29
- # Gitlab.get_file(42, "README.md", "master")
30
- #
31
- # @param [Integer, String] project The ID or name of a project.
32
- # @param [String] file_path The full path of the file.
33
- # @param [String] ref The name of branch, tag or commit.
34
- # @return [Gitlab::ObjectifiedHash]
35
- def get_file(project, file_path, ref)
36
- get("/projects/#{url_encode project}/repository/files/#{url_encode file_path}", query: {
37
- ref: ref
38
- })
39
- end
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
40
41
 
41
- # Creates a new repository file.
42
- #
43
- # @example
44
- # Gitlab.create_file(42, "path", "branch", "content", "commit message")
45
- #
46
- # @param [Integer, String] project The ID or name of a project.
47
- # @param [String] path full path to new file.
48
- # @param [String] branch the name of the branch.
49
- # @param [String] content file content.
50
- # @param [String] commit_message ...commit message.
51
- # @param [Hash] options Optional additional details for commit
52
- # @option options [String] :author_name Commit author's name
53
- # @option options [String] :author_email Commit author's email address
54
- # @return [Gitlab::ObjectifiedHash]
55
- def create_file(project, path, branch, content, commit_message, options = {})
56
- post("/projects/#{url_encode project}/repository/files/#{url_encode path}", body: {
57
- branch: branch,
58
- commit_message: commit_message
59
- }.merge(options).merge(encoded_content_attributes(content)))
60
- end
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
61
62
 
62
- # Edits an existing repository file.
63
- #
64
- # @example
65
- # Gitlab.edit_file(42, "path", "branch", "content", "commit message")
66
- #
67
- # @param [Integer, String] project The ID or name of a project.
68
- # @param [String] path full path of file to update.
69
- # @param [String] branch the name of the branch to commit changes to.
70
- # @param [String] content new file content.
71
- # @param [String] commit_message ...commit message.
72
- # @param [Hash] options Optional additional details for commit
73
- # @option options [String] :author_name Commit author's name
74
- # @option options [String] :author_email Commit author's email address
75
- # @return [Gitlab::ObjectifiedHash]
76
- def edit_file(project, path, branch, content, commit_message, options = {})
77
- put("/projects/#{url_encode project}/repository/files/#{url_encode path}", body: {
78
- branch: branch,
79
- commit_message: commit_message
80
- }.merge(options).merge(encoded_content_attributes(content)))
81
- end
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
82
83
 
83
- # Removes an existing repository file.
84
- #
85
- # @example
86
- # Gitlab.remove_file(42, "path", "branch", "commit message")
87
- #
88
- # @param [Integer, String] project The ID or name of a project.
89
- # @param [String] path full path of file to delete.
90
- # @param [String] branch the name of the branch to commit the deletion to.
91
- # @param [String] commit_message ...a commit message ;)
92
- # @param [Hash] options Optional additional details for commit
93
- # @option options [String] :author_name Commit author's name
94
- # @option options [String] :author_email Commit author's email address
95
- # @return [Gitlab::ObjectifiedHash]
96
- def remove_file(project, path, branch, commit_message, options = {})
97
- delete("/projects/#{url_encode project}/repository/files/#{url_encode path}",
98
- body: {
99
- branch: branch,
100
- commit_message: commit_message
101
- }.merge(options))
102
- end
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
103
104
 
104
- private
105
+ private
105
106
 
106
- def encoded_content_attributes(content)
107
- {
108
- encoding: 'base64',
109
- content: Base64.encode64(content)
110
- }
111
- end
107
+ def encoded_content_attributes(content)
108
+ {
109
+ encoding: 'base64',
110
+ content: Base64.encode64(content)
111
+ }
112
112
  end
113
113
  end
@@ -1,126 +1,124 @@
1
- class Gitlab::Client
2
- # Defines methods related to runners.
3
- # @see https://docs.gitlab.com/ce/api/runners.html
4
- module Runners
1
+ # frozen_string_literal: true
5
2
 
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
20
-
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
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
33
20
 
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
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
45
33
 
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
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
62
45
 
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
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
74
62
 
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
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
85
74
 
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
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
97
85
 
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
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
111
97
 
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}")
123
- end
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
124
111
 
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}")
125
123
  end
126
124
  end