bigbluebutton_rails 2.1.0 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +3 -0
  3. data/CHANGELOG.md +21 -0
  4. data/Gemfile +2 -1
  5. data/Gemfile.lock +4 -11
  6. data/Rakefile +15 -15
  7. data/app/controllers/bigbluebutton/recordings_controller.rb +1 -1
  8. data/app/controllers/bigbluebutton/rooms_controller.rb +10 -12
  9. data/app/controllers/bigbluebutton/servers_controller.rb +4 -5
  10. data/app/models/bigbluebutton_meeting.rb +1 -2
  11. data/app/models/bigbluebutton_metadata.rb +2 -2
  12. data/app/models/bigbluebutton_recording.rb +20 -5
  13. data/app/models/bigbluebutton_room.rb +80 -102
  14. data/app/models/bigbluebutton_server.rb +31 -17
  15. data/app/views/bigbluebutton/recordings/_form.html.erb +13 -13
  16. data/app/views/bigbluebutton/rooms/_form.html.erb +0 -4
  17. data/app/views/bigbluebutton/rooms/_rooms.html.erb +0 -4
  18. data/app/views/bigbluebutton/rooms/show.html.erb +0 -4
  19. data/app/workers/bigbluebutton_update_recordings.rb +2 -2
  20. data/config/locales/en.yml +1 -2
  21. data/config/locales/pt-br.yml +1 -2
  22. data/lib/bigbluebutton_rails.rb +22 -108
  23. data/lib/bigbluebutton_rails/background_tasks.rb +7 -3
  24. data/lib/bigbluebutton_rails/configuration.rb +80 -0
  25. data/lib/bigbluebutton_rails/rails/routes.rb +7 -6
  26. data/lib/bigbluebutton_rails/version.rb +1 -1
  27. data/lib/generators/bigbluebutton_rails/install_generator.rb +10 -1
  28. data/lib/generators/bigbluebutton_rails/templates/migration.rb +0 -3
  29. data/lib/generators/bigbluebutton_rails/templates/migration_2_2_0.rb +13 -0
  30. data/spec/controllers/bigbluebutton/recordings_controller_json_responses_spec.rb +4 -5
  31. data/spec/controllers/bigbluebutton/recordings_controller_spec.rb +3 -2
  32. data/spec/controllers/bigbluebutton/rooms_controller_exception_handling_spec.rb +1 -1
  33. data/spec/controllers/bigbluebutton/rooms_controller_json_responses_spec.rb +4 -4
  34. data/spec/controllers/bigbluebutton/rooms_controller_spec.rb +53 -38
  35. data/spec/controllers/bigbluebutton/servers_controller_json_responses_spec.rb +7 -19
  36. data/spec/controllers/bigbluebutton/servers_controller_spec.rb +32 -51
  37. data/spec/factories/bigbluebutton_meeting.rb +0 -1
  38. data/spec/factories/bigbluebutton_recording.rb +1 -0
  39. data/spec/factories/bigbluebutton_room.rb +0 -1
  40. data/spec/models/bigbluebutton_meeting_db_spec.rb +0 -1
  41. data/spec/models/bigbluebutton_meeting_spec.rb +0 -3
  42. data/spec/models/bigbluebutton_metadata_spec.rb +4 -4
  43. data/spec/models/bigbluebutton_recording_spec.rb +32 -0
  44. data/spec/models/bigbluebutton_room_db_spec.rb +0 -2
  45. data/spec/models/bigbluebutton_room_spec.rb +138 -244
  46. data/spec/models/bigbluebutton_server_spec.rb +40 -21
  47. data/spec/rails_app/db/seeds.rb +1 -1
  48. data/spec/rails_app/features/config.yml.example +4 -4
  49. data/spec/rails_app/features/step_definitions/create_rooms_steps.rb +0 -1
  50. data/spec/rails_app/features/support/templates.rb +0 -4
  51. data/spec/rails_app/lib/tasks/db/populate.rake +2 -2
  52. data/spec/routing/bigbluebutton/servers_only_routing_spec.rb +4 -1
  53. data/spec/routing/bigbluebutton/servers_routing_spec.rb +4 -0
  54. data/spec/spec_helper.rb +4 -0
  55. data/spec/support/mocked_server.rb +1 -1
  56. data/spec/workers/bigbluebutton_meeting_updater_spec.rb +3 -3
  57. metadata +4 -2
@@ -3,15 +3,10 @@ require 'bigbluebutton_api'
3
3
  class BigbluebuttonServer < ActiveRecord::Base
