diff options
author | Z.J. van de Weg <git@zjvandeweg.nl> | 2017-03-01 22:34:29 +0300 |
---|---|---|
committer | Z.J. van de Weg <git@zjvandeweg.nl> | 2017-03-02 12:21:29 +0300 |
commit | 52c4a7866ed010d8db67e5ca976d8c73d4084784 (patch) | |
tree | a1cbb2d3910f9433e23dec22cc0f8c94c2e8675c /lib/mattermost | |
parent | f6247600a3f5d500952b0ba32e6915a2d045e392 (diff) |
Improve UX
Diffstat (limited to 'lib/mattermost')
-rw-r--r-- | lib/mattermost/team.rb | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/lib/mattermost/team.rb b/lib/mattermost/team.rb index 52486fd1a54..69b0a3edf6f 100644 --- a/lib/mattermost/team.rb +++ b/lib/mattermost/team.rb @@ -7,20 +7,12 @@ module Mattermost # Creates a team on the linked Mattermost instance, the team admin will be the # `current_user` passed to the Mattermost::Client instance - def create(group) - session_post('/api/v3/teams/create', body: new_team_params(group).to_json) - end - - private - - MATTERMOST_TEAM_LENGTH_MAX = 59 - - def new_team_params(group) - { - name: group.path[0..MATTERMOST_TEAM_LENGTH_MAX], - display_name: group.name[0..MATTERMOST_TEAM_LENGTH_MAX], - type: group.public? ? 'O' : 'I' # Open vs Invite-only - } + 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 |