gitlab 3.7.0 → 4.0.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 +7 -0
- data/.gitignore +2 -0
- data/.travis.yml +2 -2
- data/CHANGELOG.md +24 -0
- data/README.md +7 -6
- data/gitlab.gemspec +4 -6
- data/lib/gitlab/client.rb +24 -0
- data/lib/gitlab/client/branches.rb +13 -13
- data/lib/gitlab/client/build_triggers.rb +9 -9
- data/lib/gitlab/client/build_variables.rb +11 -11
- data/lib/gitlab/client/builds.rb +16 -16
- data/lib/gitlab/client/commits.rb +39 -14
- data/lib/gitlab/client/groups.rb +1 -1
- data/lib/gitlab/client/issues.rb +40 -16
- data/lib/gitlab/client/labels.rb +9 -9
- data/lib/gitlab/client/merge_requests.rb +61 -24
- data/lib/gitlab/client/milestones.rb +25 -11
- data/lib/gitlab/client/namespaces.rb +2 -1
- data/lib/gitlab/client/notes.rb +16 -16
- data/lib/gitlab/client/pipelines.rb +68 -0
- data/lib/gitlab/client/projects.rb +111 -49
- data/lib/gitlab/client/repositories.rb +27 -23
- data/lib/gitlab/client/repository_files.rb +29 -10
- data/lib/gitlab/client/runners.rb +15 -15
- data/lib/gitlab/client/services.rb +8 -6
- data/lib/gitlab/client/snippets.rb +13 -13
- data/lib/gitlab/client/system_hooks.rb +1 -1
- data/lib/gitlab/client/tags.rb +13 -13
- data/lib/gitlab/client/users.rb +12 -5
- data/lib/gitlab/file_response.rb +1 -0
- data/lib/gitlab/version.rb +1 -1
- data/spec/fixtures/merge_request_closes_issues.json +1 -0
- data/spec/fixtures/milestone_merge_requests.json +1 -0
- data/spec/fixtures/pipeline.json +23 -0
- data/spec/fixtures/pipeline_cancel.json +23 -0
- data/spec/fixtures/pipeline_create.json +23 -0
- data/spec/fixtures/pipeline_retry.json +23 -0
- data/spec/fixtures/pipelines.json +48 -0
- data/spec/fixtures/project_commit_create.json +22 -0
- data/spec/fixtures/project_star.json +44 -0
- data/spec/fixtures/project_unstar.json +44 -0
- data/spec/fixtures/{git_hook.json → push_rule.json} +0 -0
- data/spec/gitlab/cli_spec.rb +9 -0
- data/spec/gitlab/client/client_spec.rb +11 -0
- data/spec/gitlab/client/commits_spec.rb +31 -0
- data/spec/gitlab/client/issues_spec.rb +48 -0
- data/spec/gitlab/client/merge_requests_spec.rb +57 -10
- data/spec/gitlab/client/milestones_spec.rb +16 -0
- data/spec/gitlab/client/pipelines_spec.rb +95 -0
- data/spec/gitlab/client/projects_spec.rb +116 -38
- data/spec/gitlab/client/repositories_spec.rb +0 -15
- data/spec/gitlab/client/repository_files_spec.rb +17 -2
- data/spec/gitlab/client/users_spec.rb +31 -13
- data/spec/gitlab/file_response_spec.rb +6 -1
- metadata +53 -43
@@ -1,19 +1,19 @@
|
|
1
1
|
class Gitlab::Client
|
2
2
|
# Defines methods related to milestones.
|
3
|
-
# @see https://
|
3
|
+
# @see https://docs.gitlab.com/ce/api/milestones.html
|
4
4
|
module Milestones
|
5
5
|
# Gets a list of project's milestones.
|
6
6
|
#
|
7
7
|
# @example
|
8
8
|
# Gitlab.milestones(5)
|
9
9
|
#
|
10
|
-
# @param [Integer] project The ID of a project.
|
10
|
+
# @param [Integer, String] project The ID or name of a project.
|
11
11
|
# @param [Hash] options A customizable set of options.
|
12
12
|
# @option options [Integer] :page The page number.
|
13
13
|
# @option options [Integer] :per_page The number of results per page.
|
14
14
|
# @return [Array<Gitlab::ObjectifiedHash>]
|
15
15
|
def milestones(project, options={})
|
16
|
-
get("/projects/#{project}/milestones", query: options)
|
16
|
+
get("/projects/#{url_encode project}/milestones", query: options)
|
17
17
|
end
|
18
18
|
|
19
19
|
# Gets a single milestone.
|
@@ -21,11 +21,11 @@ class Gitlab::Client
|
|
21
21
|
# @example
|
22
22
|
# Gitlab.milestone(5, 36)
|
23
23
|
#
|
24
|
-
# @param [Integer, String] project The ID of a project.
|
24
|
+
# @param [Integer, String] project The ID or name of a project.
|
25
25
|
# @param [Integer] id The ID of a milestone.
|
26
26
|
# @return [Gitlab::ObjectifiedHash]
|
27
27
|
def milestone(project, id)
|
28
|
-
get("/projects/#{project}/milestones/#{id}")
|
28
|
+
get("/projects/#{url_encode project}/milestones/#{id}")
|
29
29
|
end
|
30
30
|
|
31
31
|
# Gets the issues of a given milestone.
|
@@ -33,13 +33,27 @@ class Gitlab::Client
|
|
33
33
|
# @example
|
34
34
|
# Gitlab.milestone_issues(5, 2)
|
35
35
|
#
|
36
|
-
# @param [Integer, String] project The ID of a project.
|
36
|
+
# @param [Integer, String] project The ID or name of a project.
|
37
37
|
# @param [Integer, String] milestone The ID of a milestone.
|
38
38
|
# @option options [Integer] :page The page number.
|
39
39
|
# @option options [Integer] :per_page The number of results per page.
|
40
40
|
# @return [Array<Gitlab::ObjectifiedHash>]
|
41
41
|
def milestone_issues(project, milestone, options={})
|
42
|
-
get("/projects/#{project}/milestones/#{milestone}/issues", query: options)
|
42
|
+
get("/projects/#{url_encode project}/milestones/#{milestone}/issues", query: options)
|
43
|
+
end
|
44
|
+
|
45
|
+
# Gets the merge_requests of a given milestone.
|
46
|
+
#
|
47
|
+
# @example
|
48
|
+
# Gitlab.milestone_merge_requests(5, 2)
|
49
|
+
#
|
50
|
+
# @param [Integer, String] project The ID or name of a project.
|
51
|
+
# @param [Integer, String] milestone The ID of a milestone.
|
52
|
+
# @option options [Integer] :page The page number.
|
53
|
+
# @option options [Integer] :per_page The number of results per page.
|
54
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
55
|
+
def milestone_merge_requests(project, milestone, options={})
|
56
|
+
get("/projects/#{url_encode project}/milestones/#{milestone}/merge_requests", query: options)
|
43
57
|
end
|
44
58
|
|
45
59
|
# Creates a new milestone.
|
@@ -47,7 +61,7 @@ class Gitlab::Client
|
|
47
61
|
# @example
|
48
62
|
# Gitlab.create_milestone(5, 'v1.0')
|
49
63
|
#
|
50
|
-
# @param [Integer] project The ID of a project.
|
64
|
+
# @param [Integer, String] project The ID or name of a project.
|
51
65
|
# @param [String] title The title of a milestone.
|
52
66
|
# @param [Hash] options A customizable set of options.
|
53
67
|
# @option options [String] :description The description of a milestone.
|
@@ -55,7 +69,7 @@ class Gitlab::Client
|
|
55
69
|
# @return [Gitlab::ObjectifiedHash] Information about created milestone.
|
56
70
|
def create_milestone(project, title, options={})
|
57
71
|
body = { title: title }.merge(options)
|
58
|
-
post("/projects/#{project}/milestones", body: body)
|
72
|
+
post("/projects/#{url_encode project}/milestones", body: body)
|
59
73
|
end
|
60
74
|
|
61
75
|
# Updates a milestone.
|
@@ -63,7 +77,7 @@ class Gitlab::Client
|
|
63
77
|
# @example
|
64
78
|
# Gitlab.edit_milestone(5, 2, { state_event: 'activate' })
|
65
79
|
#
|
66
|
-
# @param [Integer] project The ID of a project.
|
80
|
+
# @param [Integer, String] project The ID or name of a project.
|
67
81
|
# @param [Integer] id The ID of a milestone.
|
68
82
|
# @param [Hash] options A customizable set of options.
|
69
83
|
# @option options [String] :title The title of a milestone.
|
@@ -72,7 +86,7 @@ class Gitlab::Client
|
|
72
86
|
# @option options [String] :state_event The state of a milestone ('close' or 'activate').
|
73
87
|
# @return [Gitlab::ObjectifiedHash] Information about updated milestone.
|
74
88
|
def edit_milestone(project, id, options={})
|
75
|
-
put("/projects/#{project}/milestones/#{id}", body: options)
|
89
|
+
put("/projects/#{url_encode project}/milestones/#{id}", body: options)
|
76
90
|
end
|
77
91
|
end
|
78
92
|
end
|
@@ -1,8 +1,9 @@
|
|
1
1
|
class Gitlab::Client
|
2
2
|
# Defines methods related to namespaces
|
3
|
-
# @see https://
|
3
|
+
# @see https://docs.gitlab.com/ce/api/namespaces.html
|
4
4
|
module Namespaces
|
5
5
|
# Gets a list of namespaces.
|
6
|
+
# @see https://docs.gitlab.com/ce/api/namespaces.html#list-namespaces
|
6
7
|
#
|
7
8
|
# @example
|
8
9
|
# Gitlab.namespaces
|
data/lib/gitlab/client/notes.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
class Gitlab::Client
|
2
2
|
# Defines methods related to notes.
|
3
|
-
# @see https://
|
3
|
+
# @see https://docs.gitlab.com/ce/api/notes.html
|
4
4
|
module Notes
|
5
5
|
# Gets a list of projects notes.
|
6
6
|
#
|
@@ -12,7 +12,7 @@ class Gitlab::Client
|
|
12
12
|
# @option options [Integer] :per_page The number of results per page.
|
13
13
|
# @return [Array<Gitlab::ObjectifiedHash>]
|
14
14
|
def notes(project, options={})
|
15
|
-
get("/projects/#{project}/notes", query: options)
|
15
|
+
get("/projects/#{url_encode project}/notes", query: options)
|
16
16
|
end
|
17
17
|
|
18
18
|
# Gets a list of notes for a issue.
|
@@ -26,7 +26,7 @@ class Gitlab::Client
|
|
26
26
|
# @option options [Integer] :per_page The number of results per page.
|
27
27
|
# @return [Array<Gitlab::ObjectifiedHash>]
|
28
28
|
def issue_notes(project, issue, options={})
|
29
|
-
get("/projects/#{project}/issues/#{issue}/notes", query: options)
|
29
|
+
get("/projects/#{url_encode project}/issues/#{issue}/notes", query: options)
|
30
30
|
end
|
31
31
|
|
32
32
|
# Gets a list of notes for a snippet.
|
@@ -40,7 +40,7 @@ class Gitlab::Client
|
|
40
40
|
# @option options [Integer] :per_page The number of results per page.
|
41
41
|
# @return [Array<Gitlab::ObjectifiedHash>]
|
42
42
|
def snippet_notes(project, snippet, options={})
|
43
|
-
get("/projects/#{project}/snippets/#{snippet}/notes", query: options)
|
43
|
+
get("/projects/#{url_encode project}/snippets/#{snippet}/notes", query: options)
|
44
44
|
end
|
45
45
|
|
46
46
|
# Gets a list of notes for a merge request.
|
@@ -54,7 +54,7 @@ class Gitlab::Client
|
|
54
54
|
# @option options [Integer] :per_page The number of results per page.
|
55
55
|
# @return [Array<Gitlab::ObjectifiedHash>]
|
56
56
|
def merge_request_notes(project, merge_request, options={})
|
57
|
-
get("/projects/#{project}/merge_requests/#{merge_request}/notes", query: options)
|
57
|
+
get("/projects/#{url_encode project}/merge_requests/#{merge_request}/notes", query: options)
|
58
58
|
end
|
59
59
|
|
60
60
|
# Gets a single wall note.
|
@@ -66,7 +66,7 @@ class Gitlab::Client
|
|
66
66
|
# @param [Integer] id The ID of a note.
|
67
67
|
# @return [Gitlab::ObjectifiedHash]
|
68
68
|
def note(project, id)
|
69
|
-
get("/projects/#{project}/notes/#{id}")
|
69
|
+
get("/projects/#{url_encode project}/notes/#{id}")
|
70
70
|
end
|
71
71
|
|
72
72
|
# Gets a single issue note.
|
@@ -79,7 +79,7 @@ class Gitlab::Client
|
|
79
79
|
# @param [Integer] id The ID of a note.
|
80
80
|
# @return [Gitlab::ObjectifiedHash]
|
81
81
|
def issue_note(project, issue, id)
|
82
|
-
get("/projects/#{project}/issues/#{issue}/notes/#{id}")
|
82
|
+
get("/projects/#{url_encode project}/issues/#{issue}/notes/#{id}")
|
83
83
|
end
|
84
84
|
|
85
85
|
# Gets a single snippet note.
|
@@ -92,7 +92,7 @@ class Gitlab::Client
|
|
92
92
|
# @param [Integer] id The ID of a note.
|
93
93
|
# @return [Gitlab::ObjectifiedHash]
|
94
94
|
def snippet_note(project, snippet, id)
|
95
|
-
get("/projects/#{project}/snippets/#{snippet}/notes/#{id}")
|
95
|
+
get("/projects/#{url_encode project}/snippets/#{snippet}/notes/#{id}")
|
96
96
|
end
|
97
97
|
|
98
98
|
# Gets a single merge_request note.
|
@@ -105,7 +105,7 @@ class Gitlab::Client
|
|
105
105
|
# @param [Integer] id The ID of a note.
|
106
106
|
# @return [Gitlab::ObjectifiedHash]
|
107
107
|
def merge_request_note(project, merge_request, id)
|
108
|
-
get("/projects/#{project}/merge_requests/#{merge_request}/notes/#{id}")
|
108
|
+
get("/projects/#{url_encode project}/merge_requests/#{merge_request}/notes/#{id}")
|
109
109
|
end
|
110
110
|
|
111
111
|
# Creates a new wall note.
|
@@ -113,11 +113,11 @@ class Gitlab::Client
|
|
113
113
|
# @example
|
114
114
|
# Gitlab.create_note(5, 'This is a wall note!')
|
115
115
|
#
|
116
|
-
# @param [Integer] project The ID of a project.
|
116
|
+
# @param [Integer, String] project The ID or name of a project.
|
117
117
|
# @param [String] body The body of a note.
|
118
118
|
# @return [Gitlab::ObjectifiedHash] Information about created note.
|
119
119
|
def create_note(project, body)
|
120
|
-
post("/projects/#{project}/notes", body: { body: body })
|
120
|
+
post("/projects/#{url_encode project}/notes", body: { body: body })
|
121
121
|
end
|
122
122
|
|
123
123
|
# Creates a new issue note.
|
@@ -125,12 +125,12 @@ class Gitlab::Client
|
|
125
125
|
# @example
|
126
126
|
# Gitlab.create_issue_note(6, 1, 'Adding a note to my issue.')
|
127
127
|
#
|
128
|
-
# @param [Integer] project The ID of a project.
|
128
|
+
# @param [Integer, String] project The ID or name of a project.
|
129
129
|
# @param [Integer] issue The ID of an issue.
|
130
130
|
# @param [String] body The body of a note.
|
131
131
|
# @return [Gitlab::ObjectifiedHash] Information about created note.
|
132
132
|
def create_issue_note(project, issue, body)
|
133
|
-
post("/projects/#{project}/issues/#{issue}/notes", body: { body: body })
|
133
|
+
post("/projects/#{url_encode project}/issues/#{issue}/notes", body: { body: body })
|
134
134
|
end
|
135
135
|
|
136
136
|
# Creates a new snippet note.
|
@@ -138,12 +138,12 @@ class Gitlab::Client
|
|
138
138
|
# @example
|
139
139
|
# Gitlab.create_snippet_note(3, 2, 'Look at this awesome snippet!')
|
140
140
|
#
|
141
|
-
# @param [Integer] project The ID of a project.
|
141
|
+
# @param [Integer, String] project The ID or name of a project.
|
142
142
|
# @param [Integer] snippet The ID of a snippet.
|
143
143
|
# @param [String] body The body of a note.
|
144
144
|
# @return [Gitlab::ObjectifiedHash] Information about created note.
|
145
145
|
def create_snippet_note(project, snippet, body)
|
146
|
-
post("/projects/#{project}/snippets/#{snippet}/notes", body: { body: body })
|
146
|
+
post("/projects/#{url_encode project}/snippets/#{snippet}/notes", body: { body: body })
|
147
147
|
end
|
148
148
|
|
149
149
|
# Creates a new note for a single merge request.
|
@@ -155,7 +155,7 @@ class Gitlab::Client
|
|
155
155
|
# @param [Integer] merge_request The ID of a merge request.
|
156
156
|
# @param [String] body The content of a note.
|
157
157
|
def create_merge_request_note(project, merge_request, body)
|
158
|
-
post("/projects/#{project}/merge_requests/#{merge_request}/notes", body: { body: body })
|
158
|
+
post("/projects/#{url_encode project}/merge_requests/#{merge_request}/notes", body: { body: body })
|
159
159
|
end
|
160
160
|
end
|
161
161
|
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
class Gitlab::Client
|
2
|
+
# Defines methods related to pipelines.
|
3
|
+
# @see https://docs.gitlab.com/ce/api/pipelines.html
|
4
|
+
module Pipelines
|
5
|
+
# Gets a list of project pipelines.
|
6
|
+
#
|
7
|
+
# @example
|
8
|
+
# Gitlab.pipelines(5)
|
9
|
+
# Gitlab.pipelines(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 pipelines(project, options={})
|
17
|
+
get("/projects/#{url_encode project}/pipelines", query: options)
|
18
|
+
end
|
19
|
+
|
20
|
+
# Gets a single pipeline.
|
21
|
+
#
|
22
|
+
# @example
|
23
|
+
# Gitlab.pipeline(5, 36)
|
24
|
+
#
|
25
|
+
# @param [Integer, String] project The ID or name of a project.
|
26
|
+
# @param [Integer] id The ID of a pipeline.
|
27
|
+
# @return [Gitlab::ObjectifiedHash]
|
28
|
+
def pipeline(project, id)
|
29
|
+
get("/projects/#{url_encode project}/pipelines/#{id}")
|
30
|
+
end
|
31
|
+
|
32
|
+
# Create a pipeline.
|
33
|
+
#
|
34
|
+
# @example
|
35
|
+
# Gitlab.create_pipeline(5, 'master')
|
36
|
+
#
|
37
|
+
# @param [Integer, String] project The ID or name of a project.
|
38
|
+
# @param [String] ref Reference to commit.
|
39
|
+
# @return [Gitlab::ObjectifiedHash] The pipelines changes.
|
40
|
+
def create_pipeline(project, ref)
|
41
|
+
post("/projects/#{url_encode project}/pipeline?ref=#{ref}")
|
42
|
+
end
|
43
|
+
|
44
|
+
# Cancels a pipeline.
|
45
|
+
#
|
46
|
+
# @example
|
47
|
+
# Gitlab.cancel_pipeline(5, 1)
|
48
|
+
#
|
49
|
+
# @param [Integer, String] project The ID or name of a project.
|
50
|
+
# @param [Integer] id The ID of a pipeline.
|
51
|
+
# @return [Gitlab::ObjectifiedHash] The pipelines changes.
|
52
|
+
def cancel_pipeline(project, id)
|
53
|
+
post("/projects/#{url_encode project}/pipelines/#{id}/cancel")
|
54
|
+
end
|
55
|
+
|
56
|
+
# Retry a pipeline.
|
57
|
+
#
|
58
|
+
# @example
|
59
|
+
# Gitlab.retry_pipeline(5, 1)
|
60
|
+
#
|
61
|
+
# @param [Integer, String] project The ID or name of a project.
|
62
|
+
# @param [Integer] id The ID of a pipeline.
|
63
|
+
# @return [Array<Gitlab::ObjectifiedHash>] The pipelines changes.
|
64
|
+
def retry_pipeline(project, id)
|
65
|
+
post("/projects/#{url_encode project}/pipelines/#{id}/retry")
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
class Gitlab::Client
|
2
2
|
# Defines methods related to projects.
|
3
|
-
# @see https://
|
3
|
+
# @see https://docs.gitlab.com/ce/api/projects.html
|
4
4
|
module Projects
|
5
5
|
# Gets a list of projects owned by the authenticated user.
|
6
6
|
#
|
@@ -47,7 +47,7 @@ class Gitlab::Client
|
|
47
47
|
# @param [Integer, String] id The ID or name of a project.
|
48
48
|
# @return [Gitlab::ObjectifiedHash]
|
49
49
|
def project(id)
|
50
|
-
get("/projects/#{id}")
|
50
|
+
get("/projects/#{url_encode id}")
|
51
51
|
end
|
52
52
|
|
53
53
|
# Gets a list of project events.
|
@@ -62,7 +62,7 @@ class Gitlab::Client
|
|
62
62
|
# @option options [Integer] :per_page The number of results per page.
|
63
63
|
# @return [Array<Gitlab::ObjectifiedHash>]
|
64
64
|
def project_events(project, options={})
|
65
|
-
get("/projects/#{project}/events", query: options)
|
65
|
+
get("/projects/#{url_encode project}/events", query: options)
|
66
66
|
end
|
67
67
|
|
68
68
|
# Creates a new project.
|
@@ -114,7 +114,7 @@ class Gitlab::Client
|
|
114
114
|
# @option options [Integer] :per_page The number of results per page.
|
115
115
|
# @return [Array<Gitlab::ObjectifiedHash>]
|
116
116
|
def team_members(project, options={})
|
117
|
-
get("/projects/#{project}/members", query: options)
|
117
|
+
get("/projects/#{url_encode project}/members", query: options)
|
118
118
|
end
|
119
119
|
|
120
120
|
# Gets a project team member.
|
@@ -126,7 +126,7 @@ class Gitlab::Client
|
|
126
126
|
# @param [Integer] id The ID of a project team member.
|
127
127
|
# @return [Gitlab::ObjectifiedHash]
|
128
128
|
def team_member(project, id)
|
129
|
-
get("/projects/#{project}/members/#{id}")
|
129
|
+
get("/projects/#{url_encode project}/members/#{id}")
|
130
130
|
end
|
131
131
|
|
132
132
|
# Adds a user to project team.
|
@@ -140,7 +140,7 @@ class Gitlab::Client
|
|
140
140
|
# @param [Hash] options A customizable set of options.
|
141
141
|
# @return [Gitlab::ObjectifiedHash] Information about added team member.
|
142
142
|
def add_team_member(project, id, access_level)
|
143
|
-
post("/projects/#{project}/members", body: { user_id: id, access_level: access_level })
|
143
|
+
post("/projects/#{url_encode project}/members", body: { user_id: id, access_level: access_level })
|
144
144
|
end
|
145
145
|
|
146
146
|
# Updates a team member's project access level.
|
@@ -154,7 +154,7 @@ class Gitlab::Client
|
|
154
154
|
# @param [Hash] options A customizable set of options.
|
155
155
|
# @return [Array<Gitlab::ObjectifiedHash>] Information about updated team member.
|
156
156
|
def edit_team_member(project, id, access_level)
|
157
|
-
put("/projects/#{project}/members/#{id}", body: { access_level: access_level })
|
157
|
+
put("/projects/#{url_encode project}/members/#{id}", body: { access_level: access_level })
|
158
158
|
end
|
159
159
|
|
160
160
|
# Removes a user from project team.
|
@@ -167,7 +167,7 @@ class Gitlab::Client
|
|
167
167
|
# @param [Hash] options A customizable set of options.
|
168
168
|
# @return [Gitlab::ObjectifiedHash] Information about removed team member.
|
169
169
|
def remove_team_member(project, id)
|
170
|
-
delete("/projects/#{project}/members/#{id}")
|
170
|
+
delete("/projects/#{url_encode project}/members/#{id}")
|
171
171
|
end
|
172
172
|
|
173
173
|
# Gets a list of project hooks.
|
@@ -182,7 +182,7 @@ class Gitlab::Client
|
|
182
182
|
# @option options [Integer] :per_page The number of results per page.
|
183
183
|
# @return [Array<Gitlab::ObjectifiedHash>]
|
184
184
|
def project_hooks(project, options={})
|
185
|
-
get("/projects/#{project}/hooks", query: options)
|
185
|
+
get("/projects/#{url_encode project}/hooks", query: options)
|
186
186
|
end
|
187
187
|
|
188
188
|
# Gets a project hook.
|
@@ -195,7 +195,7 @@ class Gitlab::Client
|
|
195
195
|
# @param [Integer] id The ID of a hook.
|
196
196
|
# @return [Gitlab::ObjectifiedHash]
|
197
197
|
def project_hook(project, id)
|
198
|
-
get("/projects/#{project}/hooks/#{id}")
|
198
|
+
get("/projects/#{url_encode project}/hooks/#{id}")
|
199
199
|
end
|
200
200
|
|
201
201
|
# Adds a new hook to the project.
|
@@ -213,7 +213,7 @@ class Gitlab::Client
|
|
213
213
|
# @return [Gitlab::ObjectifiedHash] Information about added hook.
|
214
214
|
def add_project_hook(project, url, options={})
|
215
215
|
body = { url: url }.merge(options)
|
216
|
-
post("/projects/#{project}/hooks", body: body)
|
216
|
+
post("/projects/#{url_encode project}/hooks", body: body)
|
217
217
|
end
|
218
218
|
|
219
219
|
# Updates a project hook URL.
|
@@ -232,7 +232,7 @@ class Gitlab::Client
|
|
232
232
|
# @return [Gitlab::ObjectifiedHash] Information about updated hook.
|
233
233
|
def edit_project_hook(project, id, url, options={})
|
234
234
|
body = { url: url }.merge(options)
|
235
|
-
put("/projects/#{project}/hooks/#{id}", body: body)
|
235
|
+
put("/projects/#{url_encode project}/hooks/#{id}", body: body)
|
236
236
|
end
|
237
237
|
|
238
238
|
# Deletes a hook from project.
|
@@ -244,61 +244,61 @@ class Gitlab::Client
|
|
244
244
|
# @param [String] id The ID of the hook.
|
245
245
|
# @return [Gitlab::ObjectifiedHash] Information about deleted hook.
|
246
246
|
def delete_project_hook(project, id)
|
247
|
-
delete("/projects/#{project}/hooks/#{id}")
|
247
|
+
delete("/projects/#{url_encode project}/hooks/#{id}")
|
248
248
|
end
|
249
249
|
|
250
|
-
# Gets a project
|
251
|
-
#
|
250
|
+
# Gets a project push rule.
|
251
|
+
# @see https://docs.gitlab.com/ee/api/projects.html#show-project-push-rules
|
252
252
|
#
|
253
253
|
# @example
|
254
|
-
# Gitlab.
|
254
|
+
# Gitlab.push_rule(42)
|
255
255
|
#
|
256
256
|
# @param [Integer] id The ID of a project.
|
257
257
|
# @return [Gitlab::ObjectifiedHash]
|
258
|
-
def
|
259
|
-
get("/projects/#{id}/
|
258
|
+
def push_rule(id)
|
259
|
+
get("/projects/#{id}/push_rule")
|
260
260
|
end
|
261
261
|
|
262
|
-
# Adds a project
|
263
|
-
#
|
262
|
+
# Adds a project push rule.
|
263
|
+
# @see https://docs.gitlab.com/ee/api/projects.html#add-project-push-rule
|
264
264
|
#
|
265
265
|
# @example
|
266
|
-
# Gitlab.
|
266
|
+
# Gitlab.add_push_rule(42, { deny_delete_tag: false, commit_message_regex: '\\b[A-Z]{3}-[0-9]+\\b' })
|
267
267
|
#
|
268
268
|
# @param [Integer] id The ID of a project.
|
269
269
|
# @param [Hash] options A customizable set of options.
|
270
270
|
# @param option [Boolean] :deny_delete_tag Do not allow users to remove git tags with git push (0 = false, 1 = true)
|
271
271
|
# @param option [String] :commit_message_regex Commit message regex
|
272
|
-
# @return [Gitlab::ObjectifiedHash] Information about added
|
273
|
-
def
|
274
|
-
post("/projects/#{id}/
|
272
|
+
# @return [Gitlab::ObjectifiedHash] Information about added push rule.
|
273
|
+
def add_push_rule(id, options={})
|
274
|
+
post("/projects/#{id}/push_rule", body: options)
|
275
275
|
end
|
276
276
|
|
277
|
-
# Updates a project
|
278
|
-
#
|
277
|
+
# Updates a project push rule.
|
278
|
+
# @see https://docs.gitlab.com/ee/api/projects.html#edit-project-push-rule
|
279
279
|
#
|
280
280
|
# @example
|
281
|
-
# Gitlab.
|
281
|
+
# Gitlab.edit_push_rule(42, { deny_delete_tag: false, commit_message_regex: '\\b[A-Z]{3}-[0-9]+\\b' })
|
282
282
|
#
|
283
283
|
# @param [Integer] id The ID of a project.
|
284
284
|
# @param [Hash] options A customizable set of options.
|
285
285
|
# @param option [Boolean] :deny_delete_tag Do not allow users to remove git tags with git push (0 = false, 1 = true)
|
286
286
|
# @param option [String] :commit_message_regex Commit message regex
|
287
|
-
# @return [Gitlab::ObjectifiedHash] Information about updated
|
288
|
-
def
|
289
|
-
put("/projects/#{id}/
|
287
|
+
# @return [Gitlab::ObjectifiedHash] Information about updated push rule.
|
288
|
+
def edit_push_rule(id, options={})
|
289
|
+
put("/projects/#{id}/push_rule", body: options)
|
290
290
|
end
|
291
291
|
|
292
|
-
# Deletes a
|
293
|
-
#
|
292
|
+
# Deletes a push rule from a project.
|
293
|
+
# @see https://docs.gitlab.com/ee/api/projects.html#delete-project-push-rule
|
294
294
|
#
|
295
295
|
# @example
|
296
|
-
# Gitlab.
|
296
|
+
# Gitlab.delete_push_rule(42)
|
297
297
|
#
|
298
298
|
# @param [Integer] id The ID of a project.
|
299
|
-
# @return [Gitlab::ObjectifiedHash] Information about deleted
|
300
|
-
def
|
301
|
-
delete("/projects/#{id}/
|
299
|
+
# @return [Gitlab::ObjectifiedHash] Information about deleted push rule.
|
300
|
+
def delete_push_rule(id, options={})
|
301
|
+
delete("/projects/#{id}/push_rule")
|
302
302
|
end
|
303
303
|
|
304
304
|
# Mark this project as forked from the other
|
@@ -310,7 +310,7 @@ class Gitlab::Client
|
|
310
310
|
# @param [Integer] id The ID of the project it is forked from.
|
311
311
|
# @return [Gitlab::ObjectifiedHash] Information about the forked project.
|
312
312
|
def make_forked_from(project, id)
|
313
|
-
post("/projects/#{project}/fork/#{id}")
|
313
|
+
post("/projects/#{url_encode project}/fork/#{id}")
|
314
314
|
end
|
315
315
|
|
316
316
|
# Remove a forked_from relationship for a project.
|
@@ -322,7 +322,7 @@ class Gitlab::Client
|
|
322
322
|
# @param [Integer] project The ID of the project it is forked from
|
323
323
|
# @return [Gitlab::ObjectifiedHash] Information about the forked project.
|
324
324
|
def remove_forked(project)
|
325
|
-
delete("/projects/#{project}/fork")
|
325
|
+
delete("/projects/#{url_encode project}/fork")
|
326
326
|
end
|
327
327
|
|
328
328
|
# Gets a project deploy keys.
|
@@ -330,13 +330,13 @@ class Gitlab::Client
|
|
330
330
|
# @example
|
331
331
|
# Gitlab.deploy_keys(42)
|
332
332
|
#
|
333
|
-
# @param [Integer] project The ID of a project.
|
333
|
+
# @param [Integer, String] project The ID or name of a project.
|
334
334
|
# @param [Hash] options A customizable set of options.
|
335
335
|
# @option options [Integer] :page The page number.
|
336
336
|
# @option options [Integer] :per_page The number of results per page.
|
337
337
|
# @return [Array<Gitlab::ObjectifiedHash>]
|
338
338
|
def deploy_keys(project, options={})
|
339
|
-
get("/projects/#{project}/
|
339
|
+
get("/projects/#{url_encode project}/deploy_keys", query: options)
|
340
340
|
end
|
341
341
|
|
342
342
|
# Gets a single project deploy key.
|
@@ -344,11 +344,11 @@ class Gitlab::Client
|
|
344
344
|
# @example
|
345
345
|
# Gitlab.deploy_key(42, 1)
|
346
346
|
#
|
347
|
-
# @param [Integer, String] project The ID of a project.
|
347
|
+
# @param [Integer, String] project The ID or name of a project.
|
348
348
|
# @param [Integer] id The ID of a deploy key.
|
349
349
|
# @return [Gitlab::ObjectifiedHash]
|
350
350
|
def deploy_key(project, id)
|
351
|
-
get("/projects/#{project}/
|
351
|
+
get("/projects/#{url_encode project}/deploy_keys/#{id}")
|
352
352
|
end
|
353
353
|
|
354
354
|
# Creates a new deploy key.
|
@@ -356,12 +356,36 @@ class Gitlab::Client
|
|
356
356
|
# @example
|
357
357
|
# Gitlab.create_deploy_key(42, 'My Key', 'Key contents')
|
358
358
|
#
|
359
|
-
# @param [Integer] project The ID of a project.
|
359
|
+
# @param [Integer, String] project The ID or name of a project.
|
360
360
|
# @param [String] title The title of a deploy key.
|
361
361
|
# @param [String] key The content of a deploy key.
|
362
362
|
# @return [Gitlab::ObjectifiedHash] Information about created deploy key.
|
363
363
|
def create_deploy_key(project, title, key)
|
364
|
-
post("/projects/#{project}/
|
364
|
+
post("/projects/#{url_encode project}/deploy_keys", body: { title: title, key: key })
|
365
|
+
end
|
366
|
+
|
367
|
+
# Enables a deploy key at the project.
|
368
|
+
#
|
369
|
+
# @example
|
370
|
+
# Gitlab.enable_deploy_key(42, 66)
|
371
|
+
#
|
372
|
+
# @param [Integer, String] project The ID or name of a project.
|
373
|
+
# @param [Integer] key The ID of a deploy key.
|
374
|
+
# @return [Gitlab::ObjectifiedHash] Information about the enabled deploy key.
|
375
|
+
def enable_deploy_key(project, key)
|
376
|
+
post("/projects/#{url_encode project}/deploy_keys/#{key}/enable", body: { id: project, key_id: key })
|
377
|
+
end
|
378
|
+
|
379
|
+
# Disables a deploy key at the project.
|
380
|
+
#
|
381
|
+
# @example
|
382
|
+
# Gitlab.disable_deploy_key(42, 66)
|
383
|
+
#
|
384
|
+
# @param [Integer, String] project The ID or name of a project.
|
385
|
+
# @param [Integer] key The ID of a deploy key.
|
386
|
+
# @return [Gitlab::ObjectifiedHash] Information about the disabled deploy key.
|
387
|
+
def disable_deploy_key(project, key)
|
388
|
+
post("/projects/#{url_encode project}/deploy_keys/#{key}/disable", body: { id: project, key_id: key })
|
365
389
|
end
|
366
390
|
|
367
391
|
# Deletes a deploy key from project.
|
@@ -369,11 +393,11 @@ class Gitlab::Client
|
|
369
393
|
# @example
|
370
394
|
# Gitlab.delete_deploy_key(42, 1)
|
371
395
|
#
|
372
|
-
# @param [Integer] project The ID of a project.
|
396
|
+
# @param [Integer, String] project The ID or name of a project.
|
373
397
|
# @param [Integer] id The ID of a deploy key.
|
374
398
|
# @return [Gitlab::ObjectifiedHash] Information about deleted deploy key.
|
375
399
|
def delete_deploy_key(project, id)
|
376
|
-
delete("/projects/#{project}/
|
400
|
+
delete("/projects/#{url_encode project}/deploy_keys/#{id}")
|
377
401
|
end
|
378
402
|
|
379
403
|
# Forks a project into the user namespace.
|
@@ -382,12 +406,12 @@ class Gitlab::Client
|
|
382
406
|
# Gitlab.create_fork(42)
|
383
407
|
# Gitlab.create_fork(42, { sudo: 'another_username' })
|
384
408
|
#
|
385
|
-
# @param [Integer] project The ID of a project.
|
409
|
+
# @param [Integer, String] project The ID or name of a project.
|
386
410
|
# @param [Hash] options A customizable set of options.
|
387
411
|
# @option options [String] :sudo The username the project will be forked for
|
388
412
|
# @return [Gitlab::ObjectifiedHash] Information about the forked project.
|
389
413
|
def create_fork(id, options={})
|
390
|
-
post("/projects
|
414
|
+
post("/projects/#{id}/fork", body: options)
|
391
415
|
end
|
392
416
|
|
393
417
|
# Updates an existing project.
|
@@ -396,7 +420,7 @@ class Gitlab::Client
|
|
396
420
|
# Gitlab.edit_project(42)
|
397
421
|
# Gitlab.edit_project(42, { name: 'project_name' })
|
398
422
|
#
|
399
|
-
# @param [Integer] project The ID of a project.
|
423
|
+
# @param [Integer, String] project The ID or name of a project.
|
400
424
|
# @param [Hash] options A customizable set of options.
|
401
425
|
# @option options [String] :name The name of a project
|
402
426
|
# @option options [String] :path The name of a project
|
@@ -405,5 +429,43 @@ class Gitlab::Client
|
|
405
429
|
def edit_project(id, options={})
|
406
430
|
put("/projects/#{id}", query: options)
|
407
431
|
end
|
432
|
+
|
433
|
+
# Share project with group.
|
434
|
+
#
|
435
|
+
# @example
|
436
|
+
# Gitlab.share_project_with_group('gitlab', 2, 40)
|
437
|
+
#
|
438
|
+
# @param [Integer, String] project The ID or name of a project.
|
439
|
+
# @param [Integer] id The ID of a group.
|
440
|
+
# @param [Integer] group_access The access level to project.
|
441
|
+
def share_project_with_group(project, id, group_access)
|
442
|
+
post("/projects/#{url_encode project}/share", body: { group_id: id, group_access: group_access })
|
443
|
+
end
|
444
|
+
|
445
|
+
# Stars a project.
|
446
|
+
# @see https://docs.gitlab.com/ce/api/projects.html#star-a-project
|
447
|
+
#
|
448
|
+
# @example
|
449
|
+
# Gitlab.star_project(42)
|
450
|
+
# Gitlab.star_project('gitlab-org/gitlab-ce')
|
451
|
+
#
|
452
|
+
# @param [Integer, String] id The ID or name of a project.
|
453
|
+
# @return [Gitlab::ObjectifiedHash] Information about starred project.
|
454
|
+
def star_project(id)
|
455
|
+
post("/projects/#{id}/star")
|
456
|
+
end
|
457
|
+
|
458
|
+
# Unstars a project.
|
459
|
+
# @see https://docs.gitlab.com/ce/api/projects.html#unstar-a-project
|
460
|
+
#
|
461
|
+
# @example
|
462
|
+
# Gitlab.unstar_project(42)
|
463
|
+
# Gitlab.unstar_project('gitlab-org/gitlab-ce')
|
464
|
+
#
|
465
|
+
# @param [Integer, String] id The ID or name of a project.
|
466
|
+
# @return [Gitlab::ObjectifiedHash] Information about unstarred project.
|
467
|
+
def unstar_project(id)
|
468
|
+
delete("/projects/#{id}/star")
|
469
|
+
end
|
408
470
|
end
|
409
471
|
end
|