gitlab 3.5.0 → 3.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -1
- data/README.md +17 -0
- data/Rakefile +1 -1
- data/exe/gitlab +1 -1
- data/lib/gitlab.rb +5 -3
- data/lib/gitlab/cli.rb +1 -1
- data/lib/gitlab/cli_helpers.rb +24 -26
- data/lib/gitlab/client.rb +1 -1
- data/lib/gitlab/client/branches.rb +2 -5
- data/lib/gitlab/client/commits.rb +5 -5
- data/lib/gitlab/client/groups.rb +8 -9
- data/lib/gitlab/client/issues.rb +7 -7
- data/lib/gitlab/client/labels.rb +3 -3
- data/lib/gitlab/client/merge_requests.rb +7 -7
- data/lib/gitlab/client/milestones.rb +5 -5
- data/lib/gitlab/client/namespaces.rb +1 -1
- data/lib/gitlab/client/notes.rb +7 -7
- data/lib/gitlab/client/projects.rb +22 -21
- data/lib/gitlab/client/repositories.rb +7 -7
- data/lib/gitlab/client/repository_files.rb +10 -10
- data/lib/gitlab/client/snippets.rb +6 -6
- data/lib/gitlab/client/system_hooks.rb +1 -1
- data/lib/gitlab/client/users.rb +5 -6
- data/lib/gitlab/configuration.rb +1 -1
- data/lib/gitlab/help.rb +19 -15
- data/lib/gitlab/objectified_hash.rb +2 -2
- data/lib/gitlab/page_links.rb +33 -0
- data/lib/gitlab/paginated_response.rb +97 -0
- data/lib/gitlab/request.rb +24 -26
- data/lib/gitlab/shell.rb +4 -5
- data/lib/gitlab/shell_history.rb +3 -5
- data/lib/gitlab/version.rb +1 -1
- data/spec/gitlab/cli_helpers_spec.rb +8 -9
- data/spec/gitlab/cli_spec.rb +0 -2
- data/spec/gitlab/client/branches_spec.rb +2 -2
- data/spec/gitlab/client/commits_spec.rb +16 -16
- data/spec/gitlab/client/groups_spec.rb +11 -14
- data/spec/gitlab/client/issues_spec.rb +9 -9
- data/spec/gitlab/client/labels_spec.rb +6 -6
- data/spec/gitlab/client/merge_requests_spec.rb +23 -23
- data/spec/gitlab/client/milestones_spec.rb +9 -9
- data/spec/gitlab/client/namespaces_spec.rb +2 -2
- data/spec/gitlab/client/notes_spec.rb +10 -10
- data/spec/gitlab/client/projects_spec.rb +29 -28
- data/spec/gitlab/client/repositories_spec.rb +7 -7
- data/spec/gitlab/client/snippets_spec.rb +7 -7
- data/spec/gitlab/client/system_hooks_spec.rb +2 -2
- data/spec/gitlab/client/users_spec.rb +20 -21
- data/spec/gitlab/help_spec.rb +1 -4
- data/spec/gitlab/objectified_hash_spec.rb +2 -2
- data/spec/gitlab/page_links_spec.rb +16 -0
- data/spec/gitlab/paginated_response_spec.rb +60 -0
- data/spec/gitlab/request_spec.rb +12 -13
- data/spec/gitlab/shell_history_spec.rb +1 -1
- data/spec/gitlab/shell_spec.rb +6 -6
- data/spec/spec_helper.rb +12 -12
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f71b98abae4830188738c95c3c90310473de96a7
|
4
|
+
data.tar.gz: 64134f58cbba17afe03218750cea381d37865f93
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f1e92645b84ff2e71918812296ce9b70ae67215b2c5919b901fc49de1f5c587c7dbacdb194b9091228a065fe30917b23cadfc3b4c5ea7fcc6659765b2581db6b
|
7
|
+
data.tar.gz: 97d106205c7a38c8e51469e133fa7209b8c0e3fe69f43dbe928df7ed16bb5e202674c35e05a072ef8cddc112fb73c7d7df65fbc0e5757410979752e1da901abd
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,12 @@
|
|
1
1
|
## Change Log
|
2
2
|
|
3
|
-
###
|
3
|
+
### 3.6.0 (11/12/2015)
|
4
|
+
|
5
|
+
- Improved output of the CLI help (@thomasdarimont)
|
6
|
+
- Added `search_projects` alias for `project_search` method
|
7
|
+
- Added pagination and auto pagination support (@nanofi)
|
8
|
+
|
9
|
+
### 3.5.0 (26/11/2015)
|
4
10
|
- [a4f2150](https://github.com/NARKOZ/gitlab/commit/a4f21504a7288caace5b7433b49f49dc31e32b30) Add support for namespaces endpoint
|
5
11
|
- [3ad81a1](https://github.com/NARKOZ/gitlab/commit/3ad81a19a10b35ea422c0abcf08e6d03a325f4cd) Add missing "@" in doc. (@asedge)
|
6
12
|
- [fc34acb](https://github.com/NARKOZ/gitlab/commit/fc34acb6b475bb2555e4b035c11fdf42b3db4085) Add Gitlab::Client::Commits and rearrange methods and tests related to commits. (@asedge)
|
data/README.md
CHANGED
@@ -82,6 +82,23 @@ Gitlab.sudo = 'other_user'
|
|
82
82
|
# disable a sudo mode
|
83
83
|
Gitlab.sudo = nil
|
84
84
|
# => nil
|
85
|
+
|
86
|
+
# a paginated response
|
87
|
+
projects = Gitlab.projects(per_page: 5)
|
88
|
+
|
89
|
+
# check existence of the next page
|
90
|
+
projects.has_next_page?
|
91
|
+
|
92
|
+
# retrieve the next page
|
93
|
+
projects.next_page
|
94
|
+
|
95
|
+
# iterate all projects
|
96
|
+
projects.auto_paginate do |project|
|
97
|
+
# do something
|
98
|
+
end
|
99
|
+
|
100
|
+
# retrieve all projects as an array
|
101
|
+
projects.auto_paginate
|
85
102
|
```
|
86
103
|
|
87
104
|
For more information, refer to [documentation](http://rubydoc.info/gems/gitlab/frames).
|
data/Rakefile
CHANGED
data/exe/gitlab
CHANGED
data/lib/gitlab.rb
CHANGED
@@ -2,6 +2,8 @@ require 'gitlab/version'
|
|
2
2
|
require 'gitlab/objectified_hash'
|
3
3
|
require 'gitlab/configuration'
|
4
4
|
require 'gitlab/error'
|
5
|
+
require 'gitlab/page_links'
|
6
|
+
require 'gitlab/paginated_response'
|
5
7
|
require 'gitlab/request'
|
6
8
|
require 'gitlab/api'
|
7
9
|
require 'gitlab/client'
|
@@ -24,11 +26,11 @@ module Gitlab
|
|
24
26
|
|
25
27
|
# Delegate to Gitlab::Client
|
26
28
|
def self.respond_to?(method)
|
27
|
-
|
29
|
+
client.respond_to?(method) || super
|
28
30
|
end
|
29
31
|
|
30
32
|
# Delegate to HTTParty.http_proxy
|
31
|
-
def self.http_proxy(address
|
33
|
+
def self.http_proxy(address=nil, port=nil, username=nil, password=nil)
|
32
34
|
Gitlab::Request.http_proxy(address, port, username, password)
|
33
35
|
end
|
34
36
|
|
@@ -37,6 +39,6 @@ module Gitlab
|
|
37
39
|
# @return [Array<Symbol>]
|
38
40
|
def self.actions
|
39
41
|
hidden = /endpoint|private_token|auth_token|user_agent|sudo|get|post|put|\Adelete\z|validate|set_request_defaults|httparty/
|
40
|
-
(Gitlab::Client.instance_methods - Object.methods).reject {|e| e[hidden]}
|
42
|
+
(Gitlab::Client.instance_methods - Object.methods).reject { |e| e[hidden] }
|
41
43
|
end
|
42
44
|
end
|
data/lib/gitlab/cli.rb
CHANGED
data/lib/gitlab/cli_helpers.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'yaml'
|
2
2
|
require 'json'
|
3
3
|
|
4
|
-
|
5
4
|
class Gitlab::CLI
|
6
5
|
# Defines methods related to CLI output and formatting.
|
7
6
|
module Helpers
|
@@ -75,14 +74,14 @@ class Gitlab::CLI
|
|
75
74
|
puts 'Command aborted.'
|
76
75
|
exit(1)
|
77
76
|
end
|
78
|
-
end
|
77
|
+
end
|
79
78
|
end
|
80
79
|
|
81
80
|
# Gets defined help for a specific command/action.
|
82
81
|
#
|
83
82
|
# @return [String]
|
84
|
-
def help(cmd
|
85
|
-
if cmd.nil?
|
83
|
+
def help(cmd=nil, &block)
|
84
|
+
if cmd.nil? || Gitlab::Help.help_map.key?(cmd)
|
86
85
|
Gitlab::Help.actions_table(cmd)
|
87
86
|
else
|
88
87
|
Gitlab::Help.get_help(cmd, &block)
|
@@ -96,7 +95,7 @@ class Gitlab::CLI
|
|
96
95
|
puts record_table([data], cmd, args)
|
97
96
|
when Array
|
98
97
|
puts record_table(data, cmd, args)
|
99
|
-
else
|
98
|
+
else # probably just an error msg
|
100
99
|
puts data
|
101
100
|
end
|
102
101
|
end
|
@@ -106,12 +105,12 @@ class Gitlab::CLI
|
|
106
105
|
puts '{}'
|
107
106
|
else
|
108
107
|
hash_result = case data
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
108
|
+
when Gitlab::ObjectifiedHash
|
109
|
+
record_hash([data], cmd, args, true)
|
110
|
+
when Array
|
111
|
+
record_hash(data, cmd, args)
|
112
|
+
else
|
113
|
+
{ cmd: cmd, data: data, args: args }
|
115
114
|
end
|
116
115
|
puts JSON.pretty_generate(hash_result)
|
117
116
|
end
|
@@ -156,7 +155,7 @@ class Gitlab::CLI
|
|
156
155
|
# @param [Array] args Options passed to the API call
|
157
156
|
# @param [bool] single_value If set to true, a single result should be returned
|
158
157
|
# @return [Hash] Result hash
|
159
|
-
def record_hash(data, cmd, args, single_value
|
158
|
+
def record_hash(data, cmd, args, single_value=false)
|
160
159
|
if data.empty?
|
161
160
|
result = nil
|
162
161
|
else
|
@@ -167,12 +166,12 @@ class Gitlab::CLI
|
|
167
166
|
|
168
167
|
keys.each do |key|
|
169
168
|
case hash[key]
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
169
|
+
when Hash
|
170
|
+
row[key] = 'Hash'
|
171
|
+
when nil
|
172
|
+
row[key] = nil
|
173
|
+
else
|
174
|
+
row[key] = hash[key]
|
176
175
|
end
|
177
176
|
end
|
178
177
|
|
@@ -182,23 +181,22 @@ class Gitlab::CLI
|
|
182
181
|
end
|
183
182
|
|
184
183
|
{
|
185
|
-
:
|
186
|
-
:
|
184
|
+
cmd: "Gitlab.#{cmd} #{args.join(', ')}".strip,
|
185
|
+
result: result
|
187
186
|
}
|
188
|
-
|
189
187
|
end
|
190
188
|
|
191
189
|
# Helper function to get rows and keys from data returned from API call
|
192
190
|
def get_keys(args, data)
|
193
191
|
arr = data.map(&:to_h)
|
194
192
|
keys = arr.first.keys.sort { |x, y| x.to_s <=> y.to_s }
|
195
|
-
keys
|
196
|
-
keys
|
197
|
-
|
193
|
+
keys &= required_fields(args) if required_fields(args).any?
|
194
|
+
keys -= excluded_fields(args)
|
195
|
+
[arr, keys]
|
198
196
|
end
|
199
197
|
|
200
198
|
# Helper function to call Gitlab commands with args.
|
201
|
-
def gitlab_helper(cmd, args
|
199
|
+
def gitlab_helper(cmd, args=[])
|
202
200
|
begin
|
203
201
|
data = args.any? ? Gitlab.send(cmd, *args) : Gitlab.send(cmd)
|
204
202
|
rescue => e
|
@@ -228,7 +226,7 @@ class Gitlab::CLI
|
|
228
226
|
# YAML::load on a single argument
|
229
227
|
def yaml_load(arg)
|
230
228
|
begin
|
231
|
-
yaml = YAML
|
229
|
+
yaml = YAML.load(arg)
|
232
230
|
rescue Psych::SyntaxError
|
233
231
|
raise "error: Argument is not valid YAML syntax: #{arg}"
|
234
232
|
end
|
data/lib/gitlab/client.rb
CHANGED
@@ -13,7 +13,7 @@ class Gitlab::Client
|
|
13
13
|
# @option options [Integer] :per_page The number of results per page.
|
14
14
|
# @return [Array<Gitlab::ObjectifiedHash>]
|
15
15
|
def branches(project, options={})
|
16
|
-
get("/projects/#{project}/repository/branches", :
|
16
|
+
get("/projects/#{project}/repository/branches", query: options)
|
17
17
|
end
|
18
18
|
alias_method :repo_branches, :branches
|
19
19
|
|
@@ -29,7 +29,6 @@ class Gitlab::Client
|
|
29
29
|
def branch(project, branch)
|
30
30
|
get("/projects/#{project}/repository/branches/#{branch}")
|
31
31
|
end
|
32
|
-
|
33
32
|
alias_method :repo_branch, :branch
|
34
33
|
|
35
34
|
# Protects a repository branch.
|
@@ -71,7 +70,7 @@ class Gitlab::Client
|
|
71
70
|
# @param [String] ref Create branch from commit sha or existing branch
|
72
71
|
# @return [Gitlab::ObjectifiedHash]
|
73
72
|
def create_branch(project, branch, ref)
|
74
|
-
post("/projects/#{project}/repository/branches"
|
73
|
+
post("/projects/#{project}/repository/branches", body: { branch_name: branch, ref: ref })
|
75
74
|
end
|
76
75
|
alias_method :repo_create_branch, :create_branch
|
77
76
|
|
@@ -88,7 +87,5 @@ class Gitlab::Client
|
|
88
87
|
delete("/projects/#{project}/repository/branches/#{branch}")
|
89
88
|
end
|
90
89
|
alias_method :repo_delete_branch, :delete_branch
|
91
|
-
|
92
90
|
end
|
93
91
|
end
|
94
|
-
|
@@ -15,7 +15,7 @@ class Gitlab::Client
|
|
15
15
|
# @option options [Integer] :per_page The number of results per page.
|
16
16
|
# @return [Array<Gitlab::ObjectifiedHash>]
|
17
17
|
def commits(project, options={})
|
18
|
-
get("/projects/#{project}/repository/commits", :
|
18
|
+
get("/projects/#{project}/repository/commits", query: options)
|
19
19
|
end
|
20
20
|
alias_method :repo_commits, :commits
|
21
21
|
|
@@ -58,7 +58,7 @@ class Gitlab::Client
|
|
58
58
|
# @option options [Integer] :per_page The number of results per page.
|
59
59
|
# @return [Array<Gitlab::ObjectifiedHash>]
|
60
60
|
def commit_comments(project, commit, options={})
|
61
|
-
get("/projects/#{project}/repository/commits/#{commit}/comments", :
|
61
|
+
get("/projects/#{project}/repository/commits/#{commit}/comments", query: options)
|
62
62
|
end
|
63
63
|
alias_method :repo_commit_comments, :commit_comments
|
64
64
|
|
@@ -76,7 +76,7 @@ class Gitlab::Client
|
|
76
76
|
# @option options [String] :line_type The line type (new or old).
|
77
77
|
# @return [Gitlab::ObjectifiedHash] Information about created comment.
|
78
78
|
def create_commit_comment(project, commit, note, options={})
|
79
|
-
post("/projects/#{project}/repository/commits/#{commit}/comments", :
|
79
|
+
post("/projects/#{project}/repository/commits/#{commit}/comments", body: options.merge(note: note))
|
80
80
|
end
|
81
81
|
alias_method :repo_create_commit_comment, :create_commit_comment
|
82
82
|
|
@@ -94,7 +94,7 @@ class Gitlab::Client
|
|
94
94
|
# @option options [String] :stage Filter by stage
|
95
95
|
# @option options [String] :name Filer 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(id, sha, options
|
97
|
+
def commit_status(id, sha, options={})
|
98
98
|
get("/projects/#{id}/repository/commits/#{sha}/statuses", query: options)
|
99
99
|
end
|
100
100
|
alias_method :repo_commit_status, :commit_status
|
@@ -113,7 +113,7 @@ 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 Filer 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(id, sha, state, options
|
116
|
+
def update_commit_status(id, sha, state, options={})
|
117
117
|
post("/projects/#{id}/statuses/#{sha}", query: options.merge(state: state))
|
118
118
|
end
|
119
119
|
alias_method :repo_update_commit_status, :update_commit_status
|
data/lib/gitlab/client/groups.rb
CHANGED
@@ -13,7 +13,7 @@ class Gitlab::Client
|
|
13
13
|
# @option options [Integer] :per_page The number of results per page.
|
14
14
|
# @return [Array<Gitlab::ObjectifiedHash>]
|
15
15
|
def groups(options={})
|
16
|
-
get("/groups", :
|
16
|
+
get("/groups", query: options)
|
17
17
|
end
|
18
18
|
|
19
19
|
# Gets a single group.
|
@@ -37,8 +37,8 @@ class Gitlab::Client
|
|
37
37
|
# @param [String] path The path of a group.
|
38
38
|
# @return [Gitlab::ObjectifiedHash] Information about created group.
|
39
39
|
def create_group(name, path, options={})
|
40
|
-
body = {:
|
41
|
-
post("/groups", :
|
40
|
+
body = { name: name, path: path }.merge(options)
|
41
|
+
post("/groups", body: body)
|
42
42
|
end
|
43
43
|
|
44
44
|
# Get a list of group members.
|
@@ -53,7 +53,7 @@ class Gitlab::Client
|
|
53
53
|
# @option options [Integer] :per_page The number of results per page.
|
54
54
|
# @return [Array<Gitlab::ObjectifiedHash>]
|
55
55
|
def group_members(id, options={})
|
56
|
-
get("/groups/#{id}/members", :
|
56
|
+
get("/groups/#{id}/members", query: options)
|
57
57
|
end
|
58
58
|
|
59
59
|
# Adds a user to group.
|
@@ -66,7 +66,7 @@ class Gitlab::Client
|
|
66
66
|
# @param [Integer] access_level Project access level.
|
67
67
|
# @return [Gitlab::ObjectifiedHash] Information about added team member.
|
68
68
|
def add_group_member(team_id, user_id, access_level)
|
69
|
-
post("/groups/#{team_id}/members", :
|
69
|
+
post("/groups/#{team_id}/members", body: { user_id: user_id, access_level: access_level })
|
70
70
|
end
|
71
71
|
|
72
72
|
# Removes user from user group.
|
@@ -89,8 +89,8 @@ class Gitlab::Client
|
|
89
89
|
# @param [Integer] id The ID of a group.
|
90
90
|
# @param [Integer] project_id The ID of a project.
|
91
91
|
def transfer_project_to_group(id, project_id)
|
92
|
-
body = {:
|
93
|
-
post("/groups/#{id}/projects/#{project_id}", :
|
92
|
+
body = { id: id, project_id: project_id }
|
93
|
+
post("/groups/#{id}/projects/#{project_id}", body: body)
|
94
94
|
end
|
95
95
|
|
96
96
|
# Search for groups by name
|
@@ -105,8 +105,7 @@ class Gitlab::Client
|
|
105
105
|
# @return [Array<Gitlab::ObjectifiedHash>]
|
106
106
|
def group_search(search, options={})
|
107
107
|
options[:search] = search
|
108
|
-
get("/groups", :
|
108
|
+
get("/groups", query: options)
|
109
109
|
end
|
110
|
-
|
111
110
|
end
|
112
111
|
end
|
data/lib/gitlab/client/issues.rb
CHANGED
@@ -17,9 +17,9 @@ class Gitlab::Client
|
|
17
17
|
# @return [Array<Gitlab::ObjectifiedHash>]
|
18
18
|
def issues(project=nil, options={})
|
19
19
|
if project.to_i.zero?
|
20
|
-
get("/issues", :
|
20
|
+
get("/issues", query: options)
|
21
21
|
else
|
22
|
-
get("/projects/#{project}/issues", :
|
22
|
+
get("/projects/#{project}/issues", query: options)
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
@@ -50,8 +50,8 @@ class Gitlab::Client
|
|
50
50
|
# @option options [String] :labels Comma-separated label names for an issue.
|
51
51
|
# @return [Gitlab::ObjectifiedHash] Information about created issue.
|
52
52
|
def create_issue(project, title, options={})
|
53
|
-
body = {:title
|
54
|
-
post("/projects/#{project}/issues", :
|
53
|
+
body = { title: title }.merge(options)
|
54
|
+
post("/projects/#{project}/issues", body: body)
|
55
55
|
end
|
56
56
|
|
57
57
|
# Updates an issue.
|
@@ -70,7 +70,7 @@ class Gitlab::Client
|
|
70
70
|
# @option options [String] :state_event The state event of an issue ('close' or 'reopen').
|
71
71
|
# @return [Gitlab::ObjectifiedHash] Information about updated issue.
|
72
72
|
def edit_issue(project, id, options={})
|
73
|
-
put("/projects/#{project}/issues/#{id}", :
|
73
|
+
put("/projects/#{project}/issues/#{id}", body: options)
|
74
74
|
end
|
75
75
|
|
76
76
|
# Closes an issue.
|
@@ -82,7 +82,7 @@ class Gitlab::Client
|
|
82
82
|
# @param [Integer] id The ID of an issue.
|
83
83
|
# @return [Gitlab::ObjectifiedHash] Information about closed issue.
|
84
84
|
def close_issue(project, id)
|
85
|
-
put("/projects/#{project}/issues/#{id}", :
|
85
|
+
put("/projects/#{project}/issues/#{id}", body: { state_event: 'close' })
|
86
86
|
end
|
87
87
|
|
88
88
|
# Reopens an issue.
|
@@ -94,7 +94,7 @@ class Gitlab::Client
|
|
94
94
|
# @param [Integer] id The ID of an issue.
|
95
95
|
# @return [Gitlab::ObjectifiedHash] Information about reopened issue.
|
96
96
|
def reopen_issue(project, id)
|
97
|
-
put("/projects/#{project}/issues/#{id}", :
|
97
|
+
put("/projects/#{project}/issues/#{id}", body: { state_event: 'reopen' })
|
98
98
|
end
|
99
99
|
end
|
100
100
|
end
|
data/lib/gitlab/client/labels.rb
CHANGED
@@ -23,7 +23,7 @@ class Gitlab::Client
|
|
23
23
|
# @option [String] color The color of a label.
|
24
24
|
# @return [Gitlab::ObjectifiedHash] Information about created label.
|
25
25
|
def create_label(project, name, color)
|
26
|
-
post("/projects/#{project}/labels", :
|
26
|
+
post("/projects/#{project}/labels", body: { name: name, color: color })
|
27
27
|
end
|
28
28
|
|
29
29
|
# Updates a label.
|
@@ -39,7 +39,7 @@ class Gitlab::Client
|
|
39
39
|
# @option options [String] :color The color of a label.
|
40
40
|
# @return [Gitlab::ObjectifiedHash] Information about updated label.
|
41
41
|
def edit_label(project, name, options={})
|
42
|
-
put("/projects/#{project}/labels", :
|
42
|
+
put("/projects/#{project}/labels", body: options.merge(name: name))
|
43
43
|
end
|
44
44
|
|
45
45
|
# Deletes a label.
|
@@ -51,7 +51,7 @@ class Gitlab::Client
|
|
51
51
|
# @param [String] name The name of a label.
|
52
52
|
# @return [Gitlab::ObjectifiedHash] Information about deleted label.
|
53
53
|
def delete_label(project, name)
|
54
|
-
delete("/projects/#{project}/labels", :
|
54
|
+
delete("/projects/#{project}/labels", body: { name: name })
|
55
55
|
end
|
56
56
|
end
|
57
57
|
end
|
@@ -14,7 +14,7 @@ class Gitlab::Client
|
|
14
14
|
# @option options [Integer] :per_page The number of results per page.
|
15
15
|
# @return [Array<Gitlab::ObjectifiedHash>]
|
16
16
|
def merge_requests(project, options={})
|
17
|
-
get("/projects/#{project}/merge_requests", :
|
17
|
+
get("/projects/#{project}/merge_requests", query: options)
|
18
18
|
end
|
19
19
|
|
20
20
|
# Gets a single merge request.
|
@@ -46,8 +46,8 @@ class Gitlab::Client
|
|
46
46
|
# @option options [Integer] :target_project_id (optional) The target project ID.
|
47
47
|
# @return [Gitlab::ObjectifiedHash] Information about created merge request.
|
48
48
|
def create_merge_request(project, title, options={})
|
49
|
-
body = {:title
|
50
|
-
post("/projects/#{project}/merge_requests", :
|
49
|
+
body = { title: title }.merge(options)
|
50
|
+
post("/projects/#{project}/merge_requests", body: body)
|
51
51
|
end
|
52
52
|
|
53
53
|
# Updates a merge request.
|
@@ -65,7 +65,7 @@ class Gitlab::Client
|
|
65
65
|
# @option options [String] :state_event New state (close|reopen|merge).
|
66
66
|
# @return [Gitlab::ObjectifiedHash] Information about updated merge request.
|
67
67
|
def update_merge_request(project, id, options={})
|
68
|
-
put("/projects/#{project}/merge_request/#{id}", :
|
68
|
+
put("/projects/#{project}/merge_request/#{id}", body: options)
|
69
69
|
end
|
70
70
|
|
71
71
|
# Accepts a merge request.
|
@@ -79,7 +79,7 @@ class Gitlab::Client
|
|
79
79
|
# @option options [String] :merge_commit_message Custom merge commit message
|
80
80
|
# @return [Gitlab::ObjectifiedHash] Information about updated merge request.
|
81
81
|
def accept_merge_request(project, id, options={})
|
82
|
-
put("/projects/#{project}/merge_request/#{id}/merge", :
|
82
|
+
put("/projects/#{project}/merge_request/#{id}/merge", body: options)
|
83
83
|
end
|
84
84
|
|
85
85
|
# Adds a comment to a merge request.
|
@@ -93,7 +93,7 @@ class Gitlab::Client
|
|
93
93
|
# @param [String] note The content of a comment.
|
94
94
|
# @return [Gitlab::ObjectifiedHash] Information about created merge request comment.
|
95
95
|
def create_merge_request_comment(project, id, note)
|
96
|
-
post("/projects/#{project}/merge_request/#{id}/comments", :
|
96
|
+
post("/projects/#{project}/merge_request/#{id}/comments", body: { note: note })
|
97
97
|
end
|
98
98
|
|
99
99
|
# Gets the comments on a merge request.
|
@@ -109,7 +109,7 @@ class Gitlab::Client
|
|
109
109
|
# @option options [Integer] :per_page The number of results per page.
|
110
110
|
# @return [Gitlab::ObjectifiedHash] The merge request's comments.
|
111
111
|
def merge_request_comments(project, id, options={})
|
112
|
-
get("/projects/#{project}/merge_request/#{id}/comments", :
|
112
|
+
get("/projects/#{project}/merge_request/#{id}/comments", query: options)
|
113
113
|
end
|
114
114
|
|
115
115
|
# Gets the changes of a merge request.
|