gitlab 4.9.0 → 4.10.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6829c32454f11e11d6b7b3b15dbebaeda3b439ac5b21b6a47bf52526dc742237
4
- data.tar.gz: bfb53a22f9838c806ae52cac72fa65abde209c6dd09baea4308587e24a0d9aa3
3
+ metadata.gz: 1ffd49c727596fb28465bceabb3674b310772840169be0b80cacfbd2a415e266
4
+ data.tar.gz: 0f1ca4531f96bf17b640880089db77284336b69832fa5bbab31d35d60c128e4f
5
5
  SHA512:
6
- metadata.gz: 8084547f4db3b39bbd1fb477d8a8e79dea2c73f6490551d0dfd77e685628ac57aabd8e02dca188898b7a1c04dd0083bfde9682767beb993fe86cd28522b268af
7
- data.tar.gz: 2a7cd1d37840894dcb1e5653b565993beba6109f11961f2ddf3930739244151887cf40e28bcddad2e0394ff25610fadabd19ad63d3fbc8755112c548267bdbff
6
+ metadata.gz: f758f2a0b714d8ef390cb65ebe39d7fbc48f4e3230b252e79ee82ec4e5f0e352e4499fdf6df0f913f4799ccb3db4caaecfd5ed9a37463a330b4593d147de0494
7
+ data.tar.gz: 879cc8c1b0432435c3868dde4ad0f943875c8b719021f7c8b5965a775db8b3172ab0b239daa643b1e7f8575519ba5cf60963f7c2c2c858ec93e592e687bb89c3
data/README.md CHANGED
@@ -11,7 +11,7 @@
11
11
  [gitlab-live](https://github.com/NARKOZ/gitlab-live)
12
12
 
13
13
  Gitlab is a Ruby wrapper and CLI for the [GitLab API](https://docs.gitlab.com/ce/api/README.html).
14
- As of version `4.0.0` this gem only supports Ruby 2.0+ and GitLab API v4.
14
+ As of version `4.0.0` this gem only supports GitLab API v4.
15
15
 
16
16
  ## Installation
17
17
 
@@ -7,6 +7,7 @@ module Gitlab
7
7
 
8
8
  # Please keep in alphabetical order
9
9
  include AccessRequests
10
+ include Avatar
10
11
  include AwardEmojis
11
12
  include Boards
12
13
  include Branches
@@ -18,6 +19,8 @@ module Gitlab
18
19
  include Environments
19
20
  include Events
20
21
  include Features
22
+ include GroupBoards
23
+ include GroupLabels
21
24
  include GroupMilestones
22
25
  include Groups
23
26
  include Issues
@@ -43,6 +46,7 @@ module Gitlab
43
46
  include RepositorySubmodules
44
47
  include ResourceLabelEvents
45
48
  include Runners
49
+ include Search
46
50
  include Services
47
51
  include Sidekiq
48
52
  include Snippets
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Gitlab::Client
4
+ # Defines methods related to avatar.
5
+ # @see https://docs.gitlab.com/ce/api/avatar.html
6
+ module Avatar
7
+ # Get a single avatar URL for a user with the given email address.
8
+ #
9
+ # @example
10
+ # Gitlab.avatar(email: 'admin@example.com')
11
+ # Gitlab.avatar(email: 'admin@example.com', size: 32)
12
+ #
13
+ # @param [Hash] options A customizable set of options.
14
+ # @option options [String] :email(required) Public email address of the user.
15
+ # @option options [Integer] :size(optional) Single pixel dimension (since images are squares). Only used for avatar lookups at Gravatar or at the configured Libravatar server.
16
+ # @return <Gitlab::ObjectifiedHash>
17
+ def avatar(options = {})
18
+ get('/avatar', query: options)
19
+ end
20
+ end
21
+ end
@@ -19,6 +19,62 @@ class Gitlab::Client
19
19
  get("/projects/#{url_encode project}/boards", query: options)
20
20
  end
21
21
 
22
+ # Get a single board.
23
+ #
24
+ # @example
25
+ # Gitlab.board(5, 1)
26
+ #
27
+ # @param [Integer, String] project The ID or name of a project.
28
+ # @param [Integer] id The ID of a board.
29
+ # @return [Gitlab::ObjectifiedHash] Returns information about the board
30
+ def board(project, id)
31
+ get("/projects/#{url_encode project}/boards/#{id}")
32
+ end
33
+
34
+ # Creates a new board.
35
+ #
36
+ # @example
37
+ # Gitlab.create_board(5, 'newboard')
38
+ #
39
+ # @param [Integer, String] project The ID or name of a project.
40
+ # @param [String] name The name of the new board.
41
+ # @return [Gitlab::ObjectifiedHash] Information about created board.
42
+ def create_board(project, name)
43
+ body = { name: name }
44
+ post("/projects/#{url_encode project}/boards", body: body)
45
+ end
46
+
47
+ # Updates a board.
48
+ #
49
+ # @example
50
+ # Gitlab.edit_board(5, 1, name: 'new_name')
51
+ # Gitlab.edit_board(5, 1, name: 'new_name', assignee_id: 1, milestone_id: 1)
52
+ #
53
+ # @param [Integer, String] project The ID or name of a project.
54
+ # @param [Integer] id The ID of a board.
55
+ # @param [Hash] options A customizable set of options.
56
+ # @option options [String] :name(optional) The new name of the board.
57
+ # @option options [Integer] :assignee_id(optional) The assignee the board should be scoped to.
58
+ # @option options [Integer] :milestone_id(optional) The milestone the board should be scoped to.
59
+ # @option options [String] :labels(optional) Comma-separated list of label names which the board should be scoped to.
60
+ # @option options [Integer] :weight(optional) The weight range from 0 to 9, to which the board should be scoped to.
61
+ # @return [Gitlab::ObjectifiedHash] Information about updated board.
62
+ def edit_board(project, id, options = {})
63
+ put("/projects/#{url_encode project}/boards/#{id}", body: options)
64
+ end
65
+
66
+ # Deletes a board.
67
+ #
68
+ # @example
69
+ # Gitlab.delete_board(5, 1)
70
+ #
71
+ # @param [Integer, String] project The ID or name of a project.
72
+ # @param [Integer] id The ID of a board.
73
+ # @return [void] This API call returns an empty response body.
74
+ def delete_board(project, id)
75
+ delete("/projects/#{url_encode project}/boards/#{id}")
76
+ end
77
+
22
78
  # Gets a board lists
23
79
  #
24
80
  # @example
@@ -0,0 +1,141 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Gitlab::Client
4
+ # Defines methods related to group issue boards.
5
+ # @see https://docs.gitlab.com/ee/api/group_boards.html
6
+ module GroupBoards
7
+ # Lists Issue Boards in the given group.
8
+ #
9
+ # @example
10
+ # Gitlab.group_boards(5)
11
+ #
12
+ # @param [Integer, String] group The ID or name of a group.
13
+ # @return [Array<Gitlab::ObjectifiedHash>] List of issue boards of the group
14
+ def group_boards(group)
15
+ get("/groups/#{url_encode group}/boards")
16
+ end
17
+
18
+ # Gets a single group issue board.
19
+ #
20
+ # @example
21
+ # Gitlab.group_board(5, 1)
22
+ #
23
+ # @param [Integer, String] group The ID or name of a group.
24
+ # @param [Integer] id The ID of the issue board.
25
+ # @return [Gitlab::ObjectifiedHash] Returns information about a group issue board
26
+ def group_board(group, id)
27
+ get("/groups/#{url_encode group}/boards/#{id}")
28
+ end
29
+
30
+ # Creates a new group issue board.
31
+ #
32
+ # @example
33
+ # Gitlab.create_group_board(5, 'Documentcloud')
34
+ #
35
+ # @param [Integer, String] group The ID or name of a group.
36
+ # @param [String] name The name of the new board.
37
+ # @return [Gitlab::ObjectifiedHash] Information about created group issue board.
38
+ def create_group_board(group, name)
39
+ body = { name: name }
40
+ post("/groups/#{url_encode group}/boards", body: body)
41
+ end
42
+
43
+ # Updates a group issue board.
44
+ #
45
+ # @example
46
+ # Gitlab.edit_group_board(5, 1, { name: 'DocumentCloud2' })
47
+ # Gitlab.edit_group_board(5, 1, { name: 'DocumentCloud2', assignee_id: 3 })
48
+ #
49
+ # @param [Integer, String] group The ID or name of a group.
50
+ # @param [Integer] id The ID of the issue board.
51
+ # @param [Hash] options A customizable set of options.
52
+ # @option options [String] :name(optional) The new name of the board.
53
+ # @option options [Integer] :assignee_id(optional) The assignee the board should be scoped to.
54
+ # @option options [Integer] :milestone_id(optional) The milestone the board should be scoped to.
55
+ # @option options [String] :labels(optional) Comma-separated list of label names which the board should be scoped to.
56
+ # @option options [Integer] :weight(optional) The weight range from 0 to 9, to which the board should be scoped to.
57
+ # @return [Gitlab::ObjectifiedHash] Information about updated group issue board.
58
+ def edit_group_board(group, id, options = {})
59
+ put("/groups/#{url_encode group}/boards/#{id}", body: options)
60
+ end
61
+
62
+ # Deletes a group issue board.
63
+ #
64
+ # @example
65
+ # Gitlab.delete_group_board(5, 1)
66
+ #
67
+ # @param [Integer, String] group The ID or name of a group.
68
+ # @param [Integer] id The ID of the issue board.
69
+ # @return [void] This API call returns an empty response body.
70
+ def delete_group_board(group, id)
71
+ delete("/groups/#{url_encode group}/boards/#{id}")
72
+ end
73
+
74
+ # Get a list of the boards lists. Does not include open and closed lists
75
+ #
76
+ # @example
77
+ # Gitlab.group_board_lists(5, 1)
78
+ #
79
+ # @param [Integer, String] group The ID or name of a group.
80
+ # @param [Integer] board_id The ID of the group issue board.
81
+ # @return [Array<Gitlab::ObjectifiedHash>] List of boards lists of the group
82
+ def group_board_lists(group, board_id)
83
+ get("/groups/#{url_encode group}/boards/#{board_id}/lists")
84
+ end
85
+
86
+ # Get a single group issue board list.
87
+ #
88
+ # @example
89
+ # Gitlab.group_board_list(5, 1, 1)
90
+ #
91
+ # @param [Integer, String] group The ID or name of a group.
92
+ # @param [Integer] board_id The ID of the group issue board.
93
+ # @param [Integer] list_id The ID of a boards list.
94
+ # @return [Gitlab::ObjectifiedHash] Returns information about a single group issue board list
95
+ def group_board_list(group, board_id, id)
96
+ get("/groups/#{url_encode group}/boards/#{board_id}/lists/#{id}")
97
+ end
98
+
99
+ # Creates a new group issue board list.
100
+ #
101
+ # @example
102
+ # Gitlab.create_group_board_list(5, 1)
103
+ #
104
+ # @param [Integer, String] group The ID or name of a group.
105
+ # @param [Integer] board_id The ID of the group issue board.
106
+ # @param [Integer] label_id The ID of a label.
107
+ # @return [Gitlab::ObjectifiedHash] Information about created group issue board list.
108
+ def create_group_board_list(group, board_id, label_id)
109
+ body = { label_id: label_id }
110
+ post("/groups/#{url_encode group}/boards/#{board_id}/lists", body: body)
111
+ end
112
+
113
+ # Updates an existing group issue board list. This call is used to change list position.
114
+ #
115
+ # @example
116
+ # Gitlab.edit_group_board_list(5, 1, 1, { position: 1 })
117
+ #
118
+ # @param [Integer, String] group The ID or name of a group.
119
+ # @param [Integer] board_id The ID of the group issue board.
120
+ # @param [Integer] list_id The ID of a boards list.
121
+ # @param [Hash] options A customizable set of options.
122
+ # @option options [String] :position(required) The position of the list.
123
+ # @return [Gitlab::ObjectifiedHash] Information about updated group issue board list.
124
+ def edit_group_board_list(group, board_id, id, options = {})
125
+ put("/groups/#{url_encode group}/boards/#{board_id}/lists/#{id}", body: options)
126
+ end
127
+
128
+ # Deletes a group issue board list.
129
+ #
130
+ # @example
131
+ # Gitlab.delete_group_board_list(5, 1, 1)
132
+ #
133
+ # @param [Integer, String] group The ID or name of a group.
134
+ # @param [Integer] board_id The ID of the group issue board.
135
+ # @param [Integer] list_id The ID of a boards list.
136
+ # @return [void] This API call returns an empty response body.
137
+ def delete_group_board_list(group, board_id, id)
138
+ delete("/groups/#{url_encode group}/boards/#{board_id}/lists/#{id}")
139
+ end
140
+ end
141
+ end
@@ -0,0 +1,88 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Gitlab::Client
4
+ # Defines methods related to group labels.
5
+ #
6
+ # @note Requires GitLab 11.8+
7
+ # @see https://docs.gitlab.com/ee/api/group_labels.html
8
+ module GroupLabels
9
+ # Gets a list of group's labels.
10
+ #
11
+ # @example
12
+ # Gitlab.group_labels('globex')
13
+ #
14
+ # @param [Integer, String] group The ID or name of a group.
15
+ # @return [Array<Gitlab::ObjectifiedHash>]
16
+ def group_labels(group, options = {})
17
+ get("/groups/#{url_encode group}/labels", query: options)
18
+ end
19
+
20
+ # Creates a new group label.
21
+ #
22
+ # @example
23
+ # Gitlab.create_group_label('globex', 'Backlog', '#DD10AA')
24
+ #
25
+ # @param [Integer, String] group The ID or name of a group.
26
+ # @param [String] name The name of a label.
27
+ # @param [String] color The color of a label.
28
+ # @param [Hash] options A customizable set of options.
29
+ # @option options [String] :description The description of the label.
30
+ # @return [Gitlab::ObjectifiedHash] Information about created label.
31
+ def create_group_label(group, name, color, options = {})
32
+ post("/groups/#{url_encode group}/labels", body: options.merge(name: name, color: color))
33
+ end
34
+
35
+ # Updates a group label.
36
+ #
37
+ # @example
38
+ # Gitlab.edit_group_label('globex', 'Backlog', { new_name: 'Priority' })
39
+ # Gitlab.edit_group_label('globex', 'Backlog', { new_name: 'Priority', color: '#DD10AA' })
40
+ #
41
+ # @param [Integer, String] group The ID or name of a group.
42
+ # @param [String] name The name of a label.
43
+ # @param [Hash] options A customizable set of options.
44
+ # @option options [String] :new_name The new name of a label.
45
+ # @option options [String] :color The color of a label.
46
+ # @option options [String] :description The description of the label.
47
+ # @return [Gitlab::ObjectifiedHash] Information about updated label.
48
+ def edit_group_label(group, name, options = {})
49
+ put("/groups/#{url_encode group}/labels", body: options.merge(name: name))
50
+ end
51
+
52
+ # Deletes a group label.
53
+ #
54
+ # @example
55
+ # Gitlab.delete_group_label('globex', 'Backlog')
56
+ #
57
+ # @param [Integer, String] group The ID or name of a group.
58
+ # @param [String] name The name of a label.
59
+ # @return [Gitlab::ObjectifiedHash] Information about deleted label.
60
+ def delete_group_label(group, name)
61
+ delete("/groups/#{url_encode group}/labels", body: { name: name })
62
+ end
63
+
64
+ # Subscribes the user to a group label to receive notifications
65
+ #
66
+ # @example
67
+ # Gitlab.subscribe_to_group_label('globex', 'Backlog')
68
+ #
69
+ # @param [Integer, String] group The ID or name of a group.
70
+ # @param [String] name The name of a label.
71
+ # @return [Gitlab::ObjectifiedHash] Information about the label subscribed to.
72
+ def subscribe_to_group_label(group, name)
73
+ post("/groups/#{url_encode group}/labels/#{url_encode name}/subscribe")
74
+ end
75
+
76
+ # Unsubscribes the user from a group label to not receive notifications from it
77
+ #
78
+ # @example
79
+ # Gitlab.unsubscribe_from_group_label('globex', 'Backlog')
80
+ #
81
+ # @param [Integer, String] group The ID or name of a group.
82
+ # @param [String] name The name of a label.
83
+ # @return [Gitlab::ObjectifiedHash] Information about the label unsubscribed from.
84
+ def unsubscribe_from_group_label(group, name)
85
+ post("/groups/#{url_encode group}/labels/#{url_encode name}/unsubscribe")
86
+ end
87
+ end
88
+ end
@@ -191,5 +191,17 @@ class Gitlab::Client
191
191
  def edit_group(id, options = {})
192
192
  put("/groups/#{url_encode id}", body: options)
193
193
  end
194
+
195
+ # Gets a list of issues of a group.
196
+ #
197
+ # @example
198
+ # Gitlab.group_issues(5)
199
+ #
200
+ # @param [Integer, String] group_id The ID or name of a group.
201
+ # @param [Hash] options A customizable set of options.
202
+ # @return [Array<Gitlab::ObjectifiedHash>]
203
+ def group_issues(group, options = {})
204
+ get("/groups/#{group}/issues", query: options)
205
+ end
194
206
  end
195
207
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class Gitlab::Client
4
- # Defines methods related to labels.
4
+ # Defines methods related to project labels.
5
5
  # @see https://docs.gitlab.com/ce/api/labels.html
6
6
  module Labels
7
7
  # Gets a list of project's labels.
@@ -55,6 +55,18 @@ class Gitlab::Client
55
55
  get("/projects/#{url_encode project}/merge_requests/#{id}/pipelines")
56
56
  end
57
57
 
58
+ # Get a list of merge request participants.
59
+ #
60
+ # @example
61
+ # Gitlab.merge_request_participants(5, 36)
62
+ #
63
+ # @param [Integer, String] project The ID or name of a project.
64
+ # @param [Integer] id The ID of a merge request.
65
+ # @return [Array<Gitlab::ObjectifiedHash>]
66
+ def merge_request_participants(project, id)
67
+ get("/projects/#{url_encode project}/merge_requests/#{id}/participants")
68
+ end
69
+
58
70
  # Creates a merge request.
59
71
  #
60
72
  # @example
@@ -0,0 +1,62 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Gitlab::Client
4
+ # Defines methods related to global searches, searching in projects and searching in groups.
5
+ # @see https://docs.gitlab.com/ce/api/search.html
6
+ module Search
7
+ # Search globally across the GitLab instance.
8
+ #
9
+ # @example
10
+ # Gitlab.search_globally('projects', 'gitlab')
11
+ # Gitlab.search_globally('issues', 'gitlab')
12
+ # Gitlab.search_globally('merge_requests', 'gitlab')
13
+ # Gitlab.search_globally('milestones', 'gitlab')
14
+ # Gitlab.search_globally('snippet_titles', 'gitlab')
15
+ # Gitlab.search_globally('snippet_blobs', 'gitlab')
16
+ #
17
+ # @param [String] scope The scope to search in. Currently these scopes are supported: projects, issues, merge_requests, milestones, snippet_titles, snippet_blobs.
18
+ # @param [String] search The search query.
19
+ # @return [Array<Gitlab::ObjectifiedHash>] Returns a list of responses depending on the requested scope.
20
+ def search_globally(scope, search)
21
+ options = { scope: scope, search: search }
22
+ get('/search', query: options)
23
+ end
24
+
25
+ # Search within the specified group.
26
+ #
27
+ # @example
28
+ # Gitlab.search_in_group(1, 'projects', 'gitlab')
29
+ # Gitlab.search_in_group(1, 'issues', 'gitlab')
30
+ # Gitlab.search_in_group(1, 'merge_requests', 'gitlab')
31
+ # Gitlab.search_in_group(1, 'milestones', 'gitlab')
32
+ #
33
+ # @param [Integer, String] group The ID or name of a group.
34
+ # @param [String] scope The scope to search in. Currently these scopes are supported: projects, issues, merge_requests, milestones.
35
+ # @param [String] search The search query.
36
+ # @return [Array<Gitlab::ObjectifiedHash>] Returns a list of responses depending on the requested scope.
37
+ def search_in_group(group, scope, search)
38
+ options = { scope: scope, search: search }
39
+ get("/groups/#{url_encode group}/search", query: options)
40
+ end
41
+
42
+ # Search within the specified project.
43
+ #
44
+ # @example
45
+ # Gitlab.search_in_project(1, 'issues', 'gitlab')
46
+ # Gitlab.search_in_project(1, 'merge_requests', 'gitlab')
47
+ # Gitlab.search_in_project(1, 'milestones', 'gitlab')
48
+ # Gitlab.search_in_project(1, 'notes', 'gitlab')
49
+ # Gitlab.search_in_project(1, 'wiki_blobs', 'gitlab')
50
+ # Gitlab.search_in_project(1, 'commits', 'gitlab')
51
+ # Gitlab.search_in_project(1, 'blobs', 'gitlab')
52
+ #
53
+ # @param [Integer, String] project The ID or name of a project.
54
+ # @param [String] scope The scope to search in. Currently these scopes are supported: issues, merge_requests, milestones, notes, wiki_blobs, commits, blobs.
55
+ # @param [String] search The search query.
56
+ # @return [Array<Gitlab::ObjectifiedHash>] Returns a list of responses depending on the requested scope.
57
+ def search_in_project(project, scope, search)
58
+ options = { scope: scope, search: search }
59
+ get("/projects/#{url_encode project}/search", query: options)
60
+ end
61
+ end
62
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Gitlab
4
- VERSION = '4.9.0'
4
+ VERSION = '4.10.0'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitlab
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.9.0
4
+ version: 4.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nihad Abbasov
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2019-02-04 00:00:00.000000000 Z
12
+ date: 2019-02-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: httparty
@@ -140,6 +140,7 @@ files:
140
140
  - lib/gitlab/cli_helpers.rb
141
141
  - lib/gitlab/client.rb
142
142
  - lib/gitlab/client/access_requests.rb
143
+ - lib/gitlab/client/avatar.rb
143
144
  - lib/gitlab/client/award_emojis.rb
144
145
  - lib/gitlab/client/boards.rb
145
146
  - lib/gitlab/client/branches.rb
@@ -151,6 +152,8 @@ files:
151
152
  - lib/gitlab/client/environments.rb
152
153
  - lib/gitlab/client/events.rb
153
154
  - lib/gitlab/client/features.rb
155
+ - lib/gitlab/client/group_boards.rb
156
+ - lib/gitlab/client/group_labels.rb
154
157
  - lib/gitlab/client/group_milestones.rb
155
158
  - lib/gitlab/client/groups.rb
156
159
  - lib/gitlab/client/issues.rb
@@ -176,6 +179,7 @@ files:
176
179
  - lib/gitlab/client/repository_submodules.rb
177
180
  - lib/gitlab/client/resource_label_events.rb
178
181
  - lib/gitlab/client/runners.rb
182
+ - lib/gitlab/client/search.rb
179
183
  - lib/gitlab/client/services.rb
180
184
  - lib/gitlab/client/sidekiq.rb
181
185
  - lib/gitlab/client/snippets.rb