Class: Sem::API::Users

Inherits:
Base
  • Object
show all
Extended by:
Traits::AssociatedWithOrg, Traits::AssociatedWithTeam
Defined in:
lib/sem/api/users.rb

Constant Summary

Constants inherited from Base

Base::CREDENTIALS_PATH

Class Method Summary collapse

Methods included from Traits::AssociatedWithOrg

list_for_org

Methods included from Traits::AssociatedWithTeam

add_to_team, list_for_team, remove_from_team

Methods inherited from Base

client

Class Method Details

.apiObject



17
18
19
# File 'lib/sem/api/users.rb', line 17

def self.api
  client.users
end

.info(name) ⇒ Object



13
14
15
# File 'lib/sem/api/users.rb', line 13

def self.info(name)
  list.find { |user| user[:id] == name }
end

.listObject



7
8
9
10
11
# File 'lib/sem/api/users.rb', line 7

def self.list
  org_names = Orgs.list.map { |org| org[:username] }

  org_names.map { |name| list_for_org(name) }.flatten
end

.to_hash(user) ⇒ Object



21
22
23
# File 'lib/sem/api/users.rb', line 21

def self.to_hash(user)
  { :id => user.username }
end