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,106 +1,106 @@
1
- class Gitlab::Client
2
- # Defines methods related to builds.
3
- # @see https://docs.gitlab.com/ce/api/builds.html
4
- module Builds
5
- # Gets a list of project builds.
6
- #
7
- # @example
8
- # Gitlab.builds(5)
9
- # Gitlab.builds(5, { per_page: 10, page: 2 })
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
- # @param [Integer, String] project The ID or name of a project.
16
- # @return [Array<Gitlab::ObjectifiedHash>]
17
- def builds(project, options={})
18
- get("/projects/#{url_encode project}/builds", query: options)
19
- end
1
+ # frozen_string_literal: true
20
2
 
21
- # Gets a single build.
22
- #
23
- # @example
24
- # Gitlab.build(5, 36)
25
- #
26
- # @param [Integer, String] project The ID or name of a project.
27
- # @param [Integer] id The ID of a build.
28
- # @return [Gitlab::ObjectifiedHash]
29
- def build(project, id)
30
- get("/projects/#{url_encode project}/builds/#{id}")
31
- end
3
+ # Defines methods related to builds.
4
+ # @see https://docs.gitlab.com/ce/api/builds.html
5
+ module Builds
6
+ # Gets a list of project builds.
7
+ #
8
+ # @example
9
+ # Gitlab.builds(5)
10
+ # Gitlab.builds(5, { per_page: 10, page: 2 })
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
+ # @param [Integer, String] project The ID or name of a project.
17
+ # @return [Array<Gitlab::ObjectifiedHash>]
18
+ def builds(project, options = {})
19
+ get("/projects/#{url_encode project}/builds", query: options)
20
+ end
32
21
 
33
- # Gets build artifacts.
34
- #
35
- # @example
36
- # Gitlab.build_artifacts(1, 8)
37
- #
38
- # @param [Integer, String] project The ID or name of a project.
39
- # @param [Integer] id The ID of a build.
40
- # @return [Gitlab::FileResponse]
41
- def build_artifacts(project, id)
42
- get("/projects/#{url_encode project}/builds/#{id}/artifacts",
43
- format: nil,
44
- headers: { Accept: 'application/octet-stream' },
45
- parser: proc { |body, _|
46
- if body.encoding == Encoding::ASCII_8BIT # binary response
47
- ::Gitlab::FileResponse.new StringIO.new(body, 'rb+')
48
- else # error with json response
49
- ::Gitlab::Request.parse(body)
50
- end
51
- })
52
- end
22
+ # Gets a single build.
23
+ #
24
+ # @example
25
+ # Gitlab.build(5, 36)
26
+ #
27
+ # @param [Integer, String] project The ID or name of a project.
28
+ # @param [Integer] id The ID of a build.
29
+ # @return [Gitlab::ObjectifiedHash]
30
+ def build(project, id)
31
+ get("/projects/#{url_encode project}/builds/#{id}")
32
+ end
53
33
 
54
- # Gets a list of builds for specific commit in a project.
55
- #
56
- # @example
57
- # Gitlab.commit_builds(5, 'asdf')
58
- # Gitlab.commit_builds(5, 'asdf', { per_page: 10, page: 2 })
59
- #
60
- # @param [Integer, String] project The ID or name of a project.
61
- # @param [String] sha The SHA checksum of a commit.
62
- # @param [Hash] options A customizable set of options.
63
- # @option options [Integer] :page The page number.
64
- # @option options [Integer] :per_page The number of results per page.
65
- # @return [Array<Gitlab::ObjectifiedHash>] The list of builds.
66
- def commit_builds(project, sha, options={})
67
- get("/projects/#{url_encode project}/repository/commits/#{sha}/builds", query: options)
68
- end
34
+ # Gets build artifacts.
35
+ #
36
+ # @example
37
+ # Gitlab.build_artifacts(1, 8)
38
+ #
39
+ # @param [Integer, String] project The ID or name of a project.
40
+ # @param [Integer] id The ID of a build.
41
+ # @return [Gitlab::FileResponse]
42
+ def build_artifacts(project, id)
43
+ get("/projects/#{url_encode project}/builds/#{id}/artifacts",
44
+ format: nil,
45
+ headers: { Accept: 'application/octet-stream' },
46
+ parser: proc { |body, _|
47
+ if body.encoding == Encoding::ASCII_8BIT # binary response
48
+ ::Gitlab::FileResponse.new StringIO.new(body, 'rb+')
49
+ else # error with json response
50
+ ::Gitlab::Request.parse(body)
51
+ end
52
+ })
53
+ end
69
54
 
