Class: Svix::IngestEndpoint

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ IngestEndpoint

Returns a new instance of IngestEndpoint.



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

def initialize(client)
  @client = client
  @transformation = IngestEndpointTransformation.new(client)
end

Instance Attribute Details

#transformationObject

Returns the value of attribute transformation.



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

def transformation
  @transformation
end

Instance Method Details

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



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

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



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

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



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

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



85
86
87
88
89
90
91
# File 'lib/svix/api/ingest_endpoint.rb', line 85

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



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

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

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



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

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



73
74
75
76
77
78
79
80
81
82
83
# File 'lib/svix/api/ingest_endpoint.rb', line 73

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_headers(source_id, endpoint_id, ingest_endpoint_headers_in) ⇒ Object



93
94
95
96
97
98
99
# File 'lib/svix/api/ingest_endpoint.rb', line 93

def set_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

#upsert(source_id, endpoint_id, ingest_endpoint_upsert_in) ⇒ Object



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

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