4
4
  include ActiveModel::ForbiddenAttributesProtection
5
5
 
6
- has_many :rooms,
7
- :class_name => 'BigbluebuttonRoom',
8
- :foreign_key => 'server_id',
9
- :dependent => :nullify
10
-
11
6
  has_many :recordings,
12
- :class_name => 'BigbluebuttonRecording',
13
- :foreign_key => 'server_id',
14
- :dependent => :nullify
7
+ class_name: 'BigbluebuttonRecording',
8
+ foreign_key: 'server_id',
9
+ dependent: :destroy
15
10
 
16
11
  has_one :config,
17
12
  class_name: 'BigbluebuttonServerConfig',
@@ -25,12 +20,10 @@ class BigbluebuttonServer < ActiveRecord::Base
25
20
 
26
21
  validates :name,
27
22
  :presence => true,
28
- :uniqueness => true,
29
23
  :length => { :minimum => 1, :maximum => 500 }
30
24
 
31
25
  validates :url,
32
26
  :presence => true,
33
- :uniqueness => true,
34
27
  :length => { :maximum => 500 },
35
28
  :format => { :with => /http[s]?:\/\/.*\/bigbluebutton\/api/,
36
29
  :message => I18n.t('bigbluebutton_rails.servers.errors.url_format') }
@@ -62,12 +55,22 @@ class BigbluebuttonServer < ActiveRecord::Base
62
55
  before_save :check_for_version_update
63
56
  after_update :check_for_config_update
64
57
 
58
+ # Schedules a recording update right after a recording server is added.
59
+ after_create do
60
+ Resque.enqueue(::BigbluebuttonUpdateRecordings, self.id)
61
+ end
62
+
65
63
  # In case there's no config created yet, build one.
66
64
  def config_with_initialize
67
- config_without_initialize || build_config
65
+ config_without_initialize || build_config(server: self)
68
66
  end
69
67
  alias_method_chain :config, :initialize
70
68
 
69
+ # Helper to get the default server
70
+ def self.default
71
+ self.first
72
+ end
73
+
71
74
  # Returns the API object (<tt>BigBlueButton::BigBlueButtonAPI</tt> defined in
72
75
  # <tt>bigbluebutton-api-ruby</tt>) associated with this server.
73
76
  def api
@@ -90,15 +93,21 @@ class BigbluebuttonServer < ActiveRecord::Base
90
93
  # updates the information in the rooms that are currently in BBB
91
94
  @meetings = []
92
95
  response[:meetings].each do |attr|
93
- room = BigbluebuttonRoom.find_by_server_id_and_meetingid(self.id, attr[:meetingID])
96
+ room = BigbluebuttonRoom.find_by(meetingid: attr[:meetingID])
94
97
  # TODO: there might be more attributes returned by the API, review them all
95
98
  if room.nil?
96
- room = BigbluebuttonRoom.new(:server => self, :meetingid => attr[:meetingID],
97
- :name => attr[:meetingID], :attendee_api_password => attr[:attendeePW],
98
- :moderator_api_password => attr[:moderatorPW], :external => true, :private => true)
99
+ attrs = {
100
+ meetingid: attr[:meetingID],
101
+ name: attr[:meetingID],
102
+ attendee_api_password: attr[:attendeePW],
103
+ moderator_api_password: attr[:moderatorPW],
104
+ external: true,
105
+ private: true
106
+ }
107
+ room = BigbluebuttonRoom.new(attrs)
99
108
  else
100
- room.update_attributes(:attendee_api_password => attr[:attendeePW],
101
- :moderator_api_password => attr[:moderatorPW])
109
+ room.update_attributes(attendee_api_password: attr[:attendeePW],
110
+ moderator_api_password: attr[:moderatorPW])
102
111
  end
103
112
  room.running = attr[:running]
104
113
  room.update_current_meeting_record
@@ -168,6 +177,11 @@ class BigbluebuttonServer < ActiveRecord::Base
168
177
  self.version
169
178
  end
170
179
 
180
+ # Returns the URL to the <tt>/check</tt> request in the server.
181
+ def check_url
182
+ self.api.check_url
183
+ end
184
+
171
185
  protected
172
186
 
173
187
  def init
@@ -10,49 +10,49 @@
10
10
  </div>
11
11
  <% end %>
12
12
 
13
+ <div class="field">
14
+ <%= f.label :description %><br />
15
+ <%= f.text_field :description %>
16
+ </div>
13
17
  <div class="field">
