Class: Dyte::SessionsResource

Inherits:
Resource
  • Object
show all
Defined in:
lib/dyte/resources/sessions.rb

Instance Attribute Summary

Attributes inherited from Resource

#client

Instance Method Summary collapse

Methods inherited from Resource

#initialize

Constructor Details

This class inherits a constructor from Dyte::Resource

Instance Method Details

#chat_messages(session_id:) ⇒ Object



22
23
24
# File 'lib/dyte/resources/sessions.rb', line 22

def chat_messages(session_id:)
  get_request("sessions/#{session_id}/chat").body.dig("data")
end

#fetch(session_id:) ⇒ Object



8
9
10
# File 'lib/dyte/resources/sessions.rb', line 8

def fetch(session_id:)
  Session.new get_request("sessions/#{session_id}").body.dig("data", "session")
end

#fetch_participants(session_id:) ⇒ Object

Returns a list of participants for the given session ID. Kept it within the Sessions resource as that’s how the Dyte API is structured.



14
15
16
# File 'lib/dyte/resources/sessions.rb', line 14

def fetch_participants(session_id:)
  Session.new get_request("sessions/#{session_id}/participants").body.dig("data")
end

#list(**params) ⇒ Object



3
4
5
6
# File 'lib/dyte/resources/sessions.rb', line 3

def list(**params)
  response = get_request("sessions", params: params)
  Collection.from_response(response, type: Session, key: "sessions")
end

#participant_details(session_id:, participant_id:) ⇒ Object



18
19
20
# File 'lib/dyte/resources/sessions.rb', line 18

def participant_details(session_id:, participant_id:)
  get_request("sessions/#{session_id}/participants/#{participant_id}").body.dig("data")
end