Class: Streambird::Api::Session
- Inherits:
-
Struct
- Object
- Struct
- Streambird::Api::Session
- Defined in:
- lib/streambird/api/session.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
Returns the value of attribute client.
Instance Method Summary collapse
- #delete(session_token: nil, session_id: nil) ⇒ Object
- #list(user_id:) ⇒ Object
- #verify(session_token:, session_expires_in: nil) ⇒ Object
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute 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 |