14
18
  <%= f.label :id %><br />
15
19
  <%= @recording.id %>
16
20
  </div>
17
21
  <div class="field">
18
22
  <%= f.label :recordid %><br />
19
- <%= f.text_field :recordid %>
23
+ <%= f.text_field :recordid, :disabled => true %>
20
24
  </div>
21
25
  <div class="field">
22
26
  <%= f.label :name %><br />
23
- <%= f.text_field :name %>
27
+ <%= f.text_field :name, :disabled => true %>
24
28
  </div>
25
29
  <div class="field">
26
30
  <%= f.label :room_id %><br />
27
- <%= f.text_field :room_id, :disabled => "disabled" %>
31
+ <%= f.text_field :room_id, :disabled => true %>
28
32
  </div>
29
33
  <div class="field">
30
34
  <%= f.label :server_id %><br />
31
- <%= f.text_field :server_id, :disabled => "disabled" %>
35
+ <%= f.text_field :server_id, :disabled => true %>
32
36
  </div>
33
37
  <div class="field">
34
38
  <%= f.label :published %><br />
35
- <%= f.check_box :published %>
39
+ <%= f.check_box :published, :disabled => true %>
36
40
  </div>
37
41
  <div class="field">
38
42
  <%= f.label :available %><br />
39
- <%= f.check_box :available %>
43
+ <%= f.check_box :available, :disabled => true %>
40
44
  </div>
41
45
  <div class="field">
42
46
  <%= f.label :start_time %><br />
43
- <%= f.text_field :start_time %>
47
+ <%= f.text_field :start_time, :disabled => true %>
44
48
  </div>
45
49
  <div class="field">
46
50
  <%= f.label :end_time %><br />
47
- <%= f.text_field :end_time %>
48
- </div>
49
- <div class="field">
50
- <%= f.label :description %><br />
51
- <%= f.text_field :description %>
51
+ <%= f.text_field :end_time, :disabled => true %>
52
52
  </div>
53
53
  <div class="field">
54
54
  <%= f.label :size %><br />
55
- <%= f.text_field :size %>
55
+ <%= f.text_field :size, :disabled => true %>
56
56
  </div>
57
57
 
58
58
  <p>
@@ -20,10 +20,6 @@
20
20
  <%= f.label :id %><br />
21
21
  <%= @room.id %>
22
22
  </div>
23
- <div class="field">
24
- <%= f.label :server_id %><br />
25
- <%= f.text_field :server_id %>
26
- </div>
27
23
  <div class="field">
28
24
  <%= f.label :name %><br />
29
25
  <%= f.text_field :name %>
@@ -8,10 +8,6 @@
8
8
  <% @rooms.each do |room| %>
9
9
  <li>
10
10
  <div class="field"><label><%= BigbluebuttonRoom.human_attribute_name(:id) %></label> <%= room.id %></div>
11
- <div class="field">
12
- <label><%= BigbluebuttonRoom.human_attribute_name(:server_id) %></label> <%= room.server_id %>
13
- <%= link_to('(view server)', bigbluebutton_server_path(room.server)) unless room.server.nil? %>
14
- </div>
15
11
  <div class="field"><label><%= BigbluebuttonRoom.human_attribute_name(:name) %></label> <%= room.name %></div>
16
12
  <div class="field"><label><%= BigbluebuttonRoom.human_attribute_name(:meetingid) %></label> <%= room.meetingid %></div>
17
13
  <div class="field"><label><%= BigbluebuttonRoom.human_attribute_name(:private) %></label> <%= room.private %></div>
@@ -4,10 +4,6 @@
4
4
  <b><%= BigbluebuttonRoom.human_attribute_name(:id) %>:</b>
5
5
  <%= @room.id %>
6
6
  </p>
7
- <p>
8
- <b><%= BigbluebuttonRoom.human_attribute_name(:server_id) %>:</b>
9
- <%= @room.server_id %>
10
- </p>
11
7
  <p>
12
8
  <b><%= BigbluebuttonRoom.human_attribute_name(:name) %>:</b>
13
9
  <%= @room.name %>
@@ -4,8 +4,8 @@
4
4
  class BigbluebuttonUpdateRecordings
5
5
  @queue = :bigbluebutton_rails
6
6
 
7
- def self.perform
7
+ def self.perform(server_id=nil)
8
8
  Rails.logger.info "BigbluebuttonUpdateRecordings worker running"
9
- BigbluebuttonRails::BackgroundTasks.update_recordings
9
+ BigbluebuttonRails::BackgroundTasks.update_recordings(server_id)
10
10
  end