70
- # Cancels a build.
71
- #
72
- # @example
73
- # Gitlab.build_cancel(5, 1)
74
- #
75
- # @param [Integer, String] project The ID or name of a project.
76
- # @param [Integer] id The ID of a build.
77
- # @return [Gitlab::ObjectifiedHash] The builds changes.
78
- def build_cancel(project, id)
79
- post("/projects/#{url_encode project}/builds/#{id}/cancel")
80
- end
55
+ # Gets a list of builds for specific commit in a project.
56
+ #
57
+ # @example
58
+ # Gitlab.commit_builds(5, 'asdf')
59
+ # Gitlab.commit_builds(5, 'asdf', { per_page: 10, page: 2 })
60
+ #
61
+ # @param [Integer, String] project The ID or name of a project.
62
+ # @param [String] sha The SHA checksum of a commit.
63
+ # @param [Hash] options A customizable set of options.
64
+ # @option options [Integer] :page The page number.
65
+ # @option options [Integer] :per_page The number of results per page.
66
+ # @return [Array<Gitlab::ObjectifiedHash>] The list of builds.
67
+ def commit_builds(project, sha, options = {})
68
+ get("/projects/#{url_encode project}/repository/commits/#{sha}/builds", query: options)
69
+ end
81
70
 
82
- # Retry a build.
83
- #
84
- # @example
85
- # Gitlab.build_retry(5, 1)
86
- #
87
- # @param [Integer, String] project The ID or name of a project.
88
- # @param [Integer] id The ID of a build.
89
- # @return [Array<Gitlab::ObjectifiedHash>] The builds changes.
90
- def build_retry(project, id)
91
- post("/projects/#{url_encode project}/builds/#{id}/retry")
92
- end
71
+ # Cancels a build.
72
+ #
73
+ # @example
74
+ # Gitlab.build_cancel(5, 1)
75
+ #
76
+ # @param [Integer, String] project The ID or name of a project.
77
+ # @param [Integer] id The ID of a build.
78
+ # @return [Gitlab::ObjectifiedHash] The builds changes.
79
+ def build_cancel(project, id)
80
+ post("/projects/#{url_encode project}/builds/#{id}/cancel")
81
+ end
82
+
83
+ # Retry a build.
84
+ #
85
+ # @example
86
+ # Gitlab.build_retry(5, 1)
87
+ #
88
+ # @param [Integer, String] project The ID or name of a project.
89
+ # @param [Integer] id The ID of a build.
90
+ # @return [Array<Gitlab::ObjectifiedHash>] The builds changes.
91
+ def build_retry(project, id)
92
+ post("/projects/#{url_encode project}/builds/#{id}/retry")
93
+ end
93
94
 
94
- # Erase a single build of a project (remove build artifacts and a build trace)
95
- #
96
- # @example
97
- # Gitlab.build_erase(5, 1)
98
- #
99
- # @param [Integer, String] project The ID or name of a project.
100
- # @param [Integer] id The ID of a build.
101
- # @return [Gitlab::ObjectifiedHash] The build's changes.
102
- def build_erase(project, id)
103
- post("/projects/#{url_encode project}/builds/#{id}/erase")
104
- end
95
+ # Erase a single build of a project (remove build artifacts and a build trace)
96
+ #
97
+ # @example
98
+ # Gitlab.build_erase(5, 1)
99
+ #
100
+ # @param [Integer, String] project The ID or name of a project.
101
+ # @param [Integer] id The ID of a build.
102
+ # @return [Gitlab::ObjectifiedHash] The build's changes.
103
+ def build_erase(project, id)
104
+ post("/projects/#{url_encode project}/builds/#{id}/erase")
105
105
  end
106
106
  end
