diff options
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 |