Class: Cloudflare::RealtimeKit::Meeting

Inherits:
Cloudflare::Resource show all
Defined in:
lib/cloudflare/realtime_kit/meeting.rb

Overview

A meeting room. Meetings live under an app and host one or more sessions when participants join. Use has_many :participants for invitee management and active_session for moderating the live session.

Lifecycle

meeting = Meeting.create(app_id: "app-1", title: "Standup")
meeting.update(title: "Daily standup")

Body fields (create / replace / update)

title, persist_chat, record_on_start, summarize_on_end, live_stream_on_start, session_keep_alive_time_in_secs, ai_config, recording_config. Plus status on update only.

Relations & actions

meeting.participants                  # → Relation → Participant
meeting.active_session                # → ActiveSession (loaded)
meeting.start_livestreaming(name:)    # POST /meetings/{id}/livestreams
meeting.stop_livestream               # POST /meetings/{id}/active-livestream/stop

Constant Summary

Constants inherited from Cloudflare::Resource

Cloudflare::Resource::ENVELOPE_KEYS

Instance Attribute Summary

Attributes inherited from Cloudflare::Resource

#scope

Instance Method Summary collapse

Methods inherited from Cloudflare::Resource

#==, #[], all, attribute, attributes, #attributes, collection_path, create, #destroy, find, has_many, has_one, #hash, #id, #initialize, member_path, read_only, read_only?, #reload, scope_params, scope_required, #set_attrs_from_response, #to_h, to_wire_keys, unwrap_envelope, #update, wire_kwarg, wire_name_for_request, wire_name_for_response

Constructor Details

This class inherits a constructor from Cloudflare::Resource

Instance Method Details

#active_livestreamObject

GET /meetings/Cloudflare::Resource#id/active-livestream — fetch the currently-running livestream attached to this meeting. Returns a Livestream scoped to the same app, so you can chain regular livestream operations on it (e.g., meeting.active_livestream.active_session).



60
61
62
63
# File 'lib/cloudflare/realtime_kit/meeting.rb', line 60

def active_livestream
  response = Connection.instance.request(:get, "#{member_path}/active-livestream")
  Livestream.new(response, scope: { account_id: @scope[:account_id], app_id: @scope[:app_id] })
end

#livestream_details(page_no: nil, per_page: nil) ⇒ Object

GET /meetings/Cloudflare::Resource#id/livestream — legacy “livestream-session-details” endpoint. Returns the meeting’s livestream alongside a paginated list of its broadcast sessions: { “livestream” => {…}, “sessions” => […] }. Returned as a raw Hash because the response bundles two distinct shapes; the typed Livestream + per-session lookup live elsewhere.



75
76
77
78
79
# File 'lib/cloudflare/realtime_kit/meeting.rb', line 75

def livestream_details(page_no: nil, per_page: nil)
  response = Connection.instance.request(:get, "#{member_path}/livestream",
    params: { page_no: page_no, per_page: per_page })
  self.class.unwrap_envelope(response)
end

#replace(**attrs) ⇒ Object

PUT /meetings/Cloudflare::Resource#id — full replacement. Mirrors update but uses PUT semantics, so omitted fields revert to their defaults upstream.



45
46
47
48
49
# File 'lib/cloudflare/realtime_kit/meeting.rb', line 45

def replace(**attrs)
  response = Connection.instance.request(:put, member_path, body: self.class.to_wire_keys(attrs))
  set_attrs_from_response(response)
  self
end

#start_livestreaming(name: nil, video_config: nil) ⇒ Object

POST /meetings/Cloudflare::Resource#id/livestreams — begin broadcasting this meeting.



52
53
54
# File 'lib/cloudflare/realtime_kit/meeting.rb', line 52

def start_livestreaming(name: nil, video_config: nil)
  Connection.instance.request(:post, "#{member_path}/livestreams", body: { name: name, video_config: video_config })
end

#stop_livestreamObject

POST /meetings/Cloudflare::Resource#id/active-livestream/stop



66
67
68
# File 'lib/cloudflare/realtime_kit/meeting.rb', line 66

def stop_livestream
  Connection.instance.request(:post, "#{member_path}/active-livestream/stop")
end