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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 73bb439a66d34332f9a1e4826dd3a7f496de2c33f062ff620d82e03979681f9d
4
- data.tar.gz: 9fc1183ce82f6d63dd52f05ed6d37ec5577705e6aaf68f289b3b2668342a779f
3
+ metadata.gz: 582e8443c88697422dce0cac775b4e6f541f139caea1f8a57268e252bacfaf3d
4
+ data.tar.gz: 50ed563e01f28b931b1223ba2dbadaf84b07fcb4160168f88836093628c46612
5
5
  SHA512:
6
- metadata.gz: a3bc802ca041b68b71d2f32794d90c4a0e45aa475a483bf5cdda090b2d5823834875b8578b0aa4d30ad3f0385905d094996972fbed3652116d08891d6f6de0dd
7
- data.tar.gz: c48c44840a43e753d96050a0e123103265b295c2ed7eb296243fbe50a8f65bf43ec400dd6bd30d3117a407ee8a7074df7caf7a53ac251b46f0d4b8a2a92874f8
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-memberships GitLab API > Users > Get memberships
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(filters)}"
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitlab_support_readiness
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Colyer