gitlab 4.1.0 → 4.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +17 -0
- data/lib/gitlab/client.rb +4 -0
- data/lib/gitlab/client/award_emojis.rb +135 -0
- data/lib/gitlab/client/boards.rb +88 -0
- data/lib/gitlab/client/branches.rb +12 -7
- data/lib/gitlab/client/commits.rb +6 -6
- data/lib/gitlab/client/environments.rb +87 -0
- data/lib/gitlab/client/labels.rb +33 -4
- data/lib/gitlab/client/merge_requests.rb +0 -59
- data/lib/gitlab/client/notes.rb +106 -0
- data/lib/gitlab/client/projects.rb +48 -44
- data/lib/gitlab/client/repository_files.rb +32 -26
- data/lib/gitlab/client/system_hooks.rb +5 -2
- data/lib/gitlab/client/todos.rb +44 -0
- data/lib/gitlab/version.rb +1 -1
- data/spec/fixtures/board_list.json +1 -0
- data/spec/fixtures/board_lists.json +1 -0
- data/spec/fixtures/boards.json +1 -0
- data/spec/fixtures/environment.json +6 -0
- data/spec/fixtures/environments.json +14 -0
- data/spec/fixtures/issue_award_emoji.json +16 -0
- data/spec/fixtures/issue_award_emojis.json +34 -0
- data/spec/fixtures/label.json +1 -1
- data/spec/fixtures/label_unsubscribe.json +1 -0
- data/spec/fixtures/merge_request_award_emoji.json +16 -0
- data/spec/fixtures/merge_request_award_emojis.json +34 -0
- data/spec/fixtures/note_award_emoji.json +16 -0
- data/spec/fixtures/note_award_emojis.json +18 -0
- data/spec/fixtures/snippet_award_emoji.json +16 -0
- data/spec/fixtures/snippet_award_emojis.json +34 -0
- data/spec/fixtures/todo.json +73 -0
- data/spec/fixtures/todos.json +148 -0
- data/spec/gitlab/client/award_emojis_spec.rb +391 -0
- data/spec/gitlab/client/boards_spec.rb +94 -0
- data/spec/gitlab/client/branches_spec.rb +22 -5
- data/spec/gitlab/client/commits_spec.rb +2 -2
- data/spec/gitlab/client/environments_spec.rb +132 -0
- data/spec/gitlab/client/groups_spec.rb +10 -12
- data/spec/gitlab/client/labels_spec.rb +32 -0
- data/spec/gitlab/client/notes_spec.rb +128 -0
- data/spec/gitlab/client/projects_spec.rb +20 -10
- data/spec/gitlab/client/repository_files_spec.rb +30 -12
- data/spec/gitlab/client/system_hooks_spec.rb +2 -2
- data/spec/gitlab/client/todos_spec.rb +45 -0
- metadata +46 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2fd8bd1d12fdceba122d4fd99e3df259c399e629
|
4
|
+
data.tar.gz: dd195a082fc9a572a22ff4074306891ccc9553a1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0edc2245a554decf8c18723979c256e6e7926d67521fa9ffeef11508b3bad1501e31ea3fe7ba91c1e9a5efe98a66149e6be3f2adcb25199c3118e5e6bde9b847
|
7
|
+
data.tar.gz: 12aa581f975cd5bbc7cebe3fb75eef20d1fb87eab9119af485c3a2158779a673cd0c1da74ee4a0d91f05adfe582a35f906e7679f2fd4650f65b5c04167926c28
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,23 @@
|
|
2
2
|
|
3
3
|
### Unreleased
|
4
4
|
|
5
|
+
### 4.2.0 (13/07/2017)
|
6
|
+
- Use `url_encode` in all `Commit` resources (@grodowski)
|
7
|
+
- Fix `project_search` path for APIv4 (@edaubert)
|
8
|
+
- Add options to `Labels#create_label` (@hlidotbe)
|
9
|
+
- Add `Board` API support (@hlidotbe)
|
10
|
+
- `Award Emoji` API (@akkee)
|
11
|
+
- Subscribe and unsubscribe actions for labels (@akkee)
|
12
|
+
- Add `options` hash to `add_hook` method (@mltsy)
|
13
|
+
- Update repository files endpoint APIv4 (@mltsy)
|
14
|
+
- Update `Branch` docs and add `options` param to `protect_branch` (@mltsy)
|
15
|
+
- Fix and clarify `edit_project` option docs (@mltsy)
|
16
|
+
- Add `TODO` API (@akkee)
|
17
|
+
- Use `body` parameter to send POST data (@sr189)
|
18
|
+
- Add `Environments` module (@mltsy)
|
19
|
+
- Edit and Delete methods for `Notes` API (@akkee)
|
20
|
+
- Rename `branch_name` parameter to `branch` in `create_branch` & `create_commit` methods (@sr189)
|
21
|
+
|
5
22
|
### 4.1.0 (26/05/2017)
|
6
23
|
- Add appropriate Content-Type header (@mltsy)
|
7
24
|
- Add `Jobs` endpoint methods (@hjanuschka)
|
data/lib/gitlab/client.rb
CHANGED
@@ -3,10 +3,13 @@ module Gitlab
|
|
3
3
|
class Client < API
|
4
4
|
Dir[File.expand_path('../client/*.rb', __FILE__)].each { |f| require f }
|
5
5
|
|
6
|
+
include AwardEmojis
|
7
|
+
include Boards
|
6
8
|
include Branches
|
7
9
|
include Builds
|
8
10
|
include BuildVariables
|
9
11
|
include Commits
|
12
|
+
include Environments
|
10
13
|
include Groups
|
11
14
|
include Issues
|
12
15
|
include Keys
|
@@ -25,6 +28,7 @@ module Gitlab
|
|
25
28
|
include Snippets
|
26
29
|
include SystemHooks
|
27
30
|
include Tags
|
31
|
+
include Todos
|
28
32
|
include Users
|
29
33
|
include Jobs
|
30
34
|
|
@@ -0,0 +1,135 @@
|
|
1
|
+
class Gitlab::Client
|
2
|
+
# Defines methods related to Award Emojis.
|
3
|
+
# @see https://docs.gitlab.com/ce/api/award_emoji.html
|
4
|
+
module AwardEmojis
|
5
|
+
# Gets a list of all award emoji for an awardable(issue, merge request or snippet)
|
6
|
+
#
|
7
|
+
# @example
|
8
|
+
# Gitlab.award_emojis(1, 80, 'issue')
|
9
|
+
# Gitlab.award_emojis(1, 60, 'merge_request')
|
10
|
+
# Gitlab.award_emojis(1, 40, 'snippet')
|
11
|
+
#
|
12
|
+
# @param [Integer] project The ID of a project.
|
13
|
+
# @param [Integer] awardable_id The ID of an awardable(issue, merge request or snippet).
|
14
|
+
# @param [String] awardable_type The type of the awardable(can be 'issue', 'merge_request' or 'snippet')
|
15
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
16
|
+
def award_emojis(project, awardable_id, awardable_type)
|
17
|
+
get("/projects/#{url_encode project}/#{awardable_type}s/#{awardable_id}/award_emoji")
|
18
|
+
end
|
19
|
+
|
20
|
+
# Gets a list of all award emoji for a single note on an awardable(issue, merge request or snippet)
|
21
|
+
#
|
22
|
+
# @example
|
23
|
+
# Gitlab.note_award_emojis(1, 80, 'issue', 1)
|
24
|
+
# Gitlab.note_award_emojis(1, 60, 'merge_request', 1)
|
25
|
+
# Gitlab.note_award_emojis(1, 40, 'snippet', 1)
|
26
|
+
#
|
27
|
+
# @param [Integer] project The ID of a project.
|
28
|
+
# @param [Integer] awardable_id The ID of an awardable(issue, merge request or snippet).
|
29
|
+
# @param [String] awardable_type The type of the awardable(can be 'issue', 'merge_request' or 'snippet')
|
30
|
+
# @param [Integer] note_id The ID of a note.
|
31
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
32
|
+
def note_award_emojis(project, awardable_id, awardable_type, note_id)
|
33
|
+
get("/projects/#{url_encode project}/#{awardable_type}s/#{awardable_id}/notes/#{note_id}/award_emoji")
|
34
|
+
end
|
35
|
+
|
36
|
+
# Gets a single award emoji for an awardable(issue, merge request or snippet)
|
37
|
+
#
|
38
|
+
# @example
|
39
|
+
# Gitlab.award_emoji(1, 80, 'issue', 4)
|
40
|
+
# Gitlab.award_emoji(1, 60, 'merge_request', 4)
|
41
|
+
# Gitlab.award_emoji(1, 40, 'snippet', 4)
|
42
|
+
#
|
43
|
+
# @param [Integer] project The ID of a project.
|
44
|
+
# @param [Integer] awardable_id The ID of an awardable(issue, merge request or snippet).
|
45
|
+
# @param [String] awardable_type The type of the awardable(can be 'issue', 'merge_request' or 'snippet')
|
46
|
+
# @param [Integer] award_id The ID of an award emoji.
|
47
|
+
# @return [Gitlab::ObjectifiedHash]
|
48
|
+
def award_emoji(project, awardable_id, awardable_type, award_id)
|
49
|
+
get("/projects/#{url_encode project}/#{awardable_type}s/#{awardable_id}/award_emoji/#{award_id}")
|
50
|
+
end
|
51
|
+
|
52
|
+
# Gets a single award emoji from a single note on an awardable(issue, merge request or snippet)
|
53
|
+
#
|
54
|
+
# @example
|
55
|
+
# Gitlab.note_award_emoji(1, 80, 'issue', 1, 4)
|
56
|
+
# Gitlab.note_award_emoji(1, 60, 'merge_request', 1, 4)
|
57
|
+
# Gitlab.note_award_emoji(1, 40, 'snippet', 1, 4)
|
58
|
+
#
|
59
|
+
# @param [Integer] project The ID of a project.
|
60
|
+
# @param [Integer] awardable_id The ID of an awardable(issue, merge request or snippet).
|
61
|
+
# @param [String] awardable_type The type of the awardable(can be 'issue', 'merge_request' or 'snippet')
|
62
|
+
# @param [Integer] note_id The ID of a note.
|
63
|
+
# @param [Integer] award_id The ID of an award emoji.
|
64
|
+
# @return [Gitlab::ObjectifiedHash]
|
65
|
+
def note_award_emoji(project, awardable_id, awardable_type, note_id, award_id)
|
66
|
+
get("/projects/#{url_encode project}/#{awardable_type}s/#{awardable_id}/notes/#{note_id}/award_emoji/#{award_id}")
|
67
|
+
end
|
68
|
+
|
69
|
+
# Awards a new emoji to an awardable(issue, merge request or snippet)
|
70
|
+
#
|
71
|
+
# @example
|
72
|
+
# Gitlab.create_award_emoji(1, 80, 'issue', 'blowfish')
|
73
|
+
# Gitlab.create_award_emoji(1, 80, 'merge_request', 'blowfish')
|
74
|
+
# Gitlab.create_award_emoji(1, 80, 'snippet', 'blowfish')
|
75
|
+
#
|
76
|
+
# @param [Integer] project The ID of a project.
|
77
|
+
# @param [Integer] awardable_id The ID of an awardable(issue, merge request or snippet).
|
78
|
+
# @param [String] awardable_type The type of the awardable(can be 'issue', 'merge_request' or 'snippet')
|
79
|
+
# @param [String] emoji_name The name of the emoji, without colons.
|
80
|
+
# @return [Gitlab::ObjectifiedHash]
|
81
|
+
def create_award_emoji(project, awardable_id, awardable_type, emoji_name)
|
82
|
+
post("/projects/#{url_encode project}/#{awardable_type}s/#{awardable_id}/award_emoji", body: {name: emoji_name})
|
83
|
+
end
|
84
|
+
|
85
|
+
# Awards a new emoji to a note on an awardable(issue, merge request or snippet)
|
86
|
+
#
|
87
|
+
# @example
|
88
|
+
# Gitlab.create_note_award_emoji(1, 80, 'issue', 1, 'blowfish')
|
89
|
+
# Gitlab.create_note_award_emoji(1, 80, 'merge_request', 1, 'blowfish')
|
90
|
+
# Gitlab.create_note_award_emoji(1, 80, 'snippet', 1, 'blowfish')
|
91
|
+
#
|
92
|
+
# @param [Integer] project The ID of a project.
|
93
|
+
# @param [Integer] awardable_id The ID of an awardable(issue, merge request or snippet).
|
94
|
+
# @param [String] awardable_type The type of the awardable(can be 'issue', 'merge_request' or 'snippet')
|
95
|
+
# @param [Integer] note_id The ID of a note.
|
96
|
+
# @param [String] emoji_name The name of the emoji, without colons.
|
97
|
+
# @return [Gitlab::ObjectifiedHash]
|
98
|
+
def create_note_award_emoji(project, awardable_id, awardable_type, note_id, emoji_name)
|
99
|
+
post("/projects/#{url_encode project}/#{awardable_type}s/#{awardable_id}/notes/#{note_id}/award_emoji", body: {name: emoji_name})
|
100
|
+
end
|
101
|
+
|
102
|
+
# Deletes a single award emoji from an awardable(issue, merge request or snippet)
|
103
|
+
#
|
104
|
+
# @example
|
105
|
+
# Gitlab.delete_award_emoji(1, 80, 'issue', 4)
|
106
|
+
# Gitlab.delete_award_emoji(1, 60, 'merge_request', 4)
|
107
|
+
# Gitlab.delete_award_emoji(1, 40, 'snippet', 4)
|
108
|
+
#
|
109
|
+
# @param [Integer] project The ID of a project.
|
110
|
+
# @param [Integer] awardable_id The ID of an awardable(issue, merge request or snippet).
|
111
|
+
# @param [String] awardable_type The type of the awardable(can be 'issue', 'merge_request' or 'snippet')
|
112
|
+
# @param [Integer] award_id The ID of an award emoji.
|
113
|
+
# @return [void] This API call returns an empty response body.
|
114
|
+
def delete_award_emoji(project, awardable_id, awardable_type, award_id)
|
115
|
+
delete("/projects/#{url_encode project}/#{awardable_type}s/#{awardable_id}/award_emoji/#{award_id}")
|
116
|
+
end
|
117
|
+
|
118
|
+
# Deletes a single award emoji from a single note on an awardable(issue, merge request or snippet)
|
119
|
+
#
|
120
|
+
# @example
|
121
|
+
# Gitlab.delete_note_award_emoji(1, 80, 'issue', 1, 4)
|
122
|
+
# Gitlab.delete_note_award_emoji(1, 60, 'merge_request', 1, 4)
|
123
|
+
# Gitlab.delete_note_award_emoji(1, 40, 'snippet', 1, 4)
|
124
|
+
#
|
125
|
+
# @param [Integer] project The ID of a project.
|
126
|
+
# @param [Integer] awardable_id The ID of an awardable(issue, merge request or snippet).
|
127
|
+
# @param [String] awardable_type The type of the awardable(can be 'issue', 'merge_request' or 'snippet')
|
128
|
+
# @param [Integer] note_id The ID of a note.
|
129
|
+
# @param [Integer] award_id The ID of an award emoji.
|
130
|
+
# @return [void] This API call returns an empty response body.
|
131
|
+
def delete_note_award_emoji(project, awardable_id, awardable_type, note_id, award_id)
|
132
|
+
delete("/projects/#{url_encode project}/#{awardable_type}s/#{awardable_id}/notes/#{note_id}/award_emoji/#{award_id}")
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
@@ -0,0 +1,88 @@
|
|
1
|
+
class Gitlab::Client
|
2
|
+
# Defines methods related to issue boards.
|
3
|
+
# @see https://docs.gitlab.com/ce/api/boards.html
|
4
|
+
module Boards
|
5
|
+
# Gets a list of project's boards.
|
6
|
+
#
|
7
|
+
# @example
|
8
|
+
# Gitlab.boards(5)
|
9
|
+
# Gitlab.boards({ per_page: 40 })
|
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 boards(project, options={})
|
17
|
+
get("/projects/#{url_encode project}/boards", query: options)
|
18
|
+
end
|
19
|
+
|
20
|
+
# Gets a board lists
|
21
|
+
#
|
22
|
+
# @example
|
23
|
+
# Gitlab.board_lists(5, 42)
|
24
|
+
#
|
25
|
+
# @param [Integer, String] project The ID or name of a project.
|
26
|
+
# @param [Integer] id The ID of a board.
|
27
|
+
# @return [Gitlab::ObjectifiedHash]
|
28
|
+
def board_lists(project, id)
|
29
|
+
get("/projects/#{url_encode project}/boards/#{id}/lists")
|
30
|
+
end
|
31
|
+
#
|
32
|
+
# Gets a single board list
|
33
|
+
#
|
34
|
+
# @example
|
35
|
+
# Gitlab.board_list(5, 42, 25)
|
36
|
+
#
|
37
|
+
# @param [Integer, String] project The ID or name of a project.
|
38
|
+
# @param [Integer] board_id The ID of a board.
|
39
|
+
# @param [Integer] id The ID of a list.
|
40
|
+
# @return [Gitlab::ObjectifiedHash]
|
41
|
+
def board_list(project, board_id, id)
|
42
|
+
get("/projects/#{url_encode project}/boards/#{board_id}/lists/#{id}")
|
43
|
+
end
|
44
|
+
|
45
|
+
# Creates a new board list.
|
46
|
+
# Only for admins and project owners
|
47
|
+
#
|
48
|
+
# @example
|
49
|
+
# Gitlab.create_board_list(5, 42, 25)
|
50
|
+
#
|
51
|
+
# @param [Integer, String] project The ID or name of a project.
|
52
|
+
# @param [Integer] id The ID of a board.
|
53
|
+
# @param [Integer] label_id The ID of a label.
|
54
|
+
# @return [Gitlab::ObjectifiedHash] Information about created list.
|
55
|
+
def create_board_list(project, board_id, label_id)
|
56
|
+
post("/projects/#{url_encode project}/boards/#{board_id}/lists", body: {label_id: label_id})
|
57
|
+
end
|
58
|
+
|
59
|
+
# Updates a board list.
|
60
|
+
# Only for admins and project owners
|
61
|
+
#
|
62
|
+
# @example
|
63
|
+
# Gitlab.edit_board_list(6, 1, 12, 5)
|
64
|
+
#
|
65
|
+
# @param [Integer, String] project The ID or name of a project.
|
66
|
+
# @param [Integer] board_id The ID of a board.
|
67
|
+
# @param [Integer] id The ID of a list.
|
68
|
+
# @return [Gitlab::ObjectifiedHash] Information about updated board list.
|
69
|
+
def edit_board_list(project, board_id, id, position)
|
70
|
+
put("/projects/#{url_encode project}/boards/#{board_id}/lists/#{id}", body: {position: position})
|
71
|
+
end
|
72
|
+
|
73
|
+
# Deletes a board list.
|
74
|
+
# Only for admins and project owners
|
75
|
+
#
|
76
|
+
# @example
|
77
|
+
# Gitlab.delete_board_list(3, 42, 32)
|
78
|
+
#
|
79
|
+
# @param [Integer, String] project The ID or name of a project.
|
80
|
+
# @param [Integer] board_id The ID of a board.
|
81
|
+
# @param [Integer] id The ID of a list.
|
82
|
+
# @return [Gitlab::ObjectifiedHash] Information about deleted board list.
|
83
|
+
def delete_board_list(project, board_id, id)
|
84
|
+
delete("/projects/#{url_encode project}/boards/#{board_id}/lists/#{id}")
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
@@ -36,12 +36,18 @@ class Gitlab::Client
|
|
36
36
|
# @example
|
37
37
|
# Gitlab.protect_branch(3, 'api')
|
38
38
|
# Gitlab.repo_protect_branch(5, 'master')
|
39
|
+
# Gitlab.protect_branch(5, 'api', developers_can_push: true)
|
40
|
+
#
|
41
|
+
# To update options, call `protect_branch` again with new options (i.e. `developers_can_push: false`)
|
39
42
|
#
|
40
43
|
# @param [Integer, String] project The ID or name of a project.
|
41
44
|
# @param [String] branch The name of the branch.
|
42
|
-
# @
|
43
|
-
|
44
|
-
|
45
|
+
# @param [Hash] options A customizable set of options.
|
46
|
+
# @option options [Boolean] :developers_can_push True to allow developers to push to the branch (default = false)
|
47
|
+
# @option options [Boolean] :developers_can_merge True to allow developers to merge into the branch (default = false)
|
48
|
+
# @return [Gitlab::ObjectifiedHash] Details about the branch
|
49
|
+
def protect_branch(project, branch, options = {})
|
50
|
+
put("/projects/#{url_encode project}/repository/branches/#{branch}/protect", body: options)
|
45
51
|
end
|
46
52
|
alias_method :repo_protect_branch, :protect_branch
|
47
53
|
|
@@ -53,7 +59,7 @@ class Gitlab::Client
|
|
53
59
|
#
|
54
60
|
# @param [Integer, String] project The ID or name of a project.
|
55
61
|
# @param [String] branch The name of the branch.
|
56
|
-
# @return [Gitlab::ObjectifiedHash]
|
62
|
+
# @return [Gitlab::ObjectifiedHash] Details about the branch
|
57
63
|
def unprotect_branch(project, branch)
|
58
64
|
put("/projects/#{url_encode project}/repository/branches/#{branch}/unprotect")
|
59
65
|
end
|
@@ -68,9 +74,9 @@ class Gitlab::Client
|
|
68
74
|
# @param [Integer, String] project The ID or name of a project.
|
69
75
|
# @param [String] branch The name of the new branch.
|
70
76
|
# @param [String] ref Create branch from commit sha or existing branch
|
71
|
-
# @return [Gitlab::ObjectifiedHash]
|
77
|
+
# @return [Gitlab::ObjectifiedHash] Details about the branch
|
72
78
|
def create_branch(project, branch, ref)
|
73
|
-
post("/projects/#{url_encode project}/repository/branches", body: {
|
79
|
+
post("/projects/#{url_encode project}/repository/branches", body: { branch: branch, ref: ref })
|
74
80
|
end
|
75
81
|
alias_method :repo_create_branch, :create_branch
|
76
82
|
|
@@ -82,7 +88,6 @@ class Gitlab::Client
|
|
82
88
|
#
|
83
89
|
# @param [Integer, String] project The ID or name of a project.
|
84
90
|
# @param [String] branch The name of the branch to delete
|
85
|
-
# @return [Gitlab::ObjectifiedHash]
|
86
91
|
def delete_branch(project, branch)
|
87
92
|
delete("/projects/#{url_encode project}/repository/branches/#{branch}")
|
88
93
|
end
|
@@ -94,8 +94,8 @@ class Gitlab::Client
|
|
94
94
|
# @option options [String] :stage Filter by stage
|
95
95
|
# @option options [String] :name Filter by status name, eg. jenkins
|
96
96
|
# @option options [Boolean] :all The flag to return all statuses, not only latest ones
|
97
|
-
def commit_status(
|
98
|
-
get("/projects/#{
|
97
|
+
def commit_status(project, sha, options={})
|
98
|
+
get("/projects/#{url_encode project}/repository/commits/#{sha}/statuses", query: options)
|
99
99
|
end
|
100
100
|
alias_method :repo_commit_status, :commit_status
|
101
101
|
|
@@ -113,8 +113,8 @@ class Gitlab::Client
|
|
113
113
|
# @option options [String] :ref The ref (branch or tag) to which the status refers
|
114
114
|
# @option options [String] :name Filter by status name, eg. jenkins
|
115
115
|
# @option options [String] :target_url The target URL to associate with this status
|
116
|
-
def update_commit_status(
|
117
|
-
post("/projects/#{
|
116
|
+
def update_commit_status(project, sha, state, options={})
|
117
|
+
post("/projects/#{url_encode project}/statuses/#{sha}", query: options.merge(state: state))
|
118
118
|
end
|
119
119
|
alias_method :repo_update_commit_status, :update_commit_status
|
120
120
|
|
@@ -136,11 +136,11 @@ class Gitlab::Client
|
|
136
136
|
# @return [Gitlab::ObjectifiedHash] hash of commit related data
|
137
137
|
def create_commit(project, branch, message, actions, options={})
|
138
138
|
payload = {
|
139
|
-
|
139
|
+
branch: branch,
|
140
140
|
commit_message: message,
|
141
141
|
actions: actions,
|
142
142
|
}.merge(options)
|
143
|
-
post("/projects/#{url_encode project}/repository/commits",
|
143
|
+
post("/projects/#{url_encode project}/repository/commits", body: payload)
|
144
144
|
end
|
145
145
|
end
|
146
146
|
end
|
@@ -0,0 +1,87 @@
|
|
1
|
+
class Gitlab::Client
|
2
|
+
# Defines methods related to environments.
|
3
|
+
# @see https://docs.gitlab.com/ce/api/environments.html
|
4
|
+
module Environments
|
5
|
+
# Gets a list of project environments.
|
6
|
+
#
|
7
|
+
# @example
|
8
|
+
# Gitlab.environments(5)
|
9
|
+
# Gitlab.environments(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
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
16
|
+
def environments(project, options={})
|
17
|
+
get("/projects/#{url_encode project}/environments", query: options)
|
18
|
+
end
|
19
|
+
|
20
|
+
# Gets a single environment.
|
21
|
+
#
|
22
|
+
# @example
|
23
|
+
# Gitlab.environment(5, 36)
|
24
|
+
#
|
25
|
+
# @param [Integer, String] project The ID or name of a project.
|
26
|
+
# @param [Integer] id The ID of an environment.
|
27
|
+
# @return [Gitlab::ObjectifiedHash]
|
28
|
+
def environment(project, id)
|
29
|
+
get("/projects/#{url_encode project}/environments/#{id}")
|
30
|
+
end
|
31
|
+
|
32
|
+
# Create an environment.
|
33
|
+
#
|
34
|
+
# @examples
|
35
|
+
# Gitlab.create_environment(5, 'test-branch')
|
36
|
+
# Gitlab.create_environment(5, 'test-branch', external_url: 'https://test-branch.example.host.com')
|
37
|
+
#
|
38
|
+
# @param [Integer, String] project The ID or name of a project.
|
39
|
+
# @param [String] env_name Name for the environment
|
40
|
+
# @option options [String] :external_url Optional URL for viewing the deployed project in this environment
|
41
|
+
# @return [Gitlab::ObjectifiedHash] The updated environment.
|
42
|
+
def create_environment(project, env_name, options = {})
|
43
|
+
body = {name: env_name}.merge(options)
|
44
|
+
post("/projects/#{url_encode project}/environments", body: body)
|
45
|
+
end
|
46
|
+
|
47
|
+
# Update an environment.
|
48
|
+
#
|
49
|
+
# @examples
|
50
|
+
# Gitlab.edit_environment(5, 36, name: 'test-branch')
|
51
|
+
# Gitlab.edit_environment(5, 36, external_url: 'https://test-branch.example.host.com')
|
52
|
+
#
|
53
|
+
# @param [Integer, String] project The ID or name of a project.
|
54
|
+
# @param [Integer] id The ID of an environment.
|
55
|
+
# @param [Hash] options A hash of the attribute keys & values to update.
|
56
|
+
# @option options [String] env_name Name for the environment
|
57
|
+
# @option options [String] external_url Optional URL for viewing the deployed project in this environment
|
58
|
+
# @return [Gitlab::ObjectifiedHash] The updated environment.
|
59
|
+
def edit_environment(project, id, options={})
|
60
|
+
put("/projects/#{url_encode project}/environments/#{id}", body: options)
|
61
|
+
end
|
62
|
+
|
63
|
+
# Deletes an environment.
|
64
|
+
#
|
65
|
+
# @example
|
66
|
+
# Gitlab.delete_environment(5, 36)
|
67
|
+
#
|
68
|
+
# @param [Integer, String] project The ID or name of a project.
|
69
|
+
# @param [Integer] id The ID of an environment.
|
70
|
+
# @return [Gitlab::ObjectifiedHash] Information about the deleted environment.
|
71
|
+
def delete_environment(project, id)
|
72
|
+
delete("/projects/#{url_encode project}/environments/#{id}")
|
73
|
+
end
|
74
|
+
|
75
|
+
# Stop an environment.
|
76
|
+
#
|
77
|
+
# @example
|
78
|
+
# Gitlab.stop_environment(5, 36)
|
79
|
+
#
|
80
|
+
# @param [Integer, String] project The ID or name of a project.
|
81
|
+
# @param [Integer] id The ID of an environment.
|
82
|
+
# @return [Array<Gitlab::ObjectifiedHash>] The stopped environment.
|
83
|
+
def stop_environment(project, id)
|
84
|
+
post("/projects/#{url_encode project}/environments/#{id}/stop")
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|