summaryrefslogtreecommitdiff
path: root/lib/mattermost/command.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/mattermost/command.rb')
-rw-r--r--lib/mattermost/command.rb14
1 files changed, 4 insertions, 10 deletions
diff --git a/lib/mattermost/command.rb b/lib/mattermost/command.rb
index 5c6f5861a7f..d1e4bb0eccf 100644
--- a/lib/mattermost/command.rb
+++ b/lib/mattermost/command.rb
@@ -1,16 +1,10 @@
module Mattermost
- class Command
- def self.create(session, params)
- response = session.post("/api/v3/teams/#{params[:team_id]}/commands/create",
+ class Command < Client
+ def create(params)
+ response = json_post("/api/v3/teams/#{params[:team_id]}/commands/create",
body: params.to_json)
- if response.success?
- response.parsed_response['token']
- elsif response.parsed_response.try(:has_key?, 'message')
- raise response.parsed_response['message']
- else
- raise 'Failed to create a new command'
- end
+ response['token']
end
end
end