Class: Svix::IngestEndpoint

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

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ IngestEndpoint

Returns a new instance of IngestEndpoint.



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

def initialize(client)
  @client = client
end

Instance Method Details

#create(source_id, ingest_endpoint_in, options = {}) ⇒ Object



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

def create(source_id, ingest_endpoint_in, options = {})
  options = options.transform_keys(&:to_s)
  res = @client.execute_request(
    "POST",
    "/ingest/api/v1/source/#{source_id}/endpoint",
    headers: {
      "idempotency-key" => options["idempotency-key"]
    },
    body: ingest_endpoint_in
  )
  IngestEndpointOut.deserialize(res)
end

#delete(source_id, endpoint_id) ⇒ Object



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

def delete(source_id, endpoint_id)
  @client.execute_request(
    "DELETE",
    "/ingest/api/v1/source/#{source_id}/endpoint/#{endpoint_id}"
  )
end

#get(source_id, endpoint_id) ⇒ Object



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

def get(source_id, endpoint_id)
  res = @client.execute_request(
    "GET",
    "/ingest/api/v1/source/#{source_id}/endpoint/#{endpoint_id}"
  )
  IngestEndpointOut.deserialize(res)
end

#get_headers(source_id, endpoint_id) ⇒ Object



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

def get_headers(source_id, endpoint_id)
  res = @client.execute_request(
    "GET",
    "/ingest/api/v1/source/#{source_id}/endpoint/#{endpoint_id}/headers"
  )
  IngestEndpointHeadersOut.deserialize(res)
end

#get_secret(source_id, endpoint_id) ⇒ Object



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

def get_secret(source_id, endpoint_id)
  res = @client.execute_request(
    "GET",
    "/ingest/api/v1/source/#{source_id}/endpoint/#{endpoint_id}/secret"
  )
  IngestEndpointSecretOut.deserialize(res)
end

#get_transformation(source_id, endpoint_id) ⇒ Object



99
100
101
102
103
104
105
# File 'lib/svix/api/ingest_endpoint.rb', line 99

def get_transformation(source_id, endpoint_id)
  res = @client.execute_request(
    "GET",
    "/ingest/api/v1/source/#{source_id}/endpoint/#{endpoint_id}/transformation"
  )
  IngestEndpointTransformationOut.deserialize(res)
end

#list(source_id, options = {}) ⇒ Object



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

def list(source_id, options = {})
  options = options.transform_keys(&:to_s)
  res = @client.execute_request(
    "GET",
    "/ingest/api/v1/source/#{source_id}/endpoint",
    query_params: {
      "limit" => options["limit"],
      "iterator" => options["iterator"],
      "order" => options["order"]
    }
  )
  ListResponseIngestEndpointOut.deserialize(res)
end

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



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

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

#set_transformation(source_id, endpoint_id, ingest_endpoint_transformation_patch) ⇒ Object



107
108
109
110
111
112
113
# File 'lib/svix/api/ingest_endpoint.rb', line 107

def set_transformation(source_id, endpoint_id, ingest_endpoint_transformation_patch)
  @client.execute_request(
    "PATCH",
    "/ingest/api/v1/source/#{source_id}/endpoint/#{endpoint_id}/transformation",
    body: ingest_endpoint_transformation_patch
  )
end

#update(source_id, endpoint_id, ingest_endpoint_update) ⇒ Object



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

def update(source_id, endpoint_id, ingest_endpoint_update)
  res = @client.execute_request(
    "PUT",
    "/ingest/api/v1/source/#{source_id}/endpoint/#{endpoint_id}",
    body: ingest_endpoint_update
  )
  IngestEndpointOut.deserialize(res)
end

#update_headers(source_id, endpoint_id, ingest_endpoint_headers_in) ⇒ Object



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

def update_headers(source_id, endpoint_id, ingest_endpoint_headers_in)
  @client.execute_request(
    "PUT",
    "/ingest/api/v1/source/#{source_id}/endpoint/#{endpoint_id}/headers",
    body: ingest_endpoint_headers_in
  )
end