Class: Streambird::Api::Session

Inherits:
Struct
  • Object
show all
Defined in:
lib/streambird/api/session.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#clientObject

Returns the value of attribute client

Returns:

  • (Object)

    the current value of client



3
4
5
# File 'lib/streambird/api/session.rb', line 3

def client
  @client
end

Instance Method Details

#delete(session_token: nil, session_id: nil) ⇒ Object



28
29
30
31
32
33
34
35
36
# File 'lib/streambird/api/session.rb', line 28

def delete(session_token: nil, session_id: nil)
  req = {}

  req['session_token'] = session_token if !session_token.nil?
  req['session_id'] = session_id if !session_id.nil?
  response = client.delete('auth/sessions/delete', req)
  json_body = JSON.parse(response.body, symbolize_names: true)
  return json_body
end

#list(user_id:) ⇒ Object



18
19
20
21
22
23
24
25
26
# File 'lib/streambird/api/session.rb', line 18

def list(user_id:)
  params = {
    'user_id': user_id,
  }

  response = client.get('auth/sessions/list', params)
  json_body = JSON.parse(response.body, symbolize_names: true)
  return json_body
end

#verify(session_token:, session_expires_in: nil) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/streambird/api/session.rb', line 5

def verify(session_token:,
  session_expires_in: nil
)
  req = {
    'session_token': session_token,
  }

  req['session_expires_in'] = session_expires_in if !session_expires_in.nil?
  response = client.post('auth/sessions/verify', req)
  json_body = JSON.parse(response.body, symbolize_names: true)
  return json_body
end