11
11
  end
@@ -50,7 +50,6 @@ en:
50
50
  private: Private
51
51
  presenter_share_only: "Only presenter shares audio and video"
52
52
  record: Record
53
- server_id: "Server ID"
54
53
  voice_bridge: "Voice Bridge"
55
54
  welcome_msg: "Welcome Message"
56
55
  bigbluebutton_server:
@@ -106,7 +105,7 @@ en:
106
105
  success: "Your recording was successfully updated."
107
106
  rooms:
108
107
  default_welcome_msg: "Welcome to <b>%%CONFNAME%%</b>!<br><br>To join the audio bridge click the headset icon (upper-left hand corner). Use a headset to avoid causing background noise for others.<br>"
109
- default_welcome_msg_dial_number: "Welcome to <b>%%CONFNAME%%</b>!<br><br>To join the audio bridge click the headset icon (upper-left hand corner). Use a headset to avoid causing background noise for others.<br>You can call into this conference with a regular phone using the number \"%%DIALNUM%%\".<br>"
108
+ default_welcome_msg_dial_number: "<br>You can call into this conference with a regular phone using the number \"%%DIALNUM%%\".<br>"
110
109
  errors:
111
110
  fetch_recordings:
112
111
  no_server: "There's no server associated with this room."
@@ -50,7 +50,6 @@ pt-br:
50
50
  private: Privada
51
51
  presenter_share_only: "Somente apresentador compartilha áudio e vídeo"
52
52
  record: Gravar
53
- server_id: "ID do Servidor"
54
53
  voice_bridge: "Voice Bridge"
55
54
  welcome_msg: "Mensagem de boas-vindas"
56
55
  bigbluebutton_server:
@@ -106,7 +105,7 @@ pt-br:
106
105
  success: "Sua gravação foi atualizada com sucesso."
107
106
  rooms:
108
107
  default_welcome_msg: "Bem-vindo(a) a <b>%%CONFNAME%%</b>!<br><br>Para compartilhar o seu microfone, clique no botão com um headset (à esquerda da barra superior). Use um headset para ter uma melhor experiência de áudio com menos ruídos.<br>"
109
- default_welcome_msg_dial_number: "Bem-vindo(a) a <b>%%CONFNAME%%</b>!<br><br>Para compartilhar o seu microfone, clique no botão com um headset (à esquerda da barra superior). Use um headset para ter uma melhor experiência de áudio com menos ruídos.<br>Você pode discar para esta conferência através de um telefone usando o número \"%%DIALNUM%%\".<br>"
108
+ default_welcome_msg_dial_number: "<br>Você pode discar para esta conferência através de um telefone usando o número \"%%DIALNUM%%\".<br>"
110
109
  errors:
111
110
  fetch_recordings:
112
111
  no_server: "Não há nenhum servidor associado a esta sala."
@@ -1,120 +1,34 @@
1
1
  require 'rails'
2
+ require 'browser'
3
+ require 'resque'
4
+ require 'resque-scheduler'
2
5
 
3
6
  require 'classes/bigbluebutton_attendee'
4
7
 
