Class: Seam::Clients::Webhooks

Inherits:
BaseClient show all
Defined in:
lib/seam/clients/webhooks.rb

Instance Attribute Summary

Attributes inherited from BaseClient

#client

Instance Method Summary collapse

Methods inherited from BaseClient

#initialize, #request_seam, #request_seam_object

Constructor Details

This class inherits a constructor from Seam::Clients::BaseClient

Instance Method Details

#create(url:, event_types: nil) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/seam/clients/webhooks.rb', line 6

def create(url:, event_types: nil)
  request_seam_object(
    :post,
    "/webhooks/create",
    Seam::Webhook,
    "webhook",
    body: {url: url, event_types: event_types}.compact
  )
end

#delete(webhook_id:) ⇒ Object



16
17
18
19
20
21
22
23
24
# File 'lib/seam/clients/webhooks.rb', line 16

def delete(webhook_id:)
  request_seam(
    :post,
    "/webhooks/delete",
    body: {webhook_id: webhook_id}.compact
  )

  nil
end

#get(webhook_id:) ⇒ Object



26
27
28
29
30
31
32
33
34
# File 'lib/seam/clients/webhooks.rb', line 26

def get(webhook_id:)
  request_seam_object(
    :post,
    "/webhooks/get",
    Seam::Webhook,
    "webhook",
    body: {webhook_id: webhook_id}.compact
  )
end

#listObject



36
37
38
39
40
41
42
43
44
# File 'lib/seam/clients/webhooks.rb', line 36

def list
  request_seam_object(
    :post,
    "/webhooks/list",
    Seam::Webhook,
    "webhooks",
    body: {}.compact
  )
end

#update(event_types:, webhook_id:) ⇒ Object



46
47
48
49
50
51
52
53
54
# File 'lib/seam/clients/webhooks.rb', line 46

def update(event_types:, webhook_id:)
  request_seam(
    :post,
    "/webhooks/update",
    body: {event_types: event_types, webhook_id: webhook_id}.compact
  )

  nil
end