@@ -1,164 +1,164 @@
1
- class Gitlab::Client
2
- # Defines methods related to repository commits.
3
- # @see https://docs.gitlab.com/ce/api/commits.html
4
- module Commits
5
- # Gets a list of project commits.
6
- #
7
- # @example
8
- # Gitlab.commits('viking')
9
- # Gitlab.repo_commits('gitlab', { ref_name: 'api' })
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] :ref_name The branch or tag name of a project repository.
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 commits(project, options={})
18
- get("/projects/#{url_encode project}/repository/commits", query: options)
19
- end
20
- alias_method :repo_commits, :commits
1
+ # frozen_string_literal: true
21
2
 
22
- # Gets a specific commit identified by the commit hash or name of a branch or tag.
23
- #
24
- # @example
25
- # Gitlab.commit(42, '6104942438c14ec7bd21c6cd5bd995272b3faff6')
26
- # Gitlab.repo_commit(3, 'ed899a2f4b50b4370feeea94676502b42383c746')
27
- #
28
- # @param [Integer, String] project The ID or name of a project.
29
- # @param [String] sha The commit hash or name of a repository branch or tag
30
- # @return [Gitlab::ObjectifiedHash]
31
- def commit(project, sha)
32
- get("/projects/#{url_encode project}/repository/commits/#{sha}")
33
- end
34
- alias_method :repo_commit, :commit
3
+ # Defines methods related to repository commits.
4
+ # @see https://docs.gitlab.com/ce/api/commits.html
5
+ module Commits
6
+ # Gets a list of project commits.
7
+ #
8
+ # @example
9
+ # Gitlab.commits('viking')
10
+ # Gitlab.repo_commits('gitlab', { ref_name: 'api' })
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] :ref_name The branch or tag name of a project repository.
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 commits(project, options = {})
19
+ get("/projects/#{url_encode project}/repository/commits", query: options)
20
+ end
21
+ alias repo_commits commits
35
22
 
36
- # Get the diff of a commit in a project.
37
- #
38
- # @example
39
- # Gitlab.commit_diff(42, '6104942438c14ec7bd21c6cd5bd995272b3faff6')
40
- # Gitlab.repo_commit_diff(3, 'ed899a2f4b50b4370feeea94676502b42383c746')
41
- #
42
- # @param [Integer, String] project The ID or name of a project.
43
- # @param [String] sha The name of a repository branch or tag or if not given the default branch.
44
- # @return [Gitlab::ObjectifiedHash]
45
- def commit_diff(project, sha)
46
- get("/projects/#{url_encode project}/repository/commits/#{sha}/diff")
47
- end
48
- alias_method :repo_commit_diff, :commit_diff
23
+ # Gets a specific commit identified by the commit hash or name of a branch or tag.
24
+ #
25
+ # @example
26
+ # Gitlab.commit(42, '6104942438c14ec7bd21c6cd5bd995272b3faff6')
27
+ # Gitlab.repo_commit(3, 'ed899a2f4b50b4370feeea94676502b42383c746')
28
+ #
29
+ # @param [Integer, String] project The ID or name of a project.
30
+ # @param [String] sha The commit hash or name of a repository branch or tag
31
+ # @return [Gitlab::ObjectifiedHash]
32
+ def commit(project, sha)
33
+ get("/projects/#{url_encode project}/repository/commits/#{sha}")
34
+ end
35
+ alias repo_commit commit
49
36
 
50
- # Gets a list of comments for a commit.
51
- #
52
- # @example
53
- # Gitlab.commit_comments(5, 'c9f9662a9b1116c838b523ed64c6abdb4aae4b8b')
54
- #
55
- # @param [Integer] project The ID of a project.
56
- # @param [String] sha The commit hash or name of a repository branch or tag.
57
- # @option options [Integer] :page The page number.
58
- # @option options [Integer] :per_page The number of results per page.
59
- # @return [Array<Gitlab::ObjectifiedHash>]
60
- def commit_comments(project, commit, options={})
61
- get("/projects/#{url_encode project}/repository/commits/#{commit}/comments", query: options)
62
- end
63
- alias_method :repo_commit_comments, :commit_comments
37
+ # Get the diff of a commit in a project.
38
+ #
39
+ # @example
40
+ # Gitlab.commit_diff(42, '6104942438c14ec7bd21c6cd5bd995272b3faff6')
41
+ # Gitlab.repo_commit_diff(3, 'ed899a2f4b50b4370feeea94676502b42383c746')
42
+ #
43
+ # @param [Integer, String] project The ID or name of a project.
44
+ # @param [String] sha The name of a repository branch or tag or if not given the default branch.
45
+ # @return [Gitlab::ObjectifiedHash]
46
+ def commit_diff(project, sha)
47
+ get("/projects/#{url_encode project}/repository/commits/#{sha}/diff")
48
+ end
49
+ alias repo_commit_diff commit_diff
64
50
 