5
- module BigbluebuttonRails
6
- require 'browser'
7
- require 'resque'
8
- require 'resque-scheduler'
9
- require 'bigbluebutton_rails/rails'
10
- require 'bigbluebutton_rails/utils'
11
- require 'bigbluebutton_rails/controller_methods'
12
- require 'bigbluebutton_rails/internal_controller_methods'
13
- require 'bigbluebutton_rails/background_tasks'
14
- require 'bigbluebutton_rails/rails/routes'
15
- require 'bigbluebutton_rails/exceptions'
16
- require 'bigbluebutton_rails/dial_number'
17
-
18
- # Default controllers to generate the routes
19
- mattr_accessor :controllers
20
- @@controllers = {
21
- :servers => 'bigbluebutton/servers',
22
- :rooms => 'bigbluebutton/rooms',
23
- :recordings => 'bigbluebutton/recordings',
24
- :playback_types => 'bigbluebutton/playback_types'
25
- }
26
-
27
- # Default scope for routes
28
- mattr_accessor :routing_scope
29
- @@routing_scope = 'bigbluebutton'
30
-
31
- # Name of the metadata parameter that will contain the room's ID
32
- # when a room is created. Used to match the room of a recording when
33
- # recordings are fetched from the DB.
34
- # Has to be a symbol!
35
- mattr_accessor :metadata_room_id
36
- @@metadata_room_id = :'bbbrails-room-id'
37
-
38
- # Name of the metadata parameter that will contain the user's ID
39
- # when a room is created.
40
- # Has to be a symbol!
41
- mattr_accessor :metadata_user_id
42
- @@metadata_user_id = :'bbbrails-user-id'
43
-
44
- # Name of the metadata parameter that will contain the user's name
45
- # when a room is created.
46
- # Has to be a symbol!
47
- mattr_accessor :metadata_user_name
48
- @@metadata_user_name = :'bbbrails-user-name'
49
-
50
- # Name of the metadata parameter that will contain the room's invitation
51
- # URL, in case `invitation_url_method` is implemented by the application.
52
- # Has to be a symbol!
53
- mattr_accessor :metadata_invitation_url
54
- @@metadata_invitation_url = :'invitation-url'
55
-
56
- # List of invalid metadata keys. Invalid keys are usually keys that are
57
- # used by the gem and by the application. The application using this gem
58
- # can add items to this list as well.
59
- # All values added can be symbols or strings.
60
- mattr_accessor :metadata_invalid_keys
61
- @@metadata_invalid_keys =
62
- [ @@metadata_room_id,
63
- @@metadata_user_id,
64
- @@metadata_user_name,
65
- @@metadata_invitation_url ]
8
+ require 'bigbluebutton_rails/rails'
9
+ require 'bigbluebutton_rails/configuration'
10
+ require 'bigbluebutton_rails/utils'
11
+ require 'bigbluebutton_rails/controller_methods'
12
+ require 'bigbluebutton_rails/internal_controller_methods'
13
+ require 'bigbluebutton_rails/background_tasks'
14
+ require 'bigbluebutton_rails/rails/routes'
15
+ require 'bigbluebutton_rails/exceptions'
16
+ require 'bigbluebutton_rails/dial_number'
66
17
 
67
- # Name of the attribute of a user that defines his name/username.
68
- mattr_accessor :user_attr_name
69
- @@user_attr_name = :'name'
70
-
71
- # Name of the attribute of a user that defines his ID.
72
- mattr_accessor :user_attr_id
73
- @@user_attr_id = :'id'
74
-
75
- # Name of the method that returns the invitation URL of a room.
76
- # Must be implemented by the application, there's no default implemented in this gem.
77
- mattr_accessor :invitation_url_method
78
- @@invitation_url_method = :'invitation_url'
79
-
80
- # Name of the method that returns a hash of metadata to be added to create calls.
81
- # By default only the metadata created in the database and associated with the room
82
- # will be used. This method can be used to dynamically decide on which metadata to
83
- # use when a meeting is about to be created.
84
- # Receives the meeting as argument and must return a hash where keys are metadata keys
85
- # and values are the metadata values.
86
- mattr_accessor :dynamic_metadata_method
87
- @@dynamic_metadata_method = :'dynamic_metadata'
88
-
89
- # Whether or not the gem should pass the voice bridges set in the rooms when making
90
- # API calls. By default it is false, meaning that the voice bridge will never be
91
- # passed, so it will be generated by the web conference server. Setting it to true
92
- # will make the voice bridge set locally in the room to be used in the web conference
93
- # server. Notice that the voice bridge has to be unique in a web conference server, so
94
- # if you are setting the voice bridges manually, you will also have to make sure that
95
- # the voice bridges are unique (there's nothing in the gem to guarantee this uniqueness).
96
- mattr_accessor :use_local_voice_bridges
97
- @@use_local_voice_bridges = false
98
-
99
- # Finds the BigbluebuttonRoom associated with the recording data in 'data', if any.
100
- # TODO: if not found, remove the association or keep the old one?
101
- def self.match_room_recording(data)
102
- if block_given?
103
- yield
104
- else
105
- BigbluebuttonRoom.find_by_meetingid(data[:meetingid])
106
- end
18
+ module BigbluebuttonRails
19
+ class << self
20
+ attr_accessor :configuration
107
21
  end
108
22
 
109
- def self.set_controllers(options)
110
- unless options.nil?
111
- @@controllers.merge!(options).slice!(:servers, :rooms, :recordings, :playback_types)
112
- end
23
+ def self.configuration
24
+ @configuration ||= Configuration.new
113
25
  end
114
26
 
115
- # Default way to setup the gem.
116
- def self.setup
117
- yield self
27
+ def self.reset
28
+ @configuration = Configuration.new
118
29
  end
119
30
 
