Module: Mattermost::Endpoint::Commands

Included in:
Mattermost::Endpoint
Defined in:
lib/mattermost/endpoint/commands.rb

Instance Method Summary collapse

Instance Method Details

#create_command(command) ⇒ Object



7
8
9
# File 'lib/mattermost/endpoint/commands.rb', line 7

def create_command(command)
  post("/commands", :body => command.to_json)
end

#delete_command(command_id) ⇒ Object



23
24
25
# File 'lib/mattermost/endpoint/commands.rb', line 23

def delete_command(command_id)
  delete("/commands/#{command_id}")
end

#execute_command(channel_id, command) ⇒ Object



31
32
33
34
35
36
# File 'lib/mattermost/endpoint/commands.rb', line 31

def execute_command(channel_id, command)
  post("/commands/execute", :body => {
    :channel_id => channel_id,
    :command => command
  }.to_json)
end

#list_autocomplete_commands(team_id) ⇒ Object



15
16
17
# File 'lib/mattermost/endpoint/commands.rb', line 15

def list_autocomplete_commands(team_id)
  get("/teams/#{team_id}/commands/autocomplete")
end

#list_commands(team_id, custom_only = false) ⇒ Object



11
12
13
# File 'lib/mattermost/endpoint/commands.rb', line 11

def list_commands(team_id, custom_only = false)
  get("/commands?team_id=#{team_id}&custom_only#{custom_only}")
end

#regenerate_command_token(command_id) ⇒ Object



27
28
29
# File 'lib/mattermost/endpoint/commands.rb', line 27

def regenerate_command_token(command_id)
  put("/commands/#{command_id}/regen_token")
end

#update_command(command_id, command) ⇒ Object



19
20
21
# File 'lib/mattermost/endpoint/commands.rb', line 19

def update_command(command_id, command)
  put("/commands/#{command_id}", :body => command.to_json)
end