gitlab 4.14.1 → 4.15.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 48548fb1b0cb1145ddc1591038d00e2e8cc9d77f2706b7fd1859f1c1cd86a5d0
4
- data.tar.gz: d020265f65c8934d01084995a6158940c5202cf3dbb292b6f035083b8ea400fd
3
+ metadata.gz: f31547d74eb68a029e6ececac63595ce326ac6094976d95e05ab48f1d204af82
4
+ data.tar.gz: eb18b54380caf556ada2c54475e2a15b0c4fc6b4f88fab3910c15b0db707d949
5
5
  SHA512:
6
- metadata.gz: 3af0c595e321a96ef904347bcbca00cd7644ea5a2583f45be1a89488075257a2d71148bec458fa044192c434184ad9d80377ef5123d55a6a24962566c0727447
7
- data.tar.gz: e45b946e1d380fe4a9312f33cf828ea1c446b10eea13d88822a24879358db89c937ba4634c2dd6bb4fa866a8b61368cbecad97aa7820ce2343fb01386cb102d6
6
+ metadata.gz: 7d5f11f031804e7881179e148766674d9aaf403b3bc2675e17d64c82c404d44ed71187b0942ae181843ccc8b5273fc585f35e17427983fd1e6c856497fb919f2
7
+ data.tar.gz: d5dd62edc23d215fdd48d20af5c8d544ea7afc32418ea10764a27c231ca9a9060fedd3ee5bbc8d456eaa91120ecd43584f7baf819ecd67168a8dcefbd9b15f41
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Gitlab
2
2
 
