Class: Dyte::MeetingsResource

Inherits:
Resource
  • Object
show all
Defined in:
lib/dyte/resources/meetings.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

#add_participant(meeting_id:, **attributes) ⇒ Object



47
48
49
50
# File 'lib/dyte/resources/meetings.rb', line 47

def add_participant(meeting_id:, **attributes)
  response = post_request("meetings/#{meeting_id}/participants", body: attributes)
  Participant.new response.body.dig("data")
end

#create(**attributes) ⇒ Object



12
13
14
# File 'lib/dyte/resources/meetings.rb', line 12

def create(**attributes)
  Meeting.new post_request("meetings", body: attributes).body.dig("data")
end

#delete_participant(meeting_id:, participant_id:) ⇒ Object



33
34
35
# File 'lib/dyte/resources/meetings.rb', line 33

def delete_participant(meeting_id:, participant_id:)
  delete_request("meetings/#{meeting_id}/participants/#{participant_id}")
end

#edit_participant_details(meeting_id:, participant_id:, attributes:) ⇒ Object



42
43
44
45
# File 'lib/dyte/resources/meetings.rb', line 42

def edit_participant_details(meeting_id:, participant_id:, attributes:)
  response = patch_request("meetings/#{meeting_id}/participants/#{participant_id}", body: attributes)
  Participant.new response.body.dig("data")
end

#fetch(meeting_id:) ⇒ Object



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

def fetch(meeting_id:)
  Meeting.new get_request("meetings/#{meeting_id}").body.dig("data")
end

#fetch_participant_details(meeting_id:, participant_id:) ⇒ Object



37
38
39
40
# File 'lib/dyte/resources/meetings.rb', line 37

def fetch_participant_details(meeting_id:, participant_id:)
  response = get_request("meetings/#{meeting_id}/participants/#{participant_id}")
  Participant.new response.body.dig("data")
end

#fetch_participants(meeting_id:) ⇒ Object



28
29
30
31
# File 'lib/dyte/resources/meetings.rb', line 28

def fetch_participants(meeting_id:)
  response = get_request("meetings/#{meeting_id}/participants")
  Collection.from_response(response, type: Participant)
end

#list(**params) ⇒ Object



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

def list(**params)
  response = get_request("meetings", params: params)
  Collection.from_response(response, type: Meeting)
end

#regenerate_token(meeting_id:, participant_id:, **attributes) ⇒ Object



24
25
26
# File 'lib/dyte/resources/meetings.rb', line 24

def regenerate_token(meeting_id:, participant_id:, **attributes)
  post_request("meetings/#{meeting_id}/participants/#{participant_id}/token", body: attributes).body.dig("data")
end

#replace(meeting_id:, **attributes) ⇒ Object



52
53
54
55
# File 'lib/dyte/resources/meetings.rb', line 52

def replace(meeting_id:, **attributes)
  response = put_request("meetings/#{meeting_id}", body: attributes)
  Meeting.new response.body.dig("data")
end

#update(meeting_id:, **attributes) ⇒ Object



16
17
18
# File 'lib/dyte/resources/meetings.rb', line 16

def update(meeting_id:, **attributes)
  Meeting.new put_request("meetings/#{meeting_id}", body: attributes).body.dig("data", "meeting")
end

#update_old(meeting_id:, body: {}) ⇒ Object



20
21
22
# File 'lib/dyte/resources/meetings.rb', line 20

def update_old(meeting_id:, body: {})
  Meeting.new put_request("meetings/#{meeting_id}", body: body).body.dig("data", "meeting")
end