65
- # Creates a new comment for a commit.
66
- #
67
- # @example
68
- # Gitlab.create_commit_comment(5, 'c9f9662a9b1116c838b523ed64c6abdb4aae4b8b', 'Nice work on this commit!')
69
- #
70
- # @param [Integer, String] project The ID or name of a project.
71
- # @param [String] sha The commit hash or name of a repository branch or tag.
72
- # @param [String] note The text of a comment.
73
- # @param [Hash] options A customizable set of options.
74
- # @option options [String] :path The file path.
75
- # @option options [Integer] :line The line number.
76
- # @option options [String] :line_type The line type (new or old).
77
- # @return [Gitlab::ObjectifiedHash] Information about created comment.
78
- def create_commit_comment(project, commit, note, options={})
79
- post("/projects/#{url_encode project}/repository/commits/#{commit}/comments", body: options.merge(note: note))
80
- end
81
- alias_method :repo_create_commit_comment, :create_commit_comment
51
+ # Gets a list of comments for a commit.
52
+ #
53
+ # @example
54
+ # Gitlab.commit_comments(5, 'c9f9662a9b1116c838b523ed64c6abdb4aae4b8b')
55
+ #
56
+ # @param [Integer] project The ID of a project.
57
+ # @param [String] sha The commit hash or name of a repository branch or tag.
58
+ # @option options [Integer] :page The page number.
59
+ # @option options [Integer] :per_page The number of results per page.
60
+ # @return [Array<Gitlab::ObjectifiedHash>]
61
+ def commit_comments(project, commit, options = {})
62
+ get("/projects/#{url_encode project}/repository/commits/#{commit}/comments", query: options)
63
+ end
64
+ alias repo_commit_comments commit_comments
82
65
 
83
- # Get the status of a commit
84
- #
85
- # @example
86
- # Gitlab.commit_status(42, '6104942438c14ec7bd21c6cd5bd995272b3faff6')
87
- # Gitlab.commit_status(42, '6104942438c14ec7bd21c6cd5bd995272b3faff6', { name: 'jenkins' })
88
- # Gitlab.commit_status(42, '6104942438c14ec7bd21c6cd5bd995272b3faff6', { name: 'jenkins', all: true })
89
- #
90
- # @param [Integer, String] project The ID or name of a project.
91
- # @param [String] sha The commit hash
92
- # @param [Hash] options A customizable set of options.
93
- # @option options [String] :ref Filter by ref name, it can be branch or tag
94
- # @option options [String] :stage Filter by stage
95
- # @option options [String] :name Filter by status name, eg. jenkins
96
- # @option options [Boolean] :all The flag to return all statuses, not only latest ones
97
- def commit_status(project, sha, options={})
98
- get("/projects/#{url_encode project}/repository/commits/#{sha}/statuses", query: options)
99
- end
100
- alias_method :repo_commit_status, :commit_status
66
+ # Creates a new comment for a commit.
67
+ #
68
+ # @example
69
+ # Gitlab.create_commit_comment(5, 'c9f9662a9b1116c838b523ed64c6abdb4aae4b8b', 'Nice work on this commit!')
70
+ #
71
+ # @param [Integer, String] project The ID or name of a project.
72
+ # @param [String] sha The commit hash or name of a repository branch or tag.
73
+ # @param [String] note The text of a comment.
74
+ # @param [Hash] options A customizable set of options.
75
+ # @option options [String] :path The file path.
76
+ # @option options [Integer] :line The line number.
77
+ # @option options [String] :line_type The line type (new or old).
78
+ # @return [Gitlab::ObjectifiedHash] Information about created comment.
79
+ def create_commit_comment(project, commit, note, options = {})
80
+ post("/projects/#{url_encode project}/repository/commits/#{commit}/comments", body: options.merge(note: note))
81
+ end
82
+ alias repo_create_commit_comment create_commit_comment
101
83
 
