gitlab_support_readiness 1.0.2 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/support_readiness/gitlab/users.rb +26 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 582e8443c88697422dce0cac775b4e6f541f139caea1f8a57268e252bacfaf3d
|
4
|
+
data.tar.gz: 50ed563e01f28b931b1223ba2dbadaf84b07fcb4160168f88836093628c46612
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a12a6db551a8b9858552ca839270a8e02c88c462c6350c1122c0c544493b7d3c567dbdcfad05a73ff0e28fbf833c1408b156caab336876fb91f0bda2d645563f
|
7
|
+
data.tar.gz: c03884a82ef3e2f2fc39964af9936d9ad058dc6b946fbe30f998c67977b66976935d4f88d347b1db11578970950cbfc70eac9f90a9937050666056301f9dff7e
|
@@ -213,7 +213,7 @@ module Readiness
|
|
213
213
|
# @param user [Object] An instance of {Readiness::GitLab::Users}
|
214
214
|
# @param params [Array] An array of filter Strings to use. Should be in the format of key=value
|
215
215
|
# @return [Array]
|
216
|
-
# @see https://docs.gitlab.com/ee/api/users.html#user-
|
216
|
+
# @see https://docs.gitlab.com/ee/api/users.html#get-a-list-of-projects-and-groups-that-a-user-is-a-member-of GitLab API > Users > Get a list of projects and groups that a user is a member of
|
217
217
|
# @example
|
218
218
|
# require 'support_readiness'
|
219
219
|
# config = Readiness::GitLab::Configuration.new
|
@@ -227,7 +227,7 @@ module Readiness
|
|
227
227
|
array = []
|
228
228
|
page = 1
|
229
229
|
loop do
|
230
|
-
response = client.connection.get "users/#{user.id}/memberships?per_page=100&page=#{page}&#{to_param_string(
|
230
|
+
response = client.connection.get "users/#{user.id}/memberships?per_page=100&page=#{page}&#{to_param_string(params)}"
|
231
231
|
handle_request_error(0, 'GitLab', response.status) unless response.status == 200
|
232
232
|
body = Oj.load(response.body)
|
233
233
|
array += body
|
@@ -483,6 +483,30 @@ module Readiness
|
|
483
483
|
handle_request_error(1, 'GitLab', response.status, { action: 'Unblock a user', id: user.id }) unless response.status == 201
|
484
484
|
true
|
485
485
|
end
|
486
|
+
|
487
|
+
##
|
488
|
+
# Fetches the email addresses for a user
|
489
|
+
#
|
490
|
+
# @author Jason Colyer
|
491
|
+
# @since 1.0.3
|
492
|
+
# @param client [Object] An instance of {Readiness::GitLab::Client}
|
493
|
+
# @param user [Object] An instance of {Readiness::GitLab::Users}
|
494
|
+
# @return [Array]
|
495
|
+
# @see https://docs.gitlab.com/ee/api/user_email_addresses.html#list-email-addresses-for-a-user GitLab API > Users > User email addresses > List email addresses for a user
|
496
|
+
# @example
|
497
|
+
# require 'support_readiness'
|
498
|
+
# config = Readiness::GitLab::Configuration.new
|
499
|
+
# config.token = 'test123abc'
|
500
|
+
# client = Readiness::GitLab::Client.new(config)
|
501
|
+
# user = Readiness::GitLab::Users.find!(client, 2672834)
|
502
|
+
# emails = Readiness::GitLab::Users.emails(client, user)
|
503
|
+
# pp emaiks.first['email']
|
504
|
+
# # => 'alice+test@example.com'
|
505
|
+
def self.emails(client, user)
|
506
|
+
response = client.connection.get "users/#{user.id}/emails"
|
507
|
+
handle_request_error(0, 'GitLab', response.status) unless response.status == 200
|
508
|
+
Oj.load(response.body)
|
509
|
+
end
|
486
510
|
end
|
487
511
|
end
|
488
512
|
end
|