Class: Geet::Gitlab::User

Inherits:
Object
  • Object
show all
Defined in:
lib/geet/gitlab/user.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, username, api_interface) ⇒ User

Returns a new instance of User.



8
9
10
11
12
# File 'lib/geet/gitlab/user.rb', line 8

def initialize(id, username, api_interface)
  @id = id
  @username = username
  @api_interface = api_interface
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



6
7
8
# File 'lib/geet/gitlab/user.rb', line 6

def id
  @id
end

#usernameObject (readonly)

Returns the value of attribute username.



6
7
8
# File 'lib/geet/gitlab/user.rb', line 6

def username
  @username
end

Class Method Details

.list_collaborators(api_interface) ⇒ Object

Returns an array of User instances



16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/geet/gitlab/user.rb', line 16

def self.list_collaborators(api_interface, **)
  api_path = "projects/#{api_interface.path_with_namespace(encoded: true)}/members"

  response = api_interface.send_request(api_path, multipage: true)

  response.map do |user_entry|
    id = user_entry.fetch('id')
    username = user_entry.fetch('username')

    new(id, username, api_interface)
  end
end