Class: BigbluebuttonServerConfig
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- BigbluebuttonServerConfig
- Includes:
- ActiveModel::ForbiddenAttributesProtection
- Defined in:
- app/models/bigbluebutton_server_config.rb
Instance Method Summary collapse
-
#available_layouts_for_select ⇒ Object
Returns an array of arrays for showing layouts in a select.
- #available_layouts_names ⇒ Object
-
#update_config(config_xml = nil) ⇒ Object
This is called when the config.xml is requested to update the info that is being stored locally.
Instance Method Details
#available_layouts_for_select ⇒ Object
Returns an array of arrays for showing layouts in a select. The first member of the internal array is the layout’s name, the second is the layout’s ID (the raw value used to set the layout in the webconf server).
46 47 48 |
# File 'app/models/bigbluebutton_server_config.rb', line 46 def available_layouts_for_select available_layouts_names.zip(available_layouts) end |
#available_layouts_names ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'app/models/bigbluebutton_server_config.rb', line 26 def available_layouts_names # Translate the keys that come from server.available_layouts. # If it's not a valid key (e.g. it's already a name) keep it as it is. available_layouts.map { |layout| # Ignores everything up to the last point # e.g. from 'bbb.layout.name.defaultlayout' to 'defaultlayout' # e.g. from 'defaultlayout' to 'defaultlayout' basename = layout.gsub(/(.*[.])?/, '') # We parameterize the id since the value can be anything, possibly an invalid # key for yml (e.g. "Reunião"). key = "bigbluebutton_rails.server_configs.layouts.#{basename.parameterize('_')}" I18n.t(key, default: basename) } end |
#update_config(config_xml = nil) ⇒ Object
This is called when the config.xml is requested to update the info that is being stored locally. Currently the only info stored is about the available layouts. It is also called without the config_xml parameter when we are forcing the update (via Resque task for example).
16 17 18 19 20 21 22 23 24 |
# File 'app/models/bigbluebutton_server_config.rb', line 16 def update_config(config_xml = nil) begin config_xml = self.server.api.get_default_config_xml if config_xml.nil? layouts = self.server.api.get_available_layouts(config_xml) self.update_attributes(available_layouts: layouts) unless layouts.nil? rescue BigBlueButton::BigBlueButtonException Rails.logger.error "Could not fetch configurations for the server #{self.server.id}. The URL probably incorrect." end end |