Class: Svix::OperationalWebhookEndpoint

Inherits:
Object
  • Object
show all
Defined in:
lib/svix/api/operational_webhook_endpoint.rb

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ OperationalWebhookEndpoint

Returns a new instance of OperationalWebhookEndpoint.



8
9
10
# File 'lib/svix/api/operational_webhook_endpoint.rb', line 8

def initialize(client)
  @client = client
end

Instance Method Details

#create(operational_webhook_endpoint_in, options = {}) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/svix/api/operational_webhook_endpoint.rb', line 26

def create(operational_webhook_endpoint_in, options = {})
  options = options.transform_keys(&:to_s)
  res = @client.execute_request(
    "POST",
    "/api/v1/operational-webhook/endpoint",
    headers: {
      "idempotency-key" => options["idempotency-key"]
    },
    body: operational_webhook_endpoint_in
  )
  OperationalWebhookEndpointOut.deserialize(res)
end

#delete(endpoint_id) ⇒ Object



56
57
58
59
60
61
# File 'lib/svix/api/operational_webhook_endpoint.rb', line 56

def delete(endpoint_id)
  @client.execute_request(
    "DELETE",
    "/api/v1/operational-webhook/endpoint/#{endpoint_id}"
  )
end

#get(endpoint_id) ⇒ Object



39
40
41
42
43
44
45
# File 'lib/svix/api/operational_webhook_endpoint.rb', line 39

def get(endpoint_id)
  res = @client.execute_request(
    "GET",
    "/api/v1/operational-webhook/endpoint/#{endpoint_id}"
  )
  OperationalWebhookEndpointOut.deserialize(res)
end

#get_headers(endpoint_id) ⇒ Object



63
64
65
66
67
68
69
# File 'lib/svix/api/operational_webhook_endpoint.rb', line 63

def get_headers(endpoint_id)
  res = @client.execute_request(
    "GET",
    "/api/v1/operational-webhook/endpoint/#{endpoint_id}/headers"
  )
  OperationalWebhookEndpointHeadersOut.deserialize(res)
end

#get_secret(endpoint_id) ⇒ Object



79
80
81
82
83
84
85
# File 'lib/svix/api/operational_webhook_endpoint.rb', line 79

def get_secret(endpoint_id)
  res = @client.execute_request(
    "GET",
    "/api/v1/operational-webhook/endpoint/#{endpoint_id}/secret"
  )
  OperationalWebhookEndpointSecretOut.deserialize(res)
end

#list(options = {}) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/svix/api/operational_webhook_endpoint.rb', line 12

def list(options = {})
  options = options.transform_keys(&:to_s)
  res = @client.execute_request(
    "GET",
    "/api/v1/operational-webhook/endpoint",
    query_params: {
      "limit" => options["limit"],
      "iterator" => options["iterator"],
      "order" => options["order"]
    }
  )
  ListResponseOperationalWebhookEndpointOut.deserialize(res)
end

#rotate_secret(endpoint_id, operational_webhook_endpoint_secret_in, options = {}) ⇒ Object



87
88
89
90
91
92
93
94
95
96
97
# File 'lib/svix/api/operational_webhook_endpoint.rb', line 87

def rotate_secret(endpoint_id, operational_webhook_endpoint_secret_in, options = {})
  options = options.transform_keys(&:to_s)
  @client.execute_request(
    "POST",
    "/api/v1/operational-webhook/endpoint/#{endpoint_id}/secret/rotate",
    headers: {
      "idempotency-key" => options["idempotency-key"]
    },
    body: operational_webhook_endpoint_secret_in
  )
end

#update(endpoint_id, operational_webhook_endpoint_update) ⇒ Object



47
48
49
50
51
52
53
54
# File 'lib/svix/api/operational_webhook_endpoint.rb', line 47

def update(endpoint_id, operational_webhook_endpoint_update)
  res = @client.execute_request(
    "PUT",
    "/api/v1/operational-webhook/endpoint/#{endpoint_id}",
    body: operational_webhook_endpoint_update
  )
  OperationalWebhookEndpointOut.deserialize(res)
end

#update_headers(endpoint_id, operational_webhook_endpoint_headers_in) ⇒ Object



71
72
73
74
75
76
77
# File 'lib/svix/api/operational_webhook_endpoint.rb', line 71

def update_headers(endpoint_id, operational_webhook_endpoint_headers_in)
  @client.execute_request(
    "PUT",
    "/api/v1/operational-webhook/endpoint/#{endpoint_id}/headers",
    body: operational_webhook_endpoint_headers_in
  )
end