Class: Svix::Authentication

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

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Authentication

Returns a new instance of Authentication.



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

def initialize(client)
  @client = client
end

Instance Method Details

#app_portal_access(app_id, app_portal_access_in, options = {}) ⇒ Object



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

def app_portal_access(app_id, app_portal_access_in, options = {})
  options = options.transform_keys(&:to_s)
  res = @client.execute_request(
    "POST",
    "/api/v1/auth/app-portal-access/#{app_id}",
    headers: {
      "idempotency-key" => options["idempotency-key"]
    },
    body: app_portal_access_in
  )
  AppPortalAccessOut.deserialize(res)
end

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



37
38
39
40
41
42
43
44
45
46
47
# File 'lib/svix/api/authentication.rb', line 37

def dashboard_access(app_id, options = {})
  options = options.transform_keys(&:to_s)
  res = @client.execute_request(
    "POST",
    "/api/v1/auth/dashboard-access/#{app_id}",
    headers: {
      "idempotency-key" => options["idempotency-key"]
    }
  )
  DashboardAccessOut.deserialize(res)
end

#expire_all(app_id, application_token_expire_in, options = {}) ⇒ Object



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

def expire_all(app_id, application_token_expire_in, options = {})
  options = options.transform_keys(&:to_s)
  @client.execute_request(
    "POST",
    "/api/v1/auth/app/#{app_id}/expire-all",
    headers: {
      "idempotency-key" => options["idempotency-key"]
    },
    body: application_token_expire_in
  )
end

#get_stream_poller_token(stream_id, sink_id) ⇒ Object



96
97
98
99
100
101
102
# File 'lib/svix/api/authentication.rb', line 96

def get_stream_poller_token(stream_id, sink_id)
  res = @client.execute_request(
    "GET",
    "/api/v1/auth/stream/#{stream_id}/sink/#{sink_id}/poller/token"
  )
  ApiTokenOut.deserialize(res)
end

#logout(options = {}) ⇒ Object



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

def logout(options = {})
  options = options.transform_keys(&:to_s)
  @client.execute_request(
    "POST",
    "/api/v1/auth/logout",
    headers: {
      "idempotency-key" => options["idempotency-key"]
    }
  )
end

#rotate_stream_poller_token(stream_id, sink_id, rotate_poller_token_in, options = {}) ⇒ Object



104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/svix/api/authentication.rb', line 104

def rotate_stream_poller_token(stream_id, sink_id, rotate_poller_token_in, options = {})
  options = options.transform_keys(&:to_s)
  res = @client.execute_request(
    "POST",
    "/api/v1/auth/stream/#{stream_id}/sink/#{sink_id}/poller/token/rotate",
    headers: {
      "idempotency-key" => options["idempotency-key"]
    },
    body: rotate_poller_token_in
  )
  ApiTokenOut.deserialize(res)
end

#stream_expire_all(stream_id, stream_token_expire_in, options = {}) ⇒ Object



84
85
86
87
88
89
90
91
92
93
94
# File 'lib/svix/api/authentication.rb', line 84

def stream_expire_all(stream_id, stream_token_expire_in, options = {})
  options = options.transform_keys(&:to_s)
  @client.execute_request(
    "POST",
    "/api/v1/auth/stream/#{stream_id}/expire-all",
    headers: {
      "idempotency-key" => options["idempotency-key"]
    },
    body: stream_token_expire_in
  )
end

#stream_logout(options = {}) ⇒ Object



60
61
62
63
64
65
66
67
68
69
# File 'lib/svix/api/authentication.rb', line 60

def stream_logout(options = {})
  options = options.transform_keys(&:to_s)
  @client.execute_request(
    "POST",
    "/api/v1/auth/stream-logout",
    headers: {
      "idempotency-key" => options["idempotency-key"]
    }
  )
end

#stream_portal_access(stream_id, stream_portal_access_in, options = {}) ⇒ Object



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

def stream_portal_access(stream_id, stream_portal_access_in, options = {})
  options = options.transform_keys(&:to_s)
  res = @client.execute_request(
    "POST",
    "/api/v1/auth/stream-portal-access/#{stream_id}",
    headers: {
      "idempotency-key" => options["idempotency-key"]
    },
    body: stream_portal_access_in
  )
  AppPortalAccessOut.deserialize(res)
end