31
+ def self.configure
32
+ yield(configuration)
33
+ end
120
34
  end
@@ -17,11 +17,15 @@ module BigbluebuttonRails
17
17
  end
18
18
  end
19
19
 
20
- def self.update_recordings
20
+ # Updates the recordings for all servers if `server_id` is nil or or for the
21
+ # server with id `server_id`.
22
+ def self.update_recordings(server_id=nil)
21
23
  BigbluebuttonServer.find_each do |server|
22
24
  begin
23
- server.fetch_recordings(nil, true)
24
- Rails.logger.info "BackgroundTasks: List of recordings from #{server.url} updated successfully"
25
+ if server_id.nil? || server_id == server.id
26
+ server.fetch_recordings(nil, true)
27
+ Rails.logger.info "BackgroundTasks: List of recordings from #{server.url} updated successfully"
28
+ end
25
29
  rescue Exception => e
26
30
  Rails.logger.info "BackgroundTasks: Failure fetching recordings from #{server.inspect}"
27
31
  Rails.logger.info "BackgroundTasks: #{e.inspect}"
@@ -0,0 +1,80 @@
1
+ module BigbluebuttonRails
2
+ class Configuration
3
+ attr_accessor :guest_support
4
+ attr_accessor :controllers
5
+ attr_accessor :routing_scope
6
+ attr_accessor :metadata_room_id
7
+ attr_accessor :metadata_user_id
8
+ attr_accessor :metadata_user_name
9
+ attr_accessor :metadata_invitation_url
10
+ attr_accessor :metadata_invalid_keys
11
+ attr_accessor :user_attr_name
12
+ attr_accessor :user_attr_id
13
+ attr_accessor :use_local_voice_bridges
14
+
15
+ # methods
16
+ attr_accessor :select_server
17
+ attr_accessor :match_room_recording
18
+ attr_accessor :get_invitation_url
19
+ attr_accessor :get_dynamic_metadata
20
+
21
+ def initialize
22
+ @controllers = {
23
+ servers: 'bigbluebutton/servers',
24
+ rooms: 'bigbluebutton/rooms',
25
+ recordings: 'bigbluebutton/recordings',
26
+ playback_types: 'bigbluebutton/playback_types'
27
+ }
28
+ @routing_scope = 'bigbluebutton'
29
+
30
+ @metadata_room_id = :'bbbrails-room-id'
31
+ @metadata_user_id = :'bbbrails-user-id'
32
+ @metadata_user_name = :'bbbrails-user-name'
33
+ @metadata_invitation_url = :'invitation-url'
34
+ @metadata_invalid_keys =
35
+ [ @metadata_room_id, @metadata_user_id,
36
+ @metadata_user_name, @metadata_invitation_url ]
37
+
38
+ @user_attr_name = :'name'
39
+ @user_attr_id = :'id'
40
+ @use_local_voice_bridges = false
41
+ @guest_support = false
42
+
43
+ # How to find the room of a recording using the `data` returned by
44
+ # a `getRecordings`.
45
+ @match_room_recording = Proc.new do |data, *args|
46
+ BigbluebuttonRoom.find_by_meetingid(data[:meetingid])
47
+ end
48
+
49
+ # Default method to return the invitation URL of a room. By default
50
+ # returns nil (disable the feature).
51
+ @get_invitation_url = Proc.new{ |room| nil }
52
+
53
+ # Default method to get the dynamic metadata to use when creating a
54
+ # conference in a room.
55
+ @get_dynamic_metadata = Proc.new{ |room| nil }
56
+
57
+ # Selects a server to be used by `room` whenever it needs to make API calls.
58
+ # By default, if no servers are available an exception is raised.
59
+ #
60
+ # This method can be overwritten to change the way the server is selected
61
+ # before a room is used. `api_method` contains the API method that is being
62
+ # called. Any server returned here will be used. It *must* return a server,
63
+ # otherwise the API calls will fail and the code will probably break.
64
+ #
65
+ # One good example is to always select a new server when a meeting is being
66
+ # created (in case `api_method` is `:create`), making this a simple load
67
+ # balancing tool that can work well in simple cases.
68
+ @select_server = Proc.new do |room, api_method=nil|
69
+ room.select_server(api_method)
70
+ end
71
+ end
72
+
73
+ def set_controllers(options)
74
+ unless options.nil? || options.empty?
75
+ @controllers.merge!(options).slice!(:servers, :rooms, :recordings, :playback_types)
76
+ end
77
+ end
78
+
79
+ end
80
+ end