gitlab 3.6.1 → 3.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +2 -0
- data/CHANGELOG.md +25 -0
- data/README.md +9 -2
- data/gitlab.gemspec +5 -1
- data/lib/gitlab.rb +3 -2
- data/lib/gitlab/cli_helpers.rb +8 -3
- data/lib/gitlab/client.rb +6 -0
- data/lib/gitlab/client/build_triggers.rb +51 -0
- data/lib/gitlab/client/build_variables.rb +66 -0
- data/lib/gitlab/client/builds.rb +106 -0
- data/lib/gitlab/client/commits.rb +5 -5
- data/lib/gitlab/client/groups.rb +36 -3
- data/lib/gitlab/client/issues.rb +16 -3
- data/lib/gitlab/client/labels.rb +2 -2
- data/lib/gitlab/client/merge_requests.rb +49 -8
- data/lib/gitlab/client/milestones.rb +1 -1
- data/lib/gitlab/client/notes.rb +28 -1
- data/lib/gitlab/client/projects.rb +60 -7
- data/lib/gitlab/client/repositories.rb +1 -32
- data/lib/gitlab/client/runners.rb +115 -0
- data/lib/gitlab/client/services.rb +48 -0
- data/lib/gitlab/client/snippets.rb +2 -2
- data/lib/gitlab/client/tags.rb +96 -0
- data/lib/gitlab/client/users.rb +72 -2
- data/lib/gitlab/error.rb +53 -10
- data/lib/gitlab/file_response.rb +45 -0
- data/lib/gitlab/help.rb +1 -0
- data/lib/gitlab/objectified_hash.rb +1 -1
- data/lib/gitlab/paginated_response.rb +2 -2
- data/lib/gitlab/request.rb +13 -34
- data/lib/gitlab/version.rb +1 -1
- data/spec/fixtures/build.json +38 -0
- data/spec/fixtures/build_artifacts.json +0 -0
- data/spec/fixtures/build_cancel.json +24 -0
- data/spec/fixtures/build_erase.json +24 -0
- data/spec/fixtures/build_retry.json +24 -0
- data/spec/fixtures/builds.json +78 -0
- data/spec/fixtures/builds_commits.json +64 -0
- data/spec/fixtures/error_project_not_found.json +1 -0
- data/spec/fixtures/git_hook.json +1 -0
- data/spec/fixtures/group_delete.json +1 -0
- data/spec/fixtures/group_member_edit.json +1 -0
- data/spec/fixtures/group_projects.json +44 -0
- data/spec/fixtures/merge_request_commits.json +1 -0
- data/spec/fixtures/project_runner_enable.json +7 -0
- data/spec/fixtures/project_runners.json +16 -0
- data/spec/fixtures/release_create.json +1 -0
- data/spec/fixtures/release_update.json +1 -0
- data/spec/fixtures/runner.json +26 -0
- data/spec/fixtures/runner_delete.json +7 -0
- data/spec/fixtures/runner_edit.json +26 -0
- data/spec/fixtures/runners.json +16 -0
- data/spec/fixtures/runners_all.json +30 -0
- data/spec/fixtures/service.json +1 -0
- data/spec/fixtures/tag.json +1 -0
- data/spec/fixtures/tag_create.json +1 -0
- data/spec/fixtures/tag_create_with_description.json +1 -0
- data/spec/fixtures/tag_delete.json +1 -0
- data/spec/fixtures/tags.json +1 -0
- data/spec/fixtures/trigger.json +7 -0
- data/spec/fixtures/triggers.json +16 -0
- data/spec/fixtures/user_email.json +1 -0
- data/spec/fixtures/user_emails.json +1 -0
- data/spec/fixtures/user_search.json +1 -0
- data/spec/fixtures/variable.json +4 -0
- data/spec/fixtures/variables.json +10 -0
- data/spec/gitlab/client/build_triggers_spec.rb +67 -0
- data/spec/gitlab/client/build_variables_spec.rb +86 -0
- data/spec/gitlab/client/builds_spec.rb +148 -0
- data/spec/gitlab/client/groups_spec.rb +51 -0
- data/spec/gitlab/client/issues_spec.rb +16 -0
- data/spec/gitlab/client/merge_requests_spec.rb +27 -4
- data/spec/gitlab/client/notes_spec.rb +32 -0
- data/spec/gitlab/client/projects_spec.rb +79 -0
- data/spec/gitlab/client/runners_spec.rb +185 -0
- data/spec/gitlab/client/services_spec.rb +55 -0
- data/spec/gitlab/client/tags_spec.rb +109 -0
- data/spec/gitlab/client/users_spec.rb +136 -0
- data/spec/gitlab/error_spec.rb +45 -0
- data/spec/gitlab/file_response_spec.rb +28 -0
- data/spec/gitlab/help_spec.rb +6 -1
- data/spec/gitlab/request_spec.rb +0 -27
- data/spec/gitlab/shell_spec.rb +1 -1
- data/spec/spec_helper.rb +2 -2
- metadata +131 -23
- checksums.yaml +0 -7
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,30 @@
|
|
1
1
|
## Change Log
|
2
2
|
|
3
|
+
### 3.7.0 (16/08/2016)
|
4
|
+
|
5
|
+
- Add in GitlabCI Runner support (@davidcollum)
|
6
|
+
- Implemented tags API methods (@jblackman)
|
7
|
+
- Expose response status when Gitlab raises an error. (@calavera)
|
8
|
+
- Add `build_artifacts` method (@nanofi)
|
9
|
+
- Add `user_search` method (@Dreeg)
|
10
|
+
- Added project git hook support (@liger1978)
|
11
|
+
- Add the ability to delete an issue (@dandunckelman)
|
12
|
+
- Add missing Build APIs (@edgemaster)
|
13
|
+
- Improve record table output to use Hash `id` field if it exists. (@asedge)
|
14
|
+
- Support for listing merge request notes (@dlukman)
|
15
|
+
- Update YARD so it can be formatted easier for the CLI. (@asedge)
|
16
|
+
- Add `options` to `build` method (@sanderhahn)
|
17
|
+
- Add `delete_group` method (@shadeslayer)
|
18
|
+
- Add `group_projects` method (@shadeslayer)
|
19
|
+
- Add `edit_merge_request_comment` (@hjanuschka)
|
20
|
+
- Add `merge_request_commits` method (@nomeaning777)
|
21
|
+
- Add method `edit_group_member` (@coder-hugo)
|
22
|
+
- New builds endpoints (@kmarcisz)
|
23
|
+
- Use `respond_to_missing?` instead of `respond_to?` (@tsigo)
|
24
|
+
- Added possibility to change emails of user (@azomazo)
|
25
|
+
- Added possibility to change services in the project (@azomazo)
|
26
|
+
- Update README.md (@walterheck)
|
27
|
+
|
3
28
|
### 3.6.1 (13/12/2015)
|
4
29
|
|
5
30
|
- Fixed CLI output for collections
|
data/README.md
CHANGED
@@ -105,8 +105,7 @@ For more information, refer to [documentation](http://rubydoc.info/gems/gitlab/f
|
|
105
105
|
|
106
106
|
## CLI
|
107
107
|
|
108
|
-
|
109
|
-
|
108
|
+
It is possible to use this gem as a command line interface to gitlab. In order to make that work you need to set a few environment variables:
|
110
109
|
```sh
|
111
110
|
export GITLAB_API_ENDPOINT=https://gitlab.yourcompany.com/api/v3
|
112
111
|
export GITLAB_API_PRIVATE_TOKEN=<your private token from /profile/account>
|
@@ -116,16 +115,23 @@ export GITLAB_API_PRIVATE_TOKEN=<your private token from /profile/account>
|
|
116
115
|
export GITLAB_API_HTTPARTY_OPTIONS="{verify: false}"
|
117
116
|
```
|
118
117
|
|
118
|
+
Usage:
|
119
|
+
|
120
|
+
When you want to know which CLI commands are supported, take a look at the client [commands implemented in this gem](http://www.rubydoc.info/gems/gitlab/3.4.0/Gitlab/Client). Any of those methods can be called as a command by passing the parameters of the commands as parameters of the CLI.
|
121
|
+
|
119
122
|
Usage examples:
|
120
123
|
|
121
124
|
```sh
|
122
125
|
# list users
|
126
|
+
# see: http://www.rubydoc.info/gems/gitlab/3.4.0/Gitlab/Client/Users#users-instance_method
|
123
127
|
gitlab users
|
124
128
|
|
125
129
|
# get current user
|
130
|
+
# see: http://www.rubydoc.info/gems/gitlab/3.4.0/Gitlab/Client/Users#user-instance_method
|
126
131
|
gitlab user
|
127
132
|
|
128
133
|
# get a user
|
134
|
+
# see: http://www.rubydoc.info/gems/gitlab/3.4.0/Gitlab/Client/Users#user-instance_method
|
129
135
|
gitlab user 2
|
130
136
|
|
131
137
|
# filter output
|
@@ -137,6 +143,7 @@ gitlab user --except=email,bio
|
|
137
143
|
gitlab user 2 --json
|
138
144
|
|
139
145
|
# passing options hash to a command (use YAML)
|
146
|
+
# see: http://www.rubydoc.info/gems/gitlab/3.4.0/Gitlab/Client/MergeRequests#create_merge_request-instance_method
|
140
147
|
gitlab create_merge_request 4 "New merge request" "{source_branch: 'new_branch', target_branch: 'master', assignee_id: 42}"
|
141
148
|
|
142
149
|
```
|
data/gitlab.gemspec
CHANGED
@@ -19,7 +19,11 @@ Gem::Specification.new do |gem|
|
|
19
19
|
gem.require_paths = ["lib"]
|
20
20
|
gem.license = "BSD"
|
21
21
|
|
22
|
-
|
22
|
+
if RUBY_VERSION < '2.0'
|
23
|
+
gem.add_runtime_dependency 'httparty', '~> 0.13.0'
|
24
|
+
else
|
25
|
+
gem.add_runtime_dependency 'httparty'
|
26
|
+
end
|
23
27
|
gem.add_runtime_dependency 'terminal-table'
|
24
28
|
|
25
29
|
gem.add_development_dependency 'pry'
|
data/lib/gitlab.rb
CHANGED
@@ -4,6 +4,7 @@ require 'gitlab/configuration'
|
|
4
4
|
require 'gitlab/error'
|
5
5
|
require 'gitlab/page_links'
|
6
6
|
require 'gitlab/paginated_response'
|
7
|
+
require 'gitlab/file_response'
|
7
8
|
require 'gitlab/request'
|
8
9
|
require 'gitlab/api'
|
9
10
|
require 'gitlab/client'
|
@@ -25,8 +26,8 @@ module Gitlab
|
|
25
26
|
end
|
26
27
|
|
27
28
|
# Delegate to Gitlab::Client
|
28
|
-
def
|
29
|
-
client.respond_to?(
|
29
|
+
def respond_to_missing?(method_name, include_private = false)
|
30
|
+
client.respond_to?(method_name) || super
|
30
31
|
end
|
31
32
|
|
32
33
|
# Delegate to HTTParty.http_proxy
|
data/lib/gitlab/cli_helpers.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'yaml'
|
2
2
|
require 'json'
|
3
|
+
require 'base64'
|
3
4
|
|
4
5
|
class Gitlab::CLI
|
5
6
|
# Defines methods related to CLI output and formatting.
|
@@ -91,7 +92,7 @@ class Gitlab::CLI
|
|
91
92
|
# Outputs a nicely formatted table or error msg.
|
92
93
|
def output_table(cmd, args, data)
|
93
94
|
case data
|
94
|
-
when Gitlab::ObjectifiedHash
|
95
|
+
when Gitlab::ObjectifiedHash, Gitlab::FileResponse
|
95
96
|
puts record_table([data], cmd, args)
|
96
97
|
when Gitlab::PaginatedResponse
|
97
98
|
puts record_table(data, cmd, args)
|
@@ -105,7 +106,7 @@ class Gitlab::CLI
|
|
105
106
|
puts '{}'
|
106
107
|
else
|
107
108
|
hash_result = case data
|
108
|
-
when Gitlab::ObjectifiedHash
|
109
|
+
when Gitlab::ObjectifiedHash,Gitlab::FileResponse
|
109
110
|
record_hash([data], cmd, args, true)
|
110
111
|
when Gitlab::PaginatedResponse
|
111
112
|
record_hash(data, cmd, args)
|
@@ -134,7 +135,9 @@ class Gitlab::CLI
|
|
134
135
|
keys.each do |key|
|
135
136
|
case value = hash[key]
|
136
137
|
when Hash
|
137
|
-
value = 'Hash'
|
138
|
+
value = value.has_key?('id') ? value['id'] : 'Hash'
|
139
|
+
when StringIO
|
140
|
+
value = 'File'
|
138
141
|
when nil
|
139
142
|
value = 'null'
|
140
143
|
end
|
@@ -168,6 +171,8 @@ class Gitlab::CLI
|
|
168
171
|
case hash[key]
|
169
172
|
when Hash
|
170
173
|
row[key] = 'Hash'
|
174
|
+
when StringIO
|
175
|
+
row[key] = Base64.encode64(hash[key].read)
|
171
176
|
when nil
|
172
177
|
row[key] = nil
|
173
178
|
else
|
data/lib/gitlab/client.rb
CHANGED
@@ -4,6 +4,9 @@ module Gitlab
|
|
4
4
|
Dir[File.expand_path('../client/*.rb', __FILE__)].each { |f| require f }
|
5
5
|
|
6
6
|
include Branches
|
7
|
+
include Builds
|
8
|
+
include BuildTriggers
|
9
|
+
include BuildVariables
|
7
10
|
include Commits
|
8
11
|
include Groups
|
9
12
|
include Issues
|
@@ -15,8 +18,11 @@ module Gitlab
|
|
15
18
|
include Projects
|
16
19
|
include Repositories
|
17
20
|
include RepositoryFiles
|
21
|
+
include Runners
|
22
|
+
include Services
|
18
23
|
include Snippets
|
19
24
|
include SystemHooks
|
25
|
+
include Tags
|
20
26
|
include Users
|
21
27
|
end
|
22
28
|
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
class Gitlab::Client
|
2
|
+
# Defines methods related to builds.
|
3
|
+
# @see https://github.com/gitlabhq/gitlabhq/blob/master/doc/api/build_triggers.md
|
4
|
+
module BuildTriggers
|
5
|
+
# Gets a list of the project's build triggers
|
6
|
+
#
|
7
|
+
# @example
|
8
|
+
# Gitlab.triggers(5)
|
9
|
+
#
|
10
|
+
# @param [Integer] project The ID of a project.
|
11
|
+
# @return [Array<Gitlab::ObjectifiedHash>] The list of triggers.
|
12
|
+
def triggers(project)
|
13
|
+
get("/projects/#{project}/triggers")
|
14
|
+
end
|
15
|
+
|
16
|
+
# Gets details of project's build trigger.
|
17
|
+
#
|
18
|
+
# @example
|
19
|
+
# Gitlab.trigger(5, '7b9148c158980bbd9bcea92c17522d')
|
20
|
+
#
|
21
|
+
# @param [Integer] project The ID of a project.
|
22
|
+
# @param [String] token The token of a trigger.
|
23
|
+
# @return [Gitlab::ObjectifiedHash] The trigger.
|
24
|
+
def trigger(project, token)
|
25
|
+
get("/projects/#{project}/triggers/#{token}")
|
26
|
+
end
|
27
|
+
|
28
|
+
# Create a build trigger for a project.
|
29
|
+
#
|
30
|
+
# @example
|
31
|
+
# Gitlab.create_trigger(5)
|
32
|
+
#
|
33
|
+
# @param [Integer] project The ID of a project.
|
34
|
+
# @return [Gitlab::ObjectifiedHash] The trigger.
|
35
|
+
def create_trigger(project)
|
36
|
+
post("/projects/#{project}/triggers")
|
37
|
+
end
|
38
|
+
|
39
|
+
# Remove a project's build trigger.
|
40
|
+
#
|
41
|
+
# @example
|
42
|
+
# Gitlab.remove_trigger(5, '7b9148c158980bbd9bcea92c17522d')
|
43
|
+
#
|
44
|
+
# @param [Integer] project The ID of a project.
|
45
|
+
# @param [String] token The token of a trigger.
|
46
|
+
# @return [Gitlab::ObjectifiedHash] The trigger.
|
47
|
+
def remove_trigger(project, token)
|
48
|
+
delete("/projects/#{project}/triggers/#{token}")
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
class Gitlab::Client
|
2
|
+
# Defines methods related to builds.
|
3
|
+
# @see https://github.com/gitlabhq/gitlabhq/blob/master/doc/api/build_variables.md
|
4
|
+
module BuildVariables
|
5
|
+
# Gets a list of the project's build variables
|
6
|
+
#
|
7
|
+
# @example
|
8
|
+
# Gitlab.variables(5)
|
9
|
+
#
|
10
|
+
# @param [Integer] project The ID of a project.
|
11
|
+
# @return [Array<Gitlab::ObjectifiedHash>] The list of variables.
|
12
|
+
def variables(project)
|
13
|
+
get("/projects/#{project}/variables")
|
14
|
+
end
|
15
|
+
|
16
|
+
# Gets details of a project's specific build variable.
|
17
|
+
#
|
18
|
+
# @example
|
19
|
+
# Gitlab.build(5, "TEST_VARIABLE_1")
|
20
|
+
#
|
21
|
+
# @param [Integer] project The ID of a project.
|
22
|
+
# @param [String] key The key of a variable.
|
23
|
+
# @return [Gitlab::ObjectifiedHash] The variable.
|
24
|
+
def variable(project, key)
|
25
|
+
get("/projects/#{project}/variables/#{key}")
|
26
|
+
end
|
27
|
+
|
28
|
+
# Create a build variable for a project.
|
29
|
+
#
|
30
|
+
# @example
|
31
|
+
# Gitlab.create_variable(5, "NEW_VARIABLE", "new value")
|
32
|
+
#
|
33
|
+
# @param [Integer] project The ID of a project.
|
34
|
+
# @param [String] key The key of a variable; must have no more than 255 characters; only `A-Z`, `a-z`, `0-9` and `_` are allowed
|
35
|
+
# @param [String] value The value of a variable
|
36
|
+
# @return [Gitlab::ObjectifiedHash] The variable.
|
37
|
+
def create_variable(project, key, value)
|
38
|
+
post("/projects/#{project}/variables", body: { key: key, value: value })
|
39
|
+
end
|
40
|
+
|
41
|
+
# Update a project's build variable.
|
42
|
+
#
|
43
|
+
# @example
|
44
|
+
# Gitlab.create_variable(5, "NEW_VARIABLE", "updated value")
|
45
|
+
#
|
46
|
+
# @param [Integer] project The ID of a project.
|
47
|
+
# @param [String] key The key of a variable
|
48
|
+
# @param [String] value The value of a variable
|
49
|
+
# @return [Gitlab::ObjectifiedHash] The variable.
|
50
|
+
def update_variable(project, key, value)
|
51
|
+
put("/projects/#{project}/variables/#{key}", body: { value: value })
|
52
|
+
end
|
53
|
+
|
54
|
+
# Remove a project's build variable.
|
55
|
+
#
|
56
|
+
# @example
|
57
|
+
# Gitlab.remove_variable(5, "VARIABLE_1")
|
58
|
+
#
|
59
|
+
# @param [Integer] project The ID of a project.
|
60
|
+
# @param [String] key The key of a variable.
|
61
|
+
# @return [Gitlab::ObjectifiedHash] The variable.
|
62
|
+
def remove_variable(project, key)
|
63
|
+
delete("/projects/#{project}/variables/#{key}")
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1,106 @@
|
|
1
|
+
class Gitlab::Client
|
2
|
+
# Defines methods related to builds.
|
3
|
+
# @see https://github.com/gitlabhq/gitlabhq/blob/master/doc/api/builds.md
|
4
|
+
module Builds
|
5
|
+
# Gets a list of project builds.
|
6
|
+
#
|
7
|
+
# @example
|
8
|
+
# Gitlab.builds(5)
|
9
|
+
# Gitlab.builds(5, { per_page: 10, page: 2 })
|
10
|
+
#
|
11
|
+
# @param [Integer] project The ID of a project.
|
12
|
+
# @param [Hash] options A customizable set of options.
|
13
|
+
# @option options [Integer] :page The page number.
|
14
|
+
# @option options [Integer] :per_page The number of results per page.
|
15
|
+
# @param [Integer] project The ID of a project.
|
16
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
17
|
+
def builds(project, options={})
|
18
|
+
get("/projects/#{project}/builds", query: options)
|
19
|
+
end
|
20
|
+
|
21
|
+
# Gets a single build.
|
22
|
+
#
|
23
|
+
# @example
|
24
|
+
# Gitlab.build(5, 36)
|
25
|
+
#
|
26
|
+
# @param [Integer] project The ID of a project.
|
27
|
+
# @param [Integer] id The ID of a build.
|
28
|
+
# @return [Gitlab::ObjectifiedHash]
|
29
|
+
def build(project, id)
|
30
|
+
get("/projects/#{project}/builds/#{id}")
|
31
|
+
end
|
32
|
+
|
33
|
+
# Gets build artifacts.
|
34
|
+
#
|
35
|
+
# @example
|
36
|
+
# Gitlab.build_artifacts(1, 8)
|
37
|
+
#
|
38
|
+
# @param [Integer] project The ID of a project.
|
39
|
+
# @param [Integer] id The ID of a build.
|
40
|
+
# @return [Gitlab::FileResponse]
|
41
|
+
def build_artifacts(project, id)
|
42
|
+
get("/projects/#{project}/builds/#{id}/artifacts",
|
43
|
+
format: nil,
|
44
|
+
headers: { Accept: 'application/octet-stream' },
|
45
|
+
parser: proc { |body, _|
|
46
|
+
if body.encoding == Encoding::ASCII_8BIT # binary response
|
47
|
+
::Gitlab::FileResponse.new StringIO.new(body, 'rb+')
|
48
|
+
else # error with json response
|
49
|
+
::Gitlab::Request.parse(body)
|
50
|
+
end
|
51
|
+
})
|
52
|
+
end
|
53
|
+
|
54
|
+
# Gets a list of builds for specific commit in a project.
|
55
|
+
#
|
56
|
+
# @example
|
57
|
+
# Gitlab.commit_builds(5, 'asdf')
|
58
|
+
# Gitlab.commit_builds(5, 'asdf', { per_page: 10, page: 2 })
|
59
|
+
#
|
60
|
+
# @param [Integer] project The ID of a project.
|
61
|
+
# @param [String] sha The SHA checksum of a commit.
|
62
|
+
# @param [Hash] options A customizable set of options.
|
63
|
+
# @option options [Integer] :page The page number.
|
64
|
+
# @option options [Integer] :per_page The number of results per page.
|
65
|
+
# @return [Array<Gitlab::ObjectifiedHash>] The list of builds.
|
66
|
+
def commit_builds(project, sha, options={})
|
67
|
+
get("/projects/#{project}/repository/commits/#{sha}/builds", query: options)
|
68
|
+
end
|
69
|
+
|
70
|
+
# Cancels a build.
|
71
|
+
#
|
72
|
+
# @example
|
73
|
+
# Gitlab.build_cancel(5, 1)
|
74
|
+
#
|
75
|
+
# @param [Integer] project The ID of a project.
|
76
|
+
# @param [Integer] id The ID of a build.
|
77
|
+
# @return [Gitlab::ObjectifiedHash] The builds changes.
|
78
|
+
def build_cancel(project, id)
|
79
|
+
post("/projects/#{project}/builds/#{id}/cancel")
|
80
|
+
end
|
81
|
+
|
82
|
+
# Retry a build.
|
83
|
+
#
|
84
|
+
# @example
|
85
|
+
# Gitlab.build_retry(5, 1)
|
86
|
+
#
|
87
|
+
# @param [Integer] project The ID of a project.
|
88
|
+
# @param [Integer] id The ID of a build.
|
89
|
+
# @return [Array<Gitlab::ObjectifiedHash>] The builds changes.
|
90
|
+
def build_retry(project, id)
|
91
|
+
post("/projects/#{project}/builds/#{id}/retry")
|
92
|
+
end
|
93
|
+
|
94
|
+
# Erase a single build of a project (remove build artifacts and a build trace)
|
95
|
+
#
|
96
|
+
# @example
|
97
|
+
# Gitlab.build_erase(5, 1)
|
98
|
+
#
|
99
|
+
# @param [Integer] project The ID of a project.
|
100
|
+
# @param [Integer] id The ID of a build.
|
101
|
+
# @return [Gitlab::ObjectifiedHash] The build's changes.
|
102
|
+
def build_erase(project, id)
|
103
|
+
post("/projects/#{project}/builds/#{id}/erase")
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
@@ -6,7 +6,7 @@ class Gitlab::Client
|
|
6
6
|
#
|
7
7
|
# @example
|
8
8
|
# Gitlab.commits('viking')
|
9
|
-
# Gitlab.repo_commits('gitlab', :
|
9
|
+
# Gitlab.repo_commits('gitlab', { ref_name: 'api' })
|
10
10
|
#
|
11
11
|
# @param [Integer] project The ID of a project.
|
12
12
|
# @param [Hash] options A customizable set of options.
|
@@ -84,8 +84,8 @@ class Gitlab::Client
|
|
84
84
|
#
|
85
85
|
# @example
|
86
86
|
# Gitlab.commit_status(42, '6104942438c14ec7bd21c6cd5bd995272b3faff6')
|
87
|
-
# Gitlab.commit_status(42, '6104942438c14ec7bd21c6cd5bd995272b3faff6', name: 'jenkins')
|
88
|
-
# Gitlab.commit_status(42, '6104942438c14ec7bd21c6cd5bd995272b3faff6', name: 'jenkins', all: true)
|
87
|
+
# Gitlab.commit_status(42, '6104942438c14ec7bd21c6cd5bd995272b3faff6', { name: 'jenkins' })
|
88
|
+
# Gitlab.commit_status(42, '6104942438c14ec7bd21c6cd5bd995272b3faff6', { name: 'jenkins', all: true })
|
89
89
|
#
|
90
90
|
# @param [Integer] project The ID of a project.
|
91
91
|
# @param [String] sha The commit hash
|
@@ -103,8 +103,8 @@ class Gitlab::Client
|
|
103
103
|
#
|
104
104
|
# @example
|
105
105
|
# Gitlab.update_commit_status(42, '6104942438c14ec7bd21c6cd5bd995272b3faff6', 'success')
|
106
|
-
# Gitlab.update_commit_status(42, '6104942438c14ec7bd21c6cd5bd995272b3faff6', 'failed', name: 'jenkins')
|
107
|
-
# Gitlab.update_commit_status(42, '6104942438c14ec7bd21c6cd5bd995272b3faff6', 'canceled', name: 'jenkins', target_url: 'http://example.com/builds/1')
|
106
|
+
# Gitlab.update_commit_status(42, '6104942438c14ec7bd21c6cd5bd995272b3faff6', 'failed', { name: 'jenkins' })
|
107
|
+
# Gitlab.update_commit_status(42, '6104942438c14ec7bd21c6cd5bd995272b3faff6', 'canceled', { name: 'jenkins', target_url: 'http://example.com/builds/1' })
|
108
108
|
#
|
109
109
|
# @param [Integer] project The ID of a project.
|
110
110
|
# @param [String] sha The commit hash
|
data/lib/gitlab/client/groups.rb
CHANGED
@@ -6,7 +6,7 @@ class Gitlab::Client
|
|
6
6
|
#
|
7
7
|
# @example
|
8
8
|
# Gitlab.groups
|
9
|
-
# Gitlab.groups(:
|
9
|
+
# Gitlab.groups({ per_page: 40, page: 2 })
|
10
10
|
#
|
11
11
|
# @param [Hash] options A customizable set of options.
|
12
12
|
# @option options [Integer] :page The page number.
|
@@ -31,7 +31,7 @@ class Gitlab::Client
|
|
31
31
|
#
|
32
32
|
# @example
|
33
33
|
# Gitlab.create_group('new-group', 'group-path')
|
34
|
-
# Gitlab.create_group('gitlab', 'gitlab-path', :
|
34
|
+
# Gitlab.create_group('gitlab', 'gitlab-path', { description: 'New Gitlab project' })
|
35
35
|
#
|
36
36
|
# @param [String] name The name of a group.
|
37
37
|
# @param [String] path The path of a group.
|
@@ -41,11 +41,21 @@ class Gitlab::Client
|
|
41
41
|
post("/groups", body: body)
|
42
42
|
end
|
43
43
|
|
44
|
+
# Delete's a group.
|
45
|
+
#
|
46
|
+
# @example
|
47
|
+
# Gitlab.delete_group(42)
|
48
|
+
# @param [Integer] id The ID of a group
|
49
|
+
# @return [Gitlab::ObjectifiedHash] Information about the deleted group.
|
50
|
+
def delete_group(id)
|
51
|
+
delete("/groups/#{id}")
|
52
|
+
end
|
53
|
+
|
44
54
|
# Get a list of group members.
|
45
55
|
#
|
46
56
|
# @example
|
47
57
|
# Gitlab.group_members(1)
|
48
|
-
# Gitlab.group_members(1, :
|
58
|
+
# Gitlab.group_members(1, { per_page: 40 })
|
49
59
|
#
|
50
60
|
# @param [Integer] id The ID of a group.
|
51
61
|
# @param [Hash] options A customizable set of options.
|
@@ -69,6 +79,19 @@ class Gitlab::Client
|
|
69
79
|
post("/groups/#{team_id}/members", body: { user_id: user_id, access_level: access_level })
|
70
80
|
end
|
71
81
|
|
82
|
+
# Edit a user of a group.
|
83
|
+
#
|
84
|
+
# @example
|
85
|
+
# Gitlab.edit_group_member(1, 2, 40)
|
86
|
+
#
|
87
|
+
# @param [Integer] team_id The group id of member to edit.
|
88
|
+
# @param [Integer] user_id The user id of the user to edit.
|
89
|
+
# @param [Integer] access_level Project access level.
|
90
|
+
# @return [Gitlab::ObjectifiedHash] Information about edited team member.
|
91
|
+
def edit_group_member(team_id, user_id, access_level)
|
92
|
+
put("/groups/#{team_id}/members/#{user_id}", body: { access_level: access_level })
|
93
|
+
end
|
94
|
+
|
72
95
|
# Removes user from user group.
|
73
96
|
#
|
74
97
|
# @example
|
@@ -107,5 +130,15 @@ class Gitlab::Client
|
|
107
130
|
options[:search] = search
|
108
131
|
get("/groups", query: options)
|
109
132
|
end
|
133
|
+
|
134
|
+
# Get a list of projects under a group
|
135
|
+
# @example
|
136
|
+
# Gitlab.group_projects(1)
|
137
|
+
#
|
138
|
+
# @param [Integer] id The ID of a group
|
139
|
+
# @return [Array<Gitlab::ObjectifiedHash>] List of projects under a group
|
140
|
+
def group_projects(id, options={})
|
141
|
+
get("/groups/#{id}/projects", query: options)
|
142
|
+
end
|
110
143
|
end
|
111
144
|
end
|