summaryrefslogtreecommitdiff
path: root/lib/mattermost/team.rb
diff options
context:
space:
mode:
authorZ.J. van de Weg <git@zjvandeweg.nl>2016-12-19 14:14:09 +0100
committerZ.J. van de Weg <git@zjvandeweg.nl>2016-12-19 14:14:09 +0100
commit6d14a6640f89893792ad6c66b7f4362ef4ff9007 (patch)
tree7109c818a61f5b92e34e5202a7a544d1d191ad62 /lib/mattermost/team.rb
parent4213bd56dea1d6cdbfa8baed8faa7e3ab86e61ab (diff)
downloadgitlab-ce-6d14a6640f89893792ad6c66b7f4362ef4ff9007.tar.gz
Minor adjustments API Mattermost
[ci skip]
Diffstat (limited to 'lib/mattermost/team.rb')
-rw-r--r--lib/mattermost/team.rb17
1 files changed, 8 insertions, 9 deletions
diff --git a/lib/mattermost/team.rb b/lib/mattermost/team.rb
index 714748aea3c..9e1b22623a3 100644
--- a/lib/mattermost/team.rb
+++ b/lib/mattermost/team.rb
@@ -1,21 +1,20 @@
module Mattermost
- class Team < Session
- def self.team_admin
- return [] unless initial_load['team_members']
+ class Team
+ def self.team_admin(session)
+ response_body = initial_load(session)
+ return [] unless response_body['team_members']
- team_ids = initial_load['team_members'].map do |team|
+ team_ids = response_body['team_members'].map do |team|
team['team_id'] if team['roles'].split.include?('team_admin')
end.compact
- initial_load['teams'].select do |team|
+ response_body['teams'].select do |team|
team_ids.include?(team['id'])
end
end
- private
-
- def initial_load
- @initial_load ||= get('/users/initial_load').parsed_response
+ def self.initial_load(session)
+ session.get('/api/v3/users/initial_load').parsed_response
end
end
end