3
- [![Build Status](https://img.shields.io/github/workflow/status/NARKOZ/gitlab/Ruby/master)](https://github.com/NARKOZ/gitlab/actions?query=workflow%3ARuby)
3
+ [![Build Status](https://img.shields.io/github/workflow/status/NARKOZ/gitlab/CI/master)](https://github.com/NARKOZ/gitlab/actions?query=workflow%3ARuby)
4
4
  [![Maintainability](https://api.codeclimate.com/v1/badges/2e310b334b1b5db4a7e1/maintainability)](https://codeclimate.com/github/NARKOZ/gitlab)
5
5
  [![Inline docs](https://inch-ci.org/github/NARKOZ/gitlab.svg)](https://inch-ci.org/github/NARKOZ/gitlab)
6
6
  [![Gem version](https://img.shields.io/gem/v/gitlab.svg)](https://rubygems.org/gems/gitlab)
@@ -19,6 +19,7 @@ module Gitlab
19
19
  include ContainerRegistry
20
20
  include Deployments
21
21
  include Environments
22
+ include EpicIssues
22
23
  include Epics
23
24
  include Events
24
25
  include Features
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Gitlab::Client
4
+ # Defines methods related to issues.
5
+ # @see https://docs.gitlab.com/ee/api/epic_issues.html
6
+ module EpicIssues
7
+ # List issues for an epic.
8
+ # Gets all issues that are assigned to an epic and the authenticated user has access to..
9
+ # @example
10
+ # Gitlab.epic_issues(5, 7)
11
+ # Gitlab.epic_issues(5, 7, { per_page: 40 })
12
+ #
13
+ # @param [Integer, String] group The ID or name of a group.
14
+ # @param [Integer] epic The iid of an epic.
15
+ # @param [Hash] options A customizable set of options.
16
+ # @option options [Integer] :page The page number.
17
+ # @option options [Integer] :per_page The number of results per page.
18
+ # @return [Array<Gitlab::ObjectifiedHash>]
19
+ def epic_issues(group, epic, options = {})
20
+ get("/groups/#{url_encode group}/epics/#{epic}/issues", query: options)
21
+ end
22
+ end
23
+ end
@@ -31,6 +31,62 @@ class Gitlab::Client
31
31
  post("/projects/#{url_encode project}/approvals", body: options)
32
32
  end
33
33
 
34
+ # Gets MR Approval Rules for a project
35
+ #
36
+ # @example
37
+ # Gitlab.project_merge_request_approval_rules(1)
38
+ #
39
+ # @param [Integer] project The ID of a project.
40
+ # @return [Gitlab::ObjectifiedHash] MR approval rules for the project
41
+ def project_merge_request_approval_rules(project)
42
+ get("/projects/#{url_encode project}/approval_rules")
43
+ end
44
+
45
+ # Create MR Approval Rule for a project
46
+ #
47
+ # @example
48
+ # Gitlab.create_project_merge_request_approval_rule(1, {name: "security", approvals_required: 1})
49
+ #
50
+ # @param [Integer] project(required) The ID of a project.
51
+ # @option options [String] :name(required) The name of the approval rule
52
+ # @option options [Integer] :approvals_required(required) The number of required approvals for this rule
53
+ # @option options [Array] :user_ids(optional) The ids of users as approvers
54
+ # @option options [Array] :group_ids(optional) The ids of groups as approvers
55
+ # @option options [Array] :protected_branch_ids(optional) The ids of protected branches to scope the rule by
56
+ # @return [Gitlab::ObjectifiedHash] New MR approval rule
57
+ def create_project_merge_request_approval_rule(project, options = {})
58
+ post("/projects/#{url_encode project}/approval_rules", body: options)
59
+ end
60
+
61
+ # Update MR Approval Rule for a project
62
+ #
63
+ # @example
64
+ # Gitlab.update_project_merge_request_approval_rule(1, {name: "security", approvals_required: 2})
65
+ #
66
+ # @param [Integer] project(required) The ID of a project.
67
+ # @param [Integer] approval_rule_id(required) The ID of a project Approval Rule
68
+ # @option options [String] :name(required) The name of the approval rule
69
+ # @option options [Integer] :approvals_required(required) The number of required approvals for this rule
70
+ # @option options [Array] :user_ids(optional) The ids of users as approvers
71
+ # @option options [Array] :group_ids(optional) The ids of groups as approvers
72
+ # @option options [Array] :protected_branch_ids(optional) The ids of protected branches to scope the rule by
73
+ # @return [Gitlab::ObjectifiedHash] Updated MR approval rule
74
+ def update_project_merge_request_approval_rule(project, approval_rule_id, options = {})
75
+ put("/projects/#{url_encode project}/approval_rules/#{approval_rule_id}", body: options)
76
+ end
77
+
78
+ # Delete MR Approval Rule for a project
79
+ #
80
+ # @example
81
+ # Gitlab.delete_project_merge_request_approval_rule(1, 1)
82
+ #
83
+ # @param [Integer] project(required) The ID of a project.
84
+ # @param [Integer] approval_rule_id(required) The ID of a approval rule
85
+ # @return [void] This API call returns an empty response body
86
+ def delete_project_merge_request_approval_rule(project, approval_rule_id)
87
+ delete("/projects/#{url_encode project}/approval_rules/#{approval_rule_id}")
88
+ end
89
+
34
90
  # Change allowed approvers and approver groups for a project
35
91
  #
36
92
  # @example
@@ -60,6 +60,20 @@ class Gitlab::Client
60
60
  end
61
61
  alias merge_request_comments merge_request_notes
62
62
 
63
+ # Gets a list of notes for an epic.
64
+ #
65
+ # @example
66
+ # Gitlab.epic_notes(5, 10)
67
+ #
68
+ # @param [Integer] project The ID of a group.
69
+ # @param [Integer] epic The ID of an epic.
70
+ # @option options [Integer] :page The page number.
71
+ # @option options [Integer] :per_page The number of results per page.
72
+ # @return [Array<Gitlab::ObjectifiedHash>]
73
+ def epic_notes(group, epic, options = {})
74
+ get("/groups/#{url_encode group}/epics/#{epic}/notes", query: options)
75
+ end
76
+
63
77
  # Gets a single wall note.
64
78
  #
65
79
  # @example
@@ -162,6 +176,19 @@ class Gitlab::Client
162
176
  end
163
177
  alias create_merge_request_comment create_merge_request_note
164
178
 
179
+ # Creates a new epic note.
180
+ #
181
+ # @example
182
+ # Gitlab.create_epic_note(6, 1, 'Adding a note to my epic.')
183
+ #
184
+ # @param [Integer, String] group The ID or name of a group.
185
+ # @param [Integer] epic The ID of an epic.
186
+ # @param [String] body The body of a note.
187
+ # @return [Gitlab::ObjectifiedHash] Information about created note.
188
+ def create_epic_note(group, epic, body)
189
+ post("/groups/#{url_encode group}/epics/#{epic}/notes", body: { body: body })
190
+ end
191
+
165
192
  # Deletes a wall note.
166
193
  #
167
194
  # @example
@@ -123,6 +123,20 @@ class Gitlab::Client
123
123
  post('/session', body: { email: email, password: password }, unauthenticated: true)
124
124
  end
125
125
 
126
+ # Gets a list of user activities (for admin access only).
127
+ #
128
+ # @example
129
+ # Gitlab.activities
130
+ #
131
+ # @param [Hash] options A customizable set of options.
132
+ # @option options [Integer] :page The page number.
133
+ # @option options [Integer] :per_page The number of results per page.
134
+ # @option options [String] :from The start date for paginated results.
135
+ # @return [Array<Gitlab::ObjectifiedHash>]
136
+ def activities(options = {})
137
+ get('/user/activities', query: options)
138
+ end
139
+
126
140
  # Gets a list of user's SSH keys.
127
141
  #
128
142
  # @example
@@ -63,6 +63,14 @@ module Gitlab
63
63
  else
64
64
  @response.parsed_response
65
65
  end
66
+ rescue Gitlab::Error::Parsing
67
+ # Return stringified response when receiving a
68
+ # parsing error to avoid obfuscation of the
69
+ # api error.
70
+ #
71
+ # note: The Gitlab API does not always return valid
72
+ # JSON when there are errors.
73
+ @response.to_s
66
74
  end
67
75
 
68
76
  # Handle error response message in case of nested hashes
@@ -83,8 +83,7 @@ module Gitlab
83
83
  def last_page
84
84
  return nil if @client.nil? || !has_last_page?
85
85
 
86
- path = @links.last.sub(/#{@client.endpoint}/, '')
87
- @client.get(path)
86
+ @client.get(client_relative_path(@links.last))
88
87
  end
89
88
 
90
89
  def first_page?
@@ -95,8 +94,7 @@ module Gitlab
95
94
  def first_page
96
95
  return nil if @client.nil? || !has_first_page?
97
96
 
98
- path = @links.first.sub(/#{@client.endpoint}/, '')
99
- @client.get(path)
97
+ @client.get(client_relative_path(@links.first))
100
98
  end
101
99
 
102
100
  def next_page?
@@ -107,8 +105,7 @@ module Gitlab
107
105
  def next_page
108
106
  return nil if @client.nil? || !has_next_page?
109
107
 
110
- path = @links.next.sub(/#{@client.endpoint}/, '')
111
- @client.get(path)
108
+ @client.get(client_relative_path(@links.next))
112
109
  end
113
110
 
114
111
  def prev_page?
@@ -119,8 +116,12 @@ module Gitlab
119
116
  def prev_page
120
117
  return nil if @client.nil? || !has_prev_page?
121
118
 
122
- path = @links.prev.sub(/#{@client.endpoint}/, '')
123
- @client.get(path)
119
+ @client.get(client_relative_path(@links.prev))
120
+ end
121
+
122
+ def client_relative_path(link)
123
+ client_endpoint_path = URI.parse(@client.endpoint).request_uri # api/v4
124
+ URI.parse(link).request_uri.sub(client_endpoint_path, '')
124
125
  end
125
126
  end
126
127
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Gitlab
4
- VERSION = '4.14.1'
4
+ VERSION = '4.15.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.14.1
4
+ version: 4.15.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: 2020-03-12 00:00:00.000000000 Z
12
+ date: 2020-05-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: httparty
@@ -124,6 +124,7 @@ files:
124
124
  - lib/gitlab/client/container_registry.rb
125
125
  - lib/gitlab/client/deployments.rb
126
126
  - lib/gitlab/client/environments.rb
127
+ - lib/gitlab/client/epic_issues.rb
127
128
  - lib/gitlab/client/epics.rb
128
129
  - lib/gitlab/client/events.rb
129
130
  - lib/gitlab/client/features.rb