diff options
author | Douwe Maan <douwe@gitlab.com> | 2017-03-06 21:13:27 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2017-03-06 21:13:27 +0000 |
commit | d617182a1a6f9b19a8a6d117fa3e507fa2b338a8 (patch) | |
tree | e24db462cfb8ed1854e2203a78d6d22b071232e5 /lib | |
parent | f96d5112dca596fb85718b3cca2a7b30b3877207 (diff) | |
parent | b70d151db99d6d64f3514006c4fa6c8142e1b785 (diff) | |
download | gitlab-ce-d617182a1a6f9b19a8a6d117fa3e507fa2b338a8.tar.gz |
Merge branch 'master' into 'rs-carrierwave-db'rs-carrierwave-db
# Conflicts:
# spec/models/group_spec.rb
Diffstat (limited to 'lib')
-rw-r--r-- | lib/mattermost/client.rb | 2 | ||||
-rw-r--r-- | lib/mattermost/session.rb | 2 | ||||
-rw-r--r-- | lib/mattermost/team.rb | 11 |
3 files changed, 13 insertions, 2 deletions
diff --git a/lib/mattermost/client.rb b/lib/mattermost/client.rb index ad6df246091..3d60618006c 100644 --- a/lib/mattermost/client.rb +++ b/lib/mattermost/client.rb @@ -26,7 +26,7 @@ module Mattermost def session_get(path, options = {}) with_session do |session| - get(session, path, options) + get(session, path, options) end end diff --git a/lib/mattermost/session.rb b/lib/mattermost/session.rb index 5388966605d..688a79c0441 100644 --- a/lib/mattermost/session.rb +++ b/lib/mattermost/session.rb @@ -153,7 +153,7 @@ module Mattermost yield rescue HTTParty::Error => e raise Mattermost::ConnectionError.new(e.message) - rescue Errno::ECONNREFUSED + rescue Errno::ECONNREFUSED => e raise Mattermost::ConnectionError.new(e.message) end end diff --git a/lib/mattermost/team.rb b/lib/mattermost/team.rb index afc152aa02e..2cdbbdece16 100644 --- a/lib/mattermost/team.rb +++ b/lib/mattermost/team.rb @@ -1,7 +1,18 @@ module Mattermost class Team < Client + # Returns **all** teams for an admin def all session_get('/api/v3/teams/all').values end + + # Creates a team on the linked Mattermost instance, the team admin will be the + # `current_user` passed to the Mattermost::Client instance + def create(name:, display_name:, type:) + session_post('/api/v3/teams/create', body: { + name: name, + display_name: display_name, + type: type + }.to_json) + end end end |