Module: MijDiscord::Core::API::Webhook
- Defined in:
- lib/mij-discord/core/api/webhook.rb
Class Method Summary collapse
-
.delete_webhook(auth, webhook_id, reason = nil) ⇒ Object
Deletes a webhook discordapp.com/developers/docs/resources/webhook#delete-webhook.
-
.execute_json(webhook_token, webhook_id, data, wait) ⇒ Object
Executes a webhook with JSON body discordapp.com/developers/docs/resources/webhook#execute-webhook.
-
.token_delete_webhook(webhook_token, webhook_id, reason = nil) ⇒ Object
Deletes a webhook via webhook token discordapp.com/developers/docs/resources/webhook#delete-webhook-with-token.
-
.token_update_webhook(webhook_token, webhook_id, data, reason = nil) ⇒ Object
Update a webhook via webhook token discordapp.com/developers/docs/resources/webhook#modify-webhook-with-token.
-
.token_webhook(webhook_token, webhook_id) ⇒ Object
Get a webhook via webhook token discordapp.com/developers/docs/resources/webhook#get-webhook-with-token.
-
.update_webhook(auth, webhook_id, data, reason = nil) ⇒ Object
Update a webhook discordapp.com/developers/docs/resources/webhook#modify-webhook.
-
.webhook(auth, webhook_id) ⇒ Object
Get a webhook discordapp.com/developers/docs/resources/webhook#get-webhook.
Class Method Details
.delete_webhook(auth, webhook_id, reason = nil) ⇒ Object
Deletes a webhook discordapp.com/developers/docs/resources/webhook#delete-webhook
59 60 61 62 63 64 65 66 67 68 |
# File 'lib/mij-discord/core/api/webhook.rb', line 59 def delete_webhook(auth, webhook_id, reason = nil) MijDiscord::Core::API.request( :webhooks_wid, webhook_id, :delete, "#{MijDiscord::Core::API::APIBASE_URL}/webhooks/#{webhook_id}", Authorization: auth, 'X-Audit-Log-Reason': reason, ) end |
.execute_json(webhook_token, webhook_id, data, wait) ⇒ Object
Executes a webhook with JSON body discordapp.com/developers/docs/resources/webhook#execute-webhook
84 85 86 87 88 89 90 91 92 |
# File 'lib/mij-discord/core/api/webhook.rb', line 84 def execute_json(webhook_token, webhook_id, data, wait) wait = wait ? '?wait=true' : '' MijDiscord::Core::API.raw_request( :post, "#{MijDiscord::Core::API::APIBASE_URL}/webhooks/#{webhook_id}/#{webhook_token}#{wait}", data.to_json, content_type: :json, ) end |
.token_delete_webhook(webhook_token, webhook_id, reason = nil) ⇒ Object
Deletes a webhook via webhook token discordapp.com/developers/docs/resources/webhook#delete-webhook-with-token
72 73 74 75 76 77 78 79 80 |
# File 'lib/mij-discord/core/api/webhook.rb', line 72 def token_delete_webhook(webhook_token, webhook_id, reason = nil) MijDiscord::Core::API.request( :webhooks_wid, webhook_id, :delete, "#{MijDiscord::Core::API::APIBASE_URL}/webhooks/#{webhook_id}/#{webhook_token}", 'X-Audit-Log-Reason': reason, ) end |
.token_update_webhook(webhook_token, webhook_id, data, reason = nil) ⇒ Object
Update a webhook via webhook token discordapp.com/developers/docs/resources/webhook#modify-webhook-with-token
45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/mij-discord/core/api/webhook.rb', line 45 def token_update_webhook(webhook_token, webhook_id, data, reason = nil) MijDiscord::Core::API.request( :webhooks_wid, webhook_id, :patch, "#{MijDiscord::Core::API::APIBASE_URL}/webhooks/#{webhook_id}/#{webhook_token}", data.to_json, content_type: :json, 'X-Audit-Log-Reason': reason, ) end |
.token_webhook(webhook_token, webhook_id) ⇒ Object
Get a webhook via webhook token discordapp.com/developers/docs/resources/webhook#get-webhook-with-token
19 20 21 22 23 24 25 26 |
# File 'lib/mij-discord/core/api/webhook.rb', line 19 def token_webhook(webhook_token, webhook_id) MijDiscord::Core::API.request( :webhooks_wid, nil, :get, "#{MijDiscord::Core::API::APIBASE_URL}/webhooks/#{webhook_id}/#{webhook_token}", ) end |
.update_webhook(auth, webhook_id, data, reason = nil) ⇒ Object
Update a webhook discordapp.com/developers/docs/resources/webhook#modify-webhook
30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/mij-discord/core/api/webhook.rb', line 30 def update_webhook(auth, webhook_id, data, reason = nil) MijDiscord::Core::API.request( :webhooks_wid, webhook_id, :patch, "#{MijDiscord::Core::API::APIBASE_URL}/webhooks/#{webhook_id}", data.to_json, Authorization: auth, content_type: :json, 'X-Audit-Log-Reason': reason, ) end |
.webhook(auth, webhook_id) ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/mij-discord/core/api/webhook.rb', line 7 def webhook(auth, webhook_id) MijDiscord::Core::API.request( :webhooks_wid, nil, :get, "#{MijDiscord::Core::API::APIBASE_URL}/webhooks/#{webhook_id}", Authorization: auth ) end |