summaryrefslogtreecommitdiff
path: root/lib/mattermost/team.rb
blob: 2de01eced0bd6fe01aa16df748b036e2bc8bd667 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
module Mattermost
  class Team
    def self.all(session)
      response = session.get('/api/v3/teams/all')

      if response.success?
        response.parsed_response
      elsif response.parsed_response.try(:has_key?, 'message')
        raise response.parsed_response['message']
      else
        raise 'Failed to list teams'
      end
    end
  end
end