gitlab 3.2.0 → 3.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CONTRIBUTING.md +195 -0
- data/README.md +12 -0
- data/lib/gitlab.rb +5 -0
- data/lib/gitlab/cli.rb +6 -0
- data/lib/gitlab/cli_helpers.rb +40 -3
- data/lib/gitlab/client.rb +1 -0
- data/lib/gitlab/client/labels.rb +55 -0
- data/lib/gitlab/client/merge_requests.rb +20 -2
- data/lib/gitlab/client/projects.rb +18 -9
- data/lib/gitlab/client/repositories.rb +84 -4
- data/lib/gitlab/configuration.rb +1 -1
- data/lib/gitlab/help.rb +2 -2
- data/lib/gitlab/objectified_hash.rb +4 -0
- data/lib/gitlab/request.rb +18 -6
- data/lib/gitlab/shell.rb +42 -4
- data/lib/gitlab/shell_history.rb +61 -0
- data/lib/gitlab/version.rb +1 -1
- data/spec/fixtures/compare_merge_request_diff.json +31 -0
- data/spec/fixtures/label.json +1 -0
- data/spec/fixtures/labels.json +1 -0
- data/spec/fixtures/{comment_merge_request.json → merge_request_comment.json} +0 -0
- data/spec/fixtures/project_commit_comment.json +1 -0
- data/spec/fixtures/project_commit_comments.json +1 -0
- data/spec/fixtures/project_tag_annotated.json +1 -0
- data/spec/fixtures/project_tag_lightweight.json +1 -0
- data/spec/fixtures/raw_file.json +2 -0
- data/spec/fixtures/shell_history.json +2 -0
- data/spec/fixtures/tree.json +1 -0
- data/spec/gitlab/client/branches_spec.rb +12 -31
- data/spec/gitlab/client/labels_spec.rb +68 -0
- data/spec/gitlab/client/merge_requests_spec.rb +39 -17
- data/spec/gitlab/client/projects_spec.rb +1 -1
- data/spec/gitlab/client/repositories_spec.rb +110 -5
- data/spec/gitlab/client/system_hooks_spec.rb +3 -3
- data/spec/gitlab/objectified_hash_spec.rb +19 -1
- data/spec/gitlab/request_spec.rb +4 -3
- data/spec/gitlab/shell_history_spec.rb +53 -0
- data/spec/gitlab_spec.rb +21 -1
- metadata +32 -21
- data/spec/fixtures/create_branch.json +0 -1
- data/spec/fixtures/create_merge_request.json +0 -1
- data/spec/fixtures/project_delete_key.json +0 -8
- data/spec/fixtures/protect_branch.json +0 -1
- data/spec/fixtures/system_hook_test.json +0 -1
- data/spec/fixtures/tag.json +0 -1
- data/spec/fixtures/unprotect_branch.json +0 -1
- data/spec/fixtures/update_merge_request.json +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6dc7a38a2ba00b6ea3f0305b57d4f5209ba03511
|
4
|
+
data.tar.gz: ba2dcfd5474bd971f26a8baa0ae3949128ca6a5d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e9eebbb77c15cad4a5b030061177e8c7ea898b57896f63fb8608ac8fa2812623eb12f5e5d2d3fa1f607945946821a03e040571cd3331478bdde29fc5796f974
|
7
|
+
data.tar.gz: f90b16ae0d5fbce51044534b4751ff272b492d501a9bd63dfa7e31b8395f1e9166d541266ccaa58fc8e64f6cadf1d5639d0b0e1afd4fdb35a403018c35b5b65a
|
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,195 @@
|
|
1
|
+
# Contributing to Gitlab
|
2
|
+
|
3
|
+
Please take a moment to review this document in order to make the contribution
|
4
|
+
process easy and effective for everyone involved!
|
5
|
+
|
6
|
+
## Using the issue tracker
|
7
|
+
|
8
|
+
You can use the issues tracker for:
|
9
|
+
|
10
|
+
* [bug reports](#bug-reports)
|
11
|
+
* [feature requests](#feature-requests)
|
12
|
+
* [submitting pull requests](#pull-requests)
|
13
|
+
|
14
|
+
Use [Stackoverflow](http://stackoverflow.com/) for questions and personal support requests.
|
15
|
+
|
16
|
+
## Bug reports
|
17
|
+
|
18
|
+
A bug is a _demonstrable problem_ that is caused by the code in the repository.
|
19
|
+
Good bug reports are extremely helpful - thank you!
|
20
|
+
|
21
|
+
Guidelines for bug reports:
|
22
|
+
|
23
|
+
1. **Use the GitHub issue search** — check if the issue has already been
|
24
|
+
reported.
|
25
|
+
|
26
|
+
2. **Check if the issue has been fixed** — try to reproduce it using the
|
27
|
+
`master` branch in the repository.
|
28
|
+
|
29
|
+
3. **Isolate and report the problem** — ideally create a reduced test
|
30
|
+
case.
|
31
|
+
|
32
|
+
Please try to be as detailed as possible in your report. Include information about
|
33
|
+
your Ruby, Gitlab client and GitLab instance versions. Please provide steps to
|
34
|
+
reproduce the issue as well as the outcome you were expecting! All these details
|
35
|
+
will help developers to fix any potential bugs.
|
36
|
+
|
37
|
+
Example:
|
38
|
+
|
39
|
+
> Short and descriptive example bug report title
|
40
|
+
>
|
41
|
+
> A summary of the issue and the environment in which it occurs. If suitable,
|
42
|
+
> include the steps required to reproduce the bug.
|
43
|
+
>
|
44
|
+
> 1. This is the first step
|
45
|
+
> 2. This is the second step
|
46
|
+
> 3. Further steps, etc.
|
47
|
+
>
|
48
|
+
> Any other information you want to share that is relevant to the issue being
|
49
|
+
> reported. This might include the lines of code that you have identified as
|
50
|
+
> causing the bug, and potential solutions (and your opinions on their
|
51
|
+
> merits).
|
52
|
+
|
53
|
+
## Feature requests
|
54
|
+
|
55
|
+
Feature requests are welcome. But take a moment to find out whether your idea
|
56
|
+
fits with the scope and aims of the project. It's up to *you* to make a strong
|
57
|
+
case to convince the community of the merits of this feature.
|
58
|
+
Please provide as much detail and context as possible.
|
59
|
+
|
60
|
+
## Contributing Documentation
|
61
|
+
|
62
|
+
Code documentation has a special convention: it uses [YARD](http://yardoc.org/)
|
63
|
+
formatting and the first paragraph is considered to be a short summary.
|
64
|
+
|
65
|
+
For methods say what it will do. For example write something like:
|
66
|
+
|
67
|
+
```ruby
|
68
|
+
# Reverses the contents of a String or IO object.
|
69
|
+
#
|
70
|
+
# @param [String, #read] contents the contents to reverse
|
71
|
+
# @return [String] the contents reversed lexically
|
72
|
+
def reverse(contents)
|
73
|
+
contents = contents.read if contents.respond_to? :read
|
74
|
+
contents.reverse
|
75
|
+
end
|
76
|
+
```
|
77
|
+
|
78
|
+
For classes, modules say what it is. For example write something like:
|
79
|
+
|
80
|
+
```ruby
|
81
|
+
# Defines methods related to groups.
|
82
|
+
module Groups
|
83
|
+
```
|
84
|
+
|
85
|
+
Keep in mind that the documentation notes might show up in a summary somewhere,
|
86
|
+
long texts in the documentation notes create very ugly summaries. As a rule of thumb
|
87
|
+
anything longer than 80 characters is too long.
|
88
|
+
|
89
|
+
Try to keep unnecessary details out of the first paragraph, it's only there to
|
90
|
+
give a user a quick idea of what the documented "thing" does/is. The rest of the
|
91
|
+
documentation notes can contain the details, for example parameters and what
|
92
|
+
is returned.
|
93
|
+
|
94
|
+
If possible include examples. For example:
|
95
|
+
|
96
|
+
```ruby
|
97
|
+
# Gets information about a project.
|
98
|
+
#
|
99
|
+
# @example
|
100
|
+
# Gitlab.project(3)
|
101
|
+
# Gitlab.project('gitlab')
|
102
|
+
#
|
103
|
+
# @param [Integer, String] id The ID or name of a project.
|
104
|
+
# @return [Gitlab::ObjectifiedHash]
|
105
|
+
def project(id)
|
106
|
+
```
|
107
|
+
|
108
|
+
This makes it easy to test the examples so that they don't go stale and examples
|
109
|
+
are often a great help in explaining what a method does.
|
110
|
+
|
111
|
+
## Pull requests
|
112
|
+
|
113
|
+
Good pull requests - patches, improvements, new features - are a fantastic
|
114
|
+
help. They should remain focused in scope and avoid containing unrelated
|
115
|
+
commits.
|
116
|
+
|
117
|
+
**IMPORTANT**: By submitting a patch, you agree that your work will be
|
118
|
+
licensed under the license used by the project.
|
119
|
+
|
120
|
+
If you have any large pull request in mind (e.g. implementing features,
|
121
|
+
refactoring code, etc), **please ask first** otherwise you risk spending
|
122
|
+
a lot of time working on something that the project's developers might
|
123
|
+
not want to merge into the project.
|
124
|
+
|
125
|
+
Please adhere to the coding conventions in the project (indentation,
|
126
|
+
accurate comments, etc.) and don't forget to add your own tests and
|
127
|
+
documentation. When working with git, we recommend the following process
|
128
|
+
in order to craft an excellent pull request:
|
129
|
+
|
130
|
+
1. [Fork](https://help.github.com/articles/fork-a-repo/) the project, clone your fork,
|
131
|
+
and configure the remotes:
|
132
|
+
|
133
|
+
```sh
|
134
|
+
# Clone your fork of the repo into the current directory
|
135
|
+
git clone https://github.com/<your-username>/gitlab
|
136
|
+
# Navigate to the newly cloned directory
|
137
|
+
cd gitlab
|
138
|
+
# Assign the original repo to a remote called "upstream"
|
139
|
+
git remote add upstream https://github.com/NARKOZ/gitlab
|
140
|
+
```
|
141
|
+
|
142
|
+
2. If you cloned a while ago, get the latest changes from upstream:
|
143
|
+
|
144
|
+
```bash
|
145
|
+
git checkout master
|
146
|
+
git pull upstream master
|
147
|
+
```
|
148
|
+
|
149
|
+
3. Create a new topic branch (off of `master`) to contain your feature, change,
|
150
|
+
or fix.
|
151
|
+
|
152
|
+
**IMPORTANT**: Making changes in `master` is discouraged. You should always
|
153
|
+
keep your local `master` in sync with upstream `master` and make your
|
154
|
+
changes in topic branches.
|
155
|
+
|
156
|
+
```sh
|
157
|
+
git checkout -b <topic-branch-name>
|
158
|
+
```
|
159
|
+
|
160
|
+
4. Commit your changes in logical chunks. Keep your commit messages organized,
|
161
|
+
with a short description in the first line and more detailed information on
|
162
|
+
the following lines. Feel free to use Git's
|
163
|
+
[interactive rebase](https://help.github.com/articles/about-git-rebase/)
|
164
|
+
feature to tidy up your commits before making them public.
|
165
|
+
|
166
|
+
5. Make sure all the tests are still passing.
|
167
|
+
|
168
|
+
```sh
|
169
|
+
rake
|
170
|
+
```
|
171
|
+
|
172
|
+
6. Push your topic branch up to your fork:
|
173
|
+
|
174
|
+
```sh
|
175
|
+
git push origin <topic-branch-name>
|
176
|
+
```
|
177
|
+
|
178
|
+
7. [Open a Pull Request](https://help.github.com/articles/using-pull-requests/)
|
179
|
+
with a clear title and description.
|
180
|
+
|
181
|
+
8. If you haven't updated your pull request for a while, you should consider
|
182
|
+
rebasing on master and resolving any conflicts.
|
183
|
+
|
184
|
+
**IMPORTANT**: _Never ever_ merge upstream `master` into your branches. You
|
185
|
+
should always `git rebase` on `master` to bring your changes up to date when
|
186
|
+
necessary.
|
187
|
+
|
188
|
+
```sh
|
189
|
+
git checkout master
|
190
|
+
git pull upstream master
|
191
|
+
git checkout <your-topic-branch>
|
192
|
+
git rebase master
|
193
|
+
```
|
194
|
+
|
195
|
+
Thank you for your contributions!
|
data/README.md
CHANGED
@@ -49,6 +49,11 @@ Gitlab.endpoint = 'http://example.net/api/v3'
|
|
49
49
|
Gitlab.private_token = 'qEsq1pt6HJPaNciie3MG'
|
50
50
|
# => "qEsq1pt6HJPaNciie3MG"
|
51
51
|
|
52
|
+
# configure a proxy server
|
53
|
+
Gitlab.http_proxy('proxyhost', 8888)
|
54
|
+
# proxy server w/ basic auth
|
55
|
+
Gitlab.http_proxy('proxyhost', 8888, 'proxyuser', 'strongpasswordhere')
|
56
|
+
|
52
57
|
# list projects
|
53
58
|
Gitlab.projects(:per_page => 5)
|
54
59
|
# => [#<Gitlab::ObjectifiedHash:0x000000023326e0 @data={"id"=>1, "code"=>"brute", "name"=>"Brute", "description"=>nil, "path"=>"brute", "default_branch"=>nil, "owner"=>#<Gitlab::ObjectifiedHash:0x00000002331600 @data={"id"=>1, "email"=>"john@example.com", "name"=>"John Smith", "blocked"=>false, "created_at"=>"2012-09-17T09:41:56Z"}>, "private"=>true, "issues_enabled"=>true, "merge_requests_enabled"=>true, "wall_enabled"=>true, "wiki_enabled"=>true, "created_at"=>"2012-09-17T09:41:56Z"}>, #<Gitlab::ObjectifiedHash:0x000000023450d8 @data={"id"=>2, "code"=>"mozart", "name"=>"Mozart", "description"=>nil, "path"=>"mozart", "default_branch"=>nil, "owner"=>#<Gitlab::ObjectifiedHash:0x00000002344ca0 @data={"id"=>1, "email"=>"john@example.com", "name"=>"John Smith", "blocked"=>false, "created_at"=>"2012-09-17T09:41:56Z"}>, "private"=>true, "issues_enabled"=>true, "merge_requests_enabled"=>true, "wall_enabled"=>true, "wiki_enabled"=>true, "created_at"=>"2012-09-17T09:41:57Z"}>, #<Gitlab::ObjectifiedHash:0x00000002344958 @data={"id"=>3, "code"=>"gitlab", "name"=>"Gitlab", "description"=>nil, "path"=>"gitlab", "default_branch"=>nil, "owner"=>#<Gitlab::ObjectifiedHash:0x000000023447a0 @data={"id"=>1, "email"=>"john@example.com", "name"=>"John Smith", "blocked"=>false, "created_at"=>"2012-09-17T09:41:56Z"}>, "private"=>true, "issues_enabled"=>true, "merge_requests_enabled"=>true, "wall_enabled"=>true, "wiki_enabled"=>true, "created_at"=>"2012-09-17T09:41:58Z"}>]
|
@@ -94,6 +99,10 @@ gitlab user 2
|
|
94
99
|
gitlab user --only=id,username
|
95
100
|
|
96
101
|
gitlab user --except=email,bio
|
102
|
+
|
103
|
+
# how to pass options hash to a command (use YAML)
|
104
|
+
gitlab create_merge_request 4 "I'm creating a new merge request." "{source_branch: 'new_branch', target_branch: 'master', assignee_id: 42}"
|
105
|
+
|
97
106
|
```
|
98
107
|
|
99
108
|
## CLI Shell
|
@@ -112,6 +121,9 @@ gitlab> groups
|
|
112
121
|
|
113
122
|
# protect a branch
|
114
123
|
gitlab> protect_branch 1 master
|
124
|
+
|
125
|
+
# how to pass options hash to a command (use YAML)
|
126
|
+
gitlab> create_merge_request 4 "I'm creating a new merge request." "{source_branch: 'new_branch', target_branch: 'master', assignee_id: 42}"
|
115
127
|
```
|
116
128
|
|
117
129
|
For more information, refer to [website](http://narkoz.github.io/gitlab).
|
data/lib/gitlab.rb
CHANGED
@@ -27,6 +27,11 @@ module Gitlab
|
|
27
27
|
return client.respond_to?(method) || super
|
28
28
|
end
|
29
29
|
|
30
|
+
# Delegate to HTTParty.http_proxy
|
31
|
+
def self.http_proxy(address = nil, port = nil, username = nil, password = nil)
|
32
|
+
Gitlab::Request.http_proxy(address, port, username, password)
|
33
|
+
end
|
34
|
+
|
30
35
|
# Returns an unsorted array of available client methods.
|
31
36
|
#
|
32
37
|
# @return [Array<Symbol>]
|
data/lib/gitlab/cli.rb
CHANGED
data/lib/gitlab/cli_helpers.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'yaml'
|
1
2
|
class Gitlab::CLI
|
2
3
|
# Defines methods related to CLI output and formatting.
|
3
4
|
module Helpers
|
@@ -7,7 +8,7 @@ class Gitlab::CLI
|
|
7
8
|
#
|
8
9
|
# @return [Array]
|
9
10
|
def required_fields(args)
|
10
|
-
if args.any? && args.last.start_with?('--only=')
|
11
|
+
if args.any? && args.last.is_a?(String) && args.last.start_with?('--only=')
|
11
12
|
args.last.gsub('--only=', '').split(',')
|
12
13
|
else
|
13
14
|
[]
|
@@ -18,7 +19,7 @@ class Gitlab::CLI
|
|
18
19
|
#
|
19
20
|
# @return [Array]
|
20
21
|
def excluded_fields(args)
|
21
|
-
if args.any? && args.last.start_with?('--except=')
|
22
|
+
if args.any? && args.last.is_a?(String) && args.last.start_with?('--except=')
|
22
23
|
args.last.gsub('--except=', '').split(',')
|
23
24
|
else
|
24
25
|
[]
|
@@ -45,7 +46,7 @@ class Gitlab::CLI
|
|
45
46
|
puts 'Command aborted.'
|
46
47
|
exit(1)
|
47
48
|
end
|
48
|
-
end
|
49
|
+
end
|
49
50
|
end
|
50
51
|
|
51
52
|
# Table with available commands.
|
@@ -171,5 +172,41 @@ class Gitlab::CLI
|
|
171
172
|
|
172
173
|
data
|
173
174
|
end
|
175
|
+
|
176
|
+
# Convert a hash (recursively) to use symbol hash keys
|
177
|
+
# @return [Hash]
|
178
|
+
def symbolize_keys(hash)
|
179
|
+
if hash.is_a?(Hash)
|
180
|
+
hash = hash.each_with_object({}) do |(key, value), newhash|
|
181
|
+
begin
|
182
|
+
newhash[key.to_sym] = symbolize_keys(value)
|
183
|
+
rescue NoMethodError
|
184
|
+
puts "error: cannot convert hash key to symbol: #{arg}"
|
185
|
+
raise
|
186
|
+
end
|
187
|
+
end
|
188
|
+
end
|
189
|
+
|
190
|
+
hash
|
191
|
+
end
|
192
|
+
|
193
|
+
# Run YAML::load on each arg and symbolize hash keys if found.
|
194
|
+
# @return [Array]
|
195
|
+
def yaml_load_and_symbolize_hash!(args)
|
196
|
+
args.map! do |arg|
|
197
|
+
begin
|
198
|
+
arg = YAML::load(arg)
|
199
|
+
|
200
|
+
if arg.is_a?(Hash)
|
201
|
+
arg = symbolize_keys(arg)
|
202
|
+
end
|
203
|
+
rescue Psych::SyntaxError
|
204
|
+
puts "error: Argument is not valid YAML syntax: #{arg}"
|
205
|
+
raise
|
206
|
+
end
|
207
|
+
|
208
|
+
arg
|
209
|
+
end
|
210
|
+
end
|
174
211
|
end
|
175
212
|
end
|
data/lib/gitlab/client.rb
CHANGED
@@ -0,0 +1,55 @@
|
|
1
|
+
class Gitlab::Client
|
2
|
+
module Labels
|
3
|
+
# Gets a list of project's labels.
|
4
|
+
#
|
5
|
+
# @example
|
6
|
+
# Gitlab.labels(5)
|
7
|
+
#
|
8
|
+
# @param [Integer] project The ID of a project.
|
9
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
10
|
+
def labels(project)
|
11
|
+
get("/projects/#{project}/labels")
|
12
|
+
end
|
13
|
+
|
14
|
+
# Creates a new label.
|
15
|
+
#
|
16
|
+
# @example
|
17
|
+
# Gitlab.create_label(42, "Backlog", '#DD10AA')
|
18
|
+
#
|
19
|
+
# @param [Integer] project The ID of a project.
|
20
|
+
# @option [String] name The name of a label.
|
21
|
+
# @option [String] color The color of a label.
|
22
|
+
# @return [Gitlab::ObjectifiedHash] Information about created label.
|
23
|
+
def create_label(project, name, color)
|
24
|
+
post("/projects/#{project}/labels", :body => { :name => name, :color => color})
|
25
|
+
end
|
26
|
+
|
27
|
+
# Updates a label.
|
28
|
+
#
|
29
|
+
# @example
|
30
|
+
# Gitlab.edit_label(42, "Backlog", :new_name => 'TODO')
|
31
|
+
# Gitlab.edit_label(42, "Backlog", :new_name => 'TODO', :color => '#DD10AA')
|
32
|
+
#
|
33
|
+
# @param [Integer] project The ID of a project.
|
34
|
+
# @param [String] name The name of a label.
|
35
|
+
# @param [Hash] options A customizable set of options.
|
36
|
+
# @option options [String] :new_name The new name of a label.
|
37
|
+
# @option options [String] :color The color of a label.
|
38
|
+
# @return [Gitlab::ObjectifiedHash] Information about updated label.
|
39
|
+
def edit_label(project, name, options={})
|
40
|
+
put("/projects/#{project}/labels", :body => options.merge({:name => name}))
|
41
|
+
end
|
42
|
+
|
43
|
+
# Deletes a label.
|
44
|
+
#
|
45
|
+
# @example
|
46
|
+
# Gitlab.delete_label(2, 'Backlog')
|
47
|
+
#
|
48
|
+
# @param [Integer] project The ID of a project.
|
49
|
+
# @param [String] name The name of a label.
|
50
|
+
# @return [Gitlab::ObjectifiedHash] Information about deleted label.
|
51
|
+
def delete_label(project, name)
|
52
|
+
delete("/projects/#{project}/labels", :body => {:name => name} )
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -68,6 +68,20 @@ class Gitlab::Client
|
|
68
68
|
put("/projects/#{project}/merge_request/#{id}", :body => options)
|
69
69
|
end
|
70
70
|
|
71
|
+
# Accepts a merge request.
|
72
|
+
#
|
73
|
+
# @example
|
74
|
+
# Gitlab.accept_merge_request(5, 42, :merge_commit_message => 'Nice!')
|
75
|
+
#
|
76
|
+
# @param [Integer] project The ID of a project.
|
77
|
+
# @param [Integer] id The ID of a merge request.
|
78
|
+
# @param [Hash] options A customizable set of options.
|
79
|
+
# @option options [String] :merge_commit_message Custom merge commit message
|
80
|
+
# @return [Gitlab::ObjectifiedHash] Information about updated merge request.
|
81
|
+
def accept_merge_request(project, id, options={})
|
82
|
+
put("/projects/#{project}/merge_request/#{id}/merge", :body => options)
|
83
|
+
end
|
84
|
+
|
71
85
|
# Adds a comment to a merge request.
|
72
86
|
#
|
73
87
|
# @example
|
@@ -86,12 +100,16 @@ class Gitlab::Client
|
|
86
100
|
#
|
87
101
|
# @example
|
88
102
|
# Gitlab.merge_request_comments(5, 1)
|
103
|
+
# Gitlab.merge_request_comments(5, 1, :per_page =>10, :page => 2)
|
89
104
|
#
|
90
105
|
# @param [Integer] project The ID of a project.
|
91
106
|
# @param [Integer] id The ID of a merge request.
|
107
|
+
# @param [Hash] options A customizable set of options.
|
108
|
+
# @option options [Integer] :page The page number.
|
109
|
+
# @option options [Integer] :per_page The number of results per page.
|
92
110
|
# @return [Gitlab::ObjectifiedHash] The merge request's comments.
|
93
|
-
def merge_request_comments(project, id)
|
94
|
-
get("/projects/#{project}/merge_request/#{id}/comments")
|
111
|
+
def merge_request_comments(project, id, options={})
|
112
|
+
get("/projects/#{project}/merge_request/#{id}/comments", :query => options)
|
95
113
|
end
|
96
114
|
|
97
115
|
private
|
@@ -57,6 +57,8 @@ class Gitlab::Client
|
|
57
57
|
# @param [Hash] options A customizable set of options.
|
58
58
|
# @option options [String] :description The description of a project.
|
59
59
|
# @option options [String] :default_branch The default branch of a project.
|
60
|
+
# @option options [String] :group_id The group in which to create a project.
|
61
|
+
# @option options [String] :namespace_id The namespace in which to create a project.
|
60
62
|
# @option options [Boolean] :wiki_enabled The wiki integration for a project (0 = false, 1 = true).
|
61
63
|
# @option options [Boolean] :wall_enabled The wall functionality for a project (0 = false, 1 = true).
|
62
64
|
# @option options [Boolean] :issues_enabled The issues integration for a project (0 = false, 1 = true).
|
@@ -185,14 +187,15 @@ class Gitlab::Client
|
|
185
187
|
#
|
186
188
|
# @param [Integer, String] project The ID or name of a project.
|
187
189
|
# @param [String] url The hook URL.
|
188
|
-
# @param [Hash] options
|
190
|
+
# @param [Hash] options A customizable set of options.
|
191
|
+
# @param option [Boolean] :push_events Trigger hook on push events (0 = false, 1 = true)
|
192
|
+
# @param option [Boolean] :issues_events Trigger hook on issues events (0 = false, 1 = true)
|
193
|
+
# @param option [Boolean] :merge_requests_events Trigger hook on merge_requests events (0 = false, 1 = true)
|
194
|
+
# @param option [Boolean] :tag_push_events Trigger hook on push_tag events (0 = false, 1 = true)
|
189
195
|
# @return [Gitlab::ObjectifiedHash] Information about added hook.
|
190
|
-
def add_project_hook(project, url, options
|
191
|
-
|
192
|
-
|
193
|
-
events = Hash[passed_events.map { |event| [event, options[event]] }]
|
194
|
-
|
195
|
-
post("/projects/#{project}/hooks", :body => {:url => url}.merge(events))
|
196
|
+
def add_project_hook(project, url, options={})
|
197
|
+
body = {:url => url}.merge(options)
|
198
|
+
post("/projects/#{project}/hooks", :body => body)
|
196
199
|
end
|
197
200
|
|
198
201
|
# Updates a project hook URL.
|
@@ -203,9 +206,15 @@ class Gitlab::Client
|
|
203
206
|
# @param [Integer, String] project The ID or name of a project.
|
204
207
|
# @param [Integer] id The ID of the hook.
|
205
208
|
# @param [String] url The hook URL.
|
209
|
+
# @param [Hash] options A customizable set of options.
|
210
|
+
# @param option [Boolean] :push_events Trigger hook on push events (0 = false, 1 = true)
|
211
|
+
# @param option [Boolean] :issues_events Trigger hook on issues events (0 = false, 1 = true)
|
212
|
+
# @param option [Boolean] :merge_requests_events Trigger hook on merge_requests events (0 = false, 1 = true)
|
213
|
+
# @param option [Boolean] :tag_push_events Trigger hook on push_tag events (0 = false, 1 = true)
|
206
214
|
# @return [Gitlab::ObjectifiedHash] Information about updated hook.
|
207
|
-
def edit_project_hook(project, id, url)
|
208
|
-
|
215
|
+
def edit_project_hook(project, id, url, options={})
|
216
|
+
body = {:url => url}.merge(options)
|
217
|
+
put("/projects/#{project}/hooks/#{id}", :body => body)
|
209
218
|
end
|
210
219
|
|
211
220
|
# Deletes a hook from project.
|