102
- # Adds or updates a status of a commit.
103
- #
104
- # @example
105
- # Gitlab.update_commit_status(42, '6104942438c14ec7bd21c6cd5bd995272b3faff6', 'success')
106
- # Gitlab.update_commit_status(42, '6104942438c14ec7bd21c6cd5bd995272b3faff6', 'failed', { name: 'jenkins' })
107
- # Gitlab.update_commit_status(42, '6104942438c14ec7bd21c6cd5bd995272b3faff6', 'canceled', { name: 'jenkins', target_url: 'http://example.com/builds/1' })
108
- #
109
- # @param [Integer, String] project The ID or name of a project.
110
- # @param [String] sha The commit hash
111
- # @param [String] state of the status. Can be: pending, running, success, failed, canceled
112
- # @param [Hash] options A customizable set of options.
113
- # @option options [String] :ref The ref (branch or tag) to which the status refers
114
- # @option options [String] :name Filter by status name, eg. jenkins
115
- # @option options [String] :target_url The target URL to associate with this status
116
- def update_commit_status(project, sha, state, options={})
117
- post("/projects/#{url_encode project}/statuses/#{sha}", query: options.merge(state: state))
118
- end
119
- alias_method :repo_update_commit_status, :update_commit_status
84
+ # Get the status of a commit
85
+ #
86
+ # @example
87
+ # Gitlab.commit_status(42, '6104942438c14ec7bd21c6cd5bd995272b3faff6')
88
+ # Gitlab.commit_status(42, '6104942438c14ec7bd21c6cd5bd995272b3faff6', { name: 'jenkins' })
89
+ # Gitlab.commit_status(42, '6104942438c14ec7bd21c6cd5bd995272b3faff6', { name: 'jenkins', all: true })
90
+ #
91
+ # @param [Integer, String] project The ID or name of a project.
92
+ # @param [String] sha The commit hash
93
+ # @param [Hash] options A customizable set of options.
94
+ # @option options [String] :ref Filter by ref name, it can be branch or tag
95
+ # @option options [String] :stage Filter by stage
96
+ # @option options [String] :name Filter by status name, eg. jenkins
97
+ # @option options [Boolean] :all The flag to return all statuses, not only latest ones
98
+ def commit_status(project, sha, options = {})
99
+ get("/projects/#{url_encode project}/repository/commits/#{sha}/statuses", query: options)
100
+ end
101
+ alias repo_commit_status commit_status
102
+
103
+ # Adds or updates a status of a commit.
104
+ #
105
+ # @example
106
+ # Gitlab.update_commit_status(42, '6104942438c14ec7bd21c6cd5bd995272b3faff6', 'success')
107
+ # Gitlab.update_commit_status(42, '6104942438c14ec7bd21c6cd5bd995272b3faff6', 'failed', { name: 'jenkins' })
108
+ # Gitlab.update_commit_status(42, '6104942438c14ec7bd21c6cd5bd995272b3faff6', 'canceled', { name: 'jenkins', target_url: 'http://example.com/builds/1' })
109
+ #
110
+ # @param [Integer, String] project The ID or name of a project.
111
+ # @param [String] sha The commit hash
112
+ # @param [String] state of the status. Can be: pending, running, success, failed, canceled
113
+ # @param [Hash] options A customizable set of options.
114
+ # @option options [String] :ref The ref (branch or tag) to which the status refers
115
+ # @option options [String] :name Filter by status name, eg. jenkins
116
+ # @option options [String] :target_url The target URL to associate with this status
117
+ def update_commit_status(project, sha, state, options = {})
118
+ post("/projects/#{url_encode project}/statuses/#{sha}", query: options.merge(state: state))
119
+ end
120
+ alias repo_update_commit_status update_commit_status
120
121
 
