class Wavefront::Webhook
Manage and query Wavefront
webhooks
Public Instance Methods
POST /api/v2/webhook Create a specific webhook.
@param body [Hash] a hash of parameters describing the webhook.
Please refer to the Wavefront Swagger docs for key:value information
@return [Wavefront::Response]
# File lib/wavefront-sdk/webhook.rb, line 32 def create(body) raise ArgumentError unless body.is_a?(Hash) api.post('', body, 'application/json') end
DELETE /api/v2/webhook/id Delete a specific webhook.
@param id [String, Integer] ID of the webhook @return [Wavefront::Response]
# File lib/wavefront-sdk/webhook.rb, line 44 def delete(id) wf_webhook_id?(id) api.delete(id) end
GET /api/v2/webhook/id Get a specific webhook.
@param id [String, Integer] ID of the webhook @return [Wavefront::Response]
# File lib/wavefront-sdk/webhook.rb, line 55 def describe(id) wf_webhook_id?(id) api.get(id) end
GET /api/v2/webhook Get all webhooks for a customer.
@param offset [Integer] webhook at which the list begins @param limit [Integer] the number of webhooks to return
# File lib/wavefront-sdk/webhook.rb, line 20 def list(offset = 0, limit = 100) api.get('', offset: offset, limit: limit) end
PUT /api/v2/webhook/id Update a specific webhook.
@param id [String] a Wavefront
webhook ID @param body [Hash] key-value hash of the parameters you wish
to change
@param modify [true, false] if true, use {#describe()} to get
a hash describing the existing object, and modify that with the new body. If false, pass the new body straight through.
@return [Wavefront::Response]
# File lib/wavefront-sdk/webhook.rb, line 71 def update(id, body, modify = true) wf_webhook_id?(id) raise ArgumentError unless body.is_a?(Hash) return api.put(id, body, 'application/json') unless modify api.put(id, hash_for_update(describe(id).response, body), 'application/json') end
# File lib/wavefront-sdk/webhook.rb, line 10 def update_keys %i[id title description template title triggers recipient] end