Class: Svix::StreamingStream

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

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ StreamingStream

Returns a new instance of StreamingStream.



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

def initialize(client)
  @client = client
end

Instance Method Details

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



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

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

#delete(stream_id) ⇒ Object



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

def delete(stream_id)
  @client.execute_request(
    "DELETE",
    "/api/v1/stream/#{stream_id}"
  )
end

#get(stream_id) ⇒ Object



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

def get(stream_id)
  res = @client.execute_request(
    "GET",
    "/api/v1/stream/#{stream_id}"
  )
  StreamOut.deserialize(res)
end

#list(options = {}) ⇒ Object



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

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

#patch(stream_id, stream_patch) ⇒ Object



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

def patch(stream_id, stream_patch)
  res = @client.execute_request(
    "PATCH",
    "/api/v1/stream/#{stream_id}",
    body: stream_patch
  )
  StreamOut.deserialize(res)
end

#update(stream_id, stream_in) ⇒ Object



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

def update(stream_id, stream_in)
  res = @client.execute_request(
    "PUT",
    "/api/v1/stream/#{stream_id}",
    body: stream_in
  )
  StreamOut.deserialize(res)
end