121
- # Creates a single commit with one or more changes
122
- #
123
- # @see https://docs.gitlab.com/ce/api/commits.html#create-a-commit-with-multiple-files-and-actions
124
- # Introduced in Gitlab 8.13
125
- #
126
- # @example
127
- # Gitlab.create_commit(2726132, 'master', 'refactors everything', [{action: 'create', file_path: '/foo.txt', content: 'bar'}])
128
- # Gitlab.create_commit(2726132, 'master', 'refactors everything', [{action: 'delete', file_path: '/foo.txt'}])
129
- #
130
- # @param [Integer, String] project The ID or name of a project.
131
- # @param [String] branch the branch name you wish to commit to
132
- # @param [String] message the commit message
133
- # @param [Array[Hash]] An array of action hashes to commit as a batch. See the next table for what attributes it can take.
134
- # @option options [String] :author_email the email address of the author
135
- # @option options [String] :author_name the name of the author
136
- # @return [Gitlab::ObjectifiedHash] hash of commit related data
137
- def create_commit(project, branch, message, actions, options={})
138
- payload = {
139
- branch: branch,
140
- commit_message: message,
141
- actions: actions,
142
- }.merge(options)
143
- post("/projects/#{url_encode project}/repository/commits", body: payload)
144
- end
122
+ # Creates a single commit with one or more changes
123
+ #
124
+ # @see https://docs.gitlab.com/ce/api/commits.html#create-a-commit-with-multiple-files-and-actions
125
+ # Introduced in Gitlab 8.13
126
+ #
127
+ # @example
128
+ # Gitlab.create_commit(2726132, 'master', 'refactors everything', [{action: 'create', file_path: '/foo.txt', content: 'bar'}])
129
+ # Gitlab.create_commit(2726132, 'master', 'refactors everything', [{action: 'delete', file_path: '/foo.txt'}])
130
+ #
131
+ # @param [Integer, String] project The ID or name of a project.
132
+ # @param [String] branch the branch name you wish to commit to
133
+ # @param [String] message the commit message
134
+ # @param [Array[Hash]] An array of action hashes to commit as a batch. See the next table for what attributes it can take.
135
+ # @option options [String] :author_email the email address of the author
136
+ # @option options [String] :author_name the name of the author
137
+ # @return [Gitlab::ObjectifiedHash] hash of commit related data
138
+ def create_commit(project, branch, message, actions, options = {})
139
+ payload = {
140
+ branch: branch,
141
+ commit_message: message,
142
+ actions: actions
143
+ }.merge(options)
144
+ post("/projects/#{url_encode project}/repository/commits", body: payload)
145
+ end
145
146
 
146
- # Gets a list of merge requests for a commit.
147
- #
148
- # @see https://docs.gitlab.com/ce/api/commits.html#list-merge-requests-associated-with-a-commit
149
- # Introduced in Gitlab 10.7
150
- #
151
- # @example
152
- # Gitlab.commit_merge_requests(5, 'c9f9662a9b1116c838b523ed64c6abdb4aae4b8b')
153
- #
154
- # @param [Integer] project The ID of a project.
155
- # @param [String] sha The commit hash.
156
- # @option options [Integer] :page The page number.
157
- # @option options [Integer] :per_page The number of results per page.
158
- # @return [Array<Gitlab::ObjectifiedHash>]
159
- def commit_merge_requests(project, commit, options={})
160
- get("/projects/#{url_encode project}/repository/commits/#{commit}/merge_requests", query: options)
161
- end
162
- alias_method :repo_commit_merge_requests, :commit_merge_requests
147
+ # Gets a list of merge requests for a commit.
148
+ #
149
+ # @see https://docs.gitlab.com/ce/api/commits.html#list-merge-requests-associated-with-a-commit
150
+ # Introduced in Gitlab 10.7
151
+ #
152
+ # @example
153
+ # Gitlab.commit_merge_requests(5, 'c9f9662a9b1116c838b523ed64c6abdb4aae4b8b')
154
+ #
155
+ # @param [Integer] project The ID of a project.
156
+ # @param [String] sha The commit hash.
157
+ # @option options [Integer] :page The page number.
158
+ # @option options [Integer] :per_page The number of results per page.
159
+ # @return [Array<Gitlab::ObjectifiedHash>]
160
+ def commit_merge_requests(project, commit, options = {})
161
+ get("/projects/#{url_encode project}/repository/commits/#{commit}/merge_requests", query: options)
163
162
  end
163
+ alias repo_commit_merge_requests commit_merge_requests
164
164
  end