Sha256: f96a0c5a20ddc84943f234533098778ac7ac5eeec25b5c9bb516f0c097fef17c
Contents?: true
Size: 1.34 KB
Versions: 14
Compression:
Stored size: 1.34 KB
Contents
module TrackerApi module Endpoints class Webhook attr_accessor :client def initialize(client) @client = client end def get(project_id, id, params={}) data = client.get("/projects/#{project_id}/webhooks/#{id}", params: params).body Resources::Webhook.new({ client: client, project_id: project_id }.merge(data)) end def create(project_id, params={}) data = client.post("/projects/#{project_id}/webhooks", params: params).body Resources::Webhook.new({ client: client }.merge(data)) end def update(webhook, params={}) raise ArgumentError, 'Valid webhook required to update.' unless webhook.instance_of?(Resources::Webhook) data = client.put("/projects/#{webhook.project_id}/webhooks/#{webhook.id}", params: params).body webhook.attributes = data webhook.clean! webhook end def delete(webhook) raise ArgumentError, 'Valid webhook required to update.' unless webhook.instance_of?(Resources::Webhook) data = client.delete("/projects/#{webhook.project_id}/webhooks/#{webhook.id}") data.status == 204 end def delete_from_project(project_id, webhook_id) data = client.delete("/projects/#{project_id}/webhooks/#{webhook_id}") data.status == 204 end end end end
Version data entries
14 entries across 14 versions & 1 rubygems