Class: Helo::Webhooks

Inherits:
API
  • Object
show all
Defined in:
lib/helo/apis/webhooks.rb

Instance Method Summary collapse

Instance Method Details

#create(request_data) ⇒ Object



11
12
13
14
15
# File 'lib/helo/apis/webhooks.rb', line 11

def create(request_data)
  request = CreateWebhookRequest.new(request_data)
  response = @client.request(:post, "/webhooks", body: request.to_params)
  WebhookResponse.from_hash(response.body)
end

#delete(id) ⇒ Object



28
29
30
31
# File 'lib/helo/apis/webhooks.rb', line 28

def delete(id)
  response = @client.request(:delete, "/webhooks/#{id}")
  nil
end

#list(request_data = {}) ⇒ Object



5
6
7
8
9
# File 'lib/helo/apis/webhooks.rb', line 5

def list(request_data = {})
  request = WebhooksListRequest.new(request_data)
  response = @client.request(:get, "/webhooks", params: request.to_params)
  PaginationResultOfWebhookResponse.from_hash(response.body)
end

#regenerate_signing_key(id) ⇒ Object



33
34
35
36
# File 'lib/helo/apis/webhooks.rb', line 33

def regenerate_signing_key(id)
  response = @client.request(:post, "/webhooks/#{id}/regenerate-signing-key")
  WebhookResponse.from_hash(response.body)
end

#retrieve(id) ⇒ Object



17
18
19
20
# File 'lib/helo/apis/webhooks.rb', line 17

def retrieve(id)
  response = @client.request(:get, "/webhooks/#{id}")
  WebhookResponse.from_hash(response.body)
end

#update(id, request_data) ⇒ Object



22
23
24
25
26
# File 'lib/helo/apis/webhooks.rb', line 22

def update(id, request_data)
  request = UpdateWebhookRequest.new(request_data)
  response = @client.request(:patch, "/webhooks/#{id}", body: request.to_params)
  WebhookResponse.from_hash(response.body)
end