2016-12-13 18:52:41 +00:00
|
|
|
module Mattermost
|
2016-12-19 13:14:09 +00:00
|
|
|
class Command
|
|
|
|
def self.create(session, team_id, command)
|
|
|
|
response = session.post("/api/v3/teams/#{team_id}/commands/create", body: command.to_json).parsed_response
|
2016-12-13 18:52:41 +00:00
|
|
|
|
2016-12-19 13:14:09 +00:00
|
|
|
if response.has_key?('message')
|
|
|
|
response
|
|
|
|
else
|
|
|
|
response['token']
|
|
|
|
end
|
2016-12-13 18:52:41 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|