Class: BigbluebuttonServer

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/bigbluebutton_server.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#meetingsObject (readonly)

Array of BigbluebuttonMeeting



39
40
41
# File 'app/models/bigbluebutton_server.rb', line 39

def meetings
  @meetings
end

Instance Method Details

#apiObject

Returns the API object (BigBlueButton::BigBlueButtonAPI defined in bigbluebutton-api-ruby) associated with this server.



46
47
48
49
50
51
52
# File 'app/models/bigbluebutton_server.rb', line 46

def api
  if @api.nil?
    @api = BigBlueButton::BigBlueButtonApi.new(self.url, self.salt,
                                               self.version.to_s, false)
  end
  @api
end

#fetch_meetingsObject

Fetches the meetings currently created in the server (running or not).

Using the response, updates meetings with a list of BigbluebuttonMeeting objects.

Triggers API call: get_meetings.



60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'app/models/bigbluebutton_server.rb', line 60

def fetch_meetings
  response = self.api.get_meetings

  # updates the information in the rooms that are currently in BBB
  @meetings = []
  response[:meetings].each do |attr|
    room = BigbluebuttonRoom.find_by_server_id_and_meetingid(self.id, attr[:meetingID])
    if room.nil?
      room = BigbluebuttonRoom.new(:server => self, :meetingid => attr[:meetingID],
                                   :name => attr[:meetingID], :attendee_password => attr[:attendeePW],
                                   :moderator_password => attr[:moderatorPW], :external => true,
                                   :randomize_meetingid => false, :private => true)
    else
      room.update_attributes(:attendee_password => attr[:attendeePW],
                             :moderator_password => attr[:moderatorPW])
    end
    room.running = attr[:running]

    @meetings << room
  end
end

#to_paramObject



82
83
84
# File 'app/models/bigbluebutton_server.rb', line 82

def to_param
  self.param
end