Class: Svix::Endpoint

Inherits:
Object
  • Object
show all
Defined in:
lib/svix/api/endpoint.rb,
lib/svix/api_internal/endpoint.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Endpoint

Returns a new instance of Endpoint.



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

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

Instance Attribute Details

#auto_configObject

Returns the value of attribute auto_config.



8
9
10
# File 'lib/svix/api_internal/endpoint.rb', line 8

def auto_config
  @auto_config
end

#transformationObject

Returns the value of attribute transformation.



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

def transformation
  @transformation
end

Instance Method Details

#bulk_replay(app_id, endpoint_id, bulk_replay_in, options = {}) ⇒ Object



131
132
133
134
135
136
137
138
139
140
141
142
# File 'lib/svix/api/endpoint.rb', line 131

def bulk_replay(app_id, endpoint_id, bulk_replay_in, options = {})
  options = options.transform_keys(&:to_s)
  res = @client.execute_request(
    "POST",
    "/api/v1/app/#{app_id}/endpoint/#{endpoint_id}/bulk-replay",
    headers: {
      "idempotency-key" => options["idempotency-key"]
    },
    body: bulk_replay_in
  )
  ReplayOut.deserialize(res)
end

#create(app_id, endpoint_in, options = {}) ⇒ Object



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

def create(app_id, endpoint_in, options = {})
  options = options.transform_keys(&:to_s)
  res = @client.execute_request(
    "POST",
    "/api/v1/app/#{app_id}/endpoint",
    headers: {
      "idempotency-key" => options["idempotency-key"]
    },
    body: endpoint_in
  )
  EndpointOut.deserialize(res)
end

#delete(app_id, endpoint_id) ⇒ Object



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

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

#get(app_id, endpoint_id) ⇒ Object



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

def get(app_id, endpoint_id)
  res = @client.execute_request(
    "GET",
    "/api/v1/app/#{app_id}/endpoint/#{endpoint_id}"
  )
  EndpointOut.deserialize(res)
end

#get_headers(app_id, endpoint_id) ⇒ Object



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

def get_headers(app_id, endpoint_id)
  res = @client.execute_request(
    "GET",
    "/api/v1/app/#{app_id}/endpoint/#{endpoint_id}/headers"
  )
  EndpointHeadersOut.deserialize(res)
end

#get_secret(app_id, endpoint_id) ⇒ Object



74
75
76
77
78
79
80
# File 'lib/svix/api/endpoint.rb', line 74

def get_secret(app_id, endpoint_id)
  res = @client.execute_request(
    "GET",
    "/api/v1/app/#{app_id}/endpoint/#{endpoint_id}/secret"
  )
  EndpointSecretOut.deserialize(res)
end

#get_stats(app_id, endpoint_id, options = {}) ⇒ Object



144
145
146
147
148
149
150
151
152
153
154
155
# File 'lib/svix/api/endpoint.rb', line 144

def get_stats(app_id, endpoint_id, options = {})
  options = options.transform_keys(&:to_s)
  res = @client.execute_request(
    "GET",
    "/api/v1/app/#{app_id}/endpoint/#{endpoint_id}/stats",
    query_params: {
      "since" => options["since"],
      "until" => options["until"]
    }
  )
  EndpointStats.deserialize(res)
end

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



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

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

#patch(app_id, endpoint_id, endpoint_patch) ⇒ Object



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

def patch(app_id, endpoint_id, endpoint_patch)
  res = @client.execute_request(
    "PATCH",
    "/api/v1/app/#{app_id}/endpoint/#{endpoint_id}",
    body: endpoint_patch
  )
  EndpointOut.deserialize(res)
end

#patch_headers(app_id, endpoint_id, endpoint_headers_patch_in) ⇒ Object



110
111
112
113
114
115
116
# File 'lib/svix/api/endpoint.rb', line 110

def patch_headers(app_id, endpoint_id, endpoint_headers_patch_in)
  @client.execute_request(
    "PATCH",
    "/api/v1/app/#{app_id}/endpoint/#{endpoint_id}/headers",
    body: endpoint_headers_patch_in
  )
end

#recover(app_id, endpoint_id, recover_in, options = {}) ⇒ Object



157
158
159
160
161
162
163
164
165
166
167
168
# File 'lib/svix/api/endpoint.rb', line 157

def recover(app_id, endpoint_id, recover_in, options = {})
  options = options.transform_keys(&:to_s)
  res = @client.execute_request(
    "POST",
    "/api/v1/app/#{app_id}/endpoint/#{endpoint_id}/recover",
    headers: {
      "idempotency-key" => options["idempotency-key"]
    },
    body: recover_in
  )
  RecoverOut.deserialize(res)
end

#replay_missing(app_id, endpoint_id, replay_in, options = {}) ⇒ Object



118
119
120
121
122
123
124
125
126
127
128
129
# File 'lib/svix/api/endpoint.rb', line 118

def replay_missing(app_id, endpoint_id, replay_in, options = {})
  options = options.transform_keys(&:to_s)
  res = @client.execute_request(
    "POST",
    "/api/v1/app/#{app_id}/endpoint/#{endpoint_id}/replay-missing",
    headers: {
      "idempotency-key" => options["idempotency-key"]
    },
    body: replay_in
  )
  ReplayOut.deserialize(res)
end

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



82
83
84
85
86
87
88
89
90
91
92
# File 'lib/svix/api/endpoint.rb', line 82

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

#send_example(app_id, endpoint_id, event_example_in, options = {}) ⇒ Object



170
171
172
173
174
175
176
177
178
179
180
181
# File 'lib/svix/api/endpoint.rb', line 170

def send_example(app_id, endpoint_id, event_example_in, options = {})
  options = options.transform_keys(&:to_s)
  res = @client.execute_request(
    "POST",
    "/api/v1/app/#{app_id}/endpoint/#{endpoint_id}/send-example",
    headers: {
      "idempotency-key" => options["idempotency-key"]
    },
    body: event_example_in
  )
  MessageOut.deserialize(res)
end

#set_headers(app_id, endpoint_id, endpoint_headers_in) ⇒ Object



102
103
104
105
106
107
108
# File 'lib/svix/api/endpoint.rb', line 102

def set_headers(app_id, endpoint_id, endpoint_headers_in)
  @client.execute_request(
    "PUT",
    "/api/v1/app/#{app_id}/endpoint/#{endpoint_id}/headers",
    body: endpoint_headers_in
  )
end

#transformation_partial_update(app_id, endpoint_id, endpoint_transformation_in) ⇒ Object



183
184
185
186
187
188
189
# File 'lib/svix/api/endpoint.rb', line 183

def transformation_partial_update(app_id, endpoint_id, endpoint_transformation_in)
  @client.execute_request(
    "PATCH",
    "/api/v1/app/#{app_id}/endpoint/#{endpoint_id}/transformation",
    body: endpoint_transformation_in
  )
end

#upsert(app_id, endpoint_id, endpoint_upsert_in) ⇒ Object



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

def upsert(app_id, endpoint_id, endpoint_upsert_in)
  res = @client.execute_request(
    "PUT",
    "/api/v1/app/#{app_id}/endpoint/#{endpoint_id}",
    body: endpoint_upsert_in
  )
  EndpointOut.deserialize(res)
end