Module: Mattermost::Endpoint::Webhooks

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

Instance Method Summary collapse

Instance Method Details

#create_incoming_webhook(incoming_webhook) ⇒ Object



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

def create_incoming_webhook(incoming_webhook)
	post("/hooks/incoming", :body => incoming_webhook.to_json)
end

#create_outgoing_webhook(outgoing_webhook) ⇒ Object



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

def create_outgoing_webhook(outgoing_webhook)
	post("/hooks/outgoing", :body => outgoing_webhook.to_json)
end

#delete_outgoing_webhook(hook_id) ⇒ Object



47
48
49
# File 'lib/mattermost/endpoint/webhooks.rb', line 47

def delete_outgoing_webhook(hook_id)
	delete("/hooks/outgoing/#{hook_id}")
end

#get_incoming_webhook(hook_id) ⇒ Object



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

def get_incoming_webhook(hook_id)
	get("/hooks/incoming/#{hook_id}")
end

#get_outgoing_webhook(hook_id) ⇒ Object



43
44
45
# File 'lib/mattermost/endpoint/webhooks.rb', line 43

def get_outgoing_webhook(hook_id)
	get("/hooks/outgoing/#{hook_id}")
end

#list_incoming_webhooks(team_id, max = 60) ⇒ Object



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

def list_incoming_webhooks(team_id, max = 60)
	get("/hooks/incoming?per_page=#{max}&team_id=#{team_id}")
end

#list_incoming_webhooks_for_system(max = 60) ⇒ Object



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

def list_incoming_webhooks_for_system(max = 60)
	get("/hooks/incoming?per_page=#{max}")
end

#list_outgoing_webhooks(team_id, channel_id, max = 60) ⇒ Object



31
32
33
# File 'lib/mattermost/endpoint/webhooks.rb', line 31

def list_outgoing_webhooks(team_id, max = 60)
	get("/hooks/outgoing?per_page=#{max}&team_id=#{team_id}")
end

#list_outgoing_webhooks_for_system(max = 60) ⇒ Object



39
40
41
# File 'lib/mattermost/endpoint/webhooks.rb', line 39

def list_outgoing_webhooks_for_system(max = 60)
	get("/hooks/outgoing?per_page=#{max}")
end

#regenerate_outgoing_webhook_token(hook_id) ⇒ Object



55
56
57
# File 'lib/mattermost/endpoint/webhooks.rb', line 55

def regenerate_outgoing_webhook_token(hook_id)
	post("/hooks/outgoing/#{hook_id}/regen_token")
end

#update_incoming_webhook(hook_id, incoming_webhook) ⇒ Object



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

def update_incoming_webhook(hook_id, incoming_webhook)
	put("/hooks/incoming/#{hook_id}", :body => incoming_webhook.to_json)
end

#update_outgoing_webhook(hook_id, outgoing_webhook) ⇒ Object



51
52
53
# File 'lib/mattermost/endpoint/webhooks.rb', line 51

def update_outgoing_webhook(hook_id, outgoing_webhook)
	put("/hooks/outgoing/#{hook_id}", outgoing_webhook.to_json)
end