module BBBEvents::Events
Constants
- EMOJI_WHITELIST
- POLL_PUBLISHED_STATUS
- RAISEHAND
- RECORDABLE_EVENTS
Private Instance Methods
add_shape_event(e)
click to toggle source
Log if the poll was published.
# File lib/bbbevents/events.rb, line 123 def add_shape_event(e) if e["type"] == POLL_PUBLISHED_STATUS if poll = @polls[e["id"]] poll.published = true end end end
conversion_completed_event(e)
click to toggle source
Log the uploaded file name.
# File lib/bbbevents/events.rb, line 57 def conversion_completed_event(e) @files << e["originalFilename"] end
participant_join_event(e)
click to toggle source
Log a users join.
# File lib/bbbevents/events.rb, line 22 def participant_join_event(e) intUserId = e['userId'] extUserId = e['externalUserId'] # If they don't exist, initialize the user. unless @externalUserId.key?(intUserId) @externalUserId[intUserId] = extUserId end # We need to track the user using external userids so that 3rd party # integrations will be able to correlate the users with their own data. unless @attendees.key?(extUserId) @attendees[extUserId] = Attendee.new(e) unless @attendees.key?(extUserId) end # Handle updates for re-joining users att = @attendees[extUserId] att.joins << Time.at(timestamp_conversion(e["timestamp"])) att.name = e['name'] if e['role'] == 'MODERATOR' att.moderator = true end end
participant_left_event(e)
click to toggle source
Log a users leave.
# File lib/bbbevents/events.rb, line 47 def participant_left_event(e) intUserId = e['userId'] # If the attendee exists, set their leave time. if att = @attendees[@externalUserId[intUserId]] left = Time.at(timestamp_conversion(e["timestamp"])) att.leaves << left end end
participant_status_change_event(e)
click to toggle source
Log user status changes.
# File lib/bbbevents/events.rb, line 71 def participant_status_change_event(e) intUserId = e['userId'] return unless attendee = @attendees[@externalUserId[intUserId]] status = e["value"] if attendee if status == RAISEHAND attendee.engagement[:raisehand] += 1 elsif EMOJI_WHITELIST.include?(status) attendee.engagement[:emojis] += 1 end end end
participant_talking_event(e)
click to toggle source
Log number of speaking events and total talk time.
# File lib/bbbevents/events.rb, line 87 def participant_talking_event(e) intUserId = e["participant"] return unless attendee = @attendees[@externalUserId[intUserId]] if e["talking"] == "true" attendee.engagement[:talks] += 1 attendee.recent_talking_time = timestamp_conversion(e["timestamp"]) else attendee.engagement[:talk_time] += timestamp_conversion(e["timestamp"]) - attendee.recent_talking_time end end
poll_started_record_event(e)
click to toggle source
Log all polls with metadata, options and votes.
# File lib/bbbevents/events.rb, line 101 def poll_started_record_event(e) id = e["pollId"] @polls[id] = Poll.new(e) @polls[id].start = Time.at(timestamp_conversion(e["timestamp"])) end
public_chat_event(e)
click to toggle source
Log a users public chat message
# File lib/bbbevents/events.rb, line 62 def public_chat_event(e) intUserId = e['senderId'] # If the attendee exists, increment their messages. if att = @attendees[@externalUserId[intUserId]] att.engagement[:chats] += 1 end end
user_responded_to_poll_record_event(e)
click to toggle source
Log user responses to polls.
# File lib/bbbevents/events.rb, line 109 def user_responded_to_poll_record_event(e) intUserId = e['userId'] poll_id = e['pollId'] return unless attendee = @attendees[@externalUserId[intUserId]] if poll = @polls[poll_id] poll.votes[@externalUserId[intUserId]] = poll.options[e["answerId"].to_i] end attendee.engagement[:poll_votes] += 1 end