bigbluebutton_rails 1.3.0.beta1 → 1.3.0.mweb1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -0
- data/Gemfile.lock +7 -1
- data/README.rdoc +5 -1
- data/app/controllers/bigbluebutton/rooms_controller.rb +2 -2
- data/app/models/bigbluebutton_room.rb +8 -14
- data/lib/bigbluebutton_rails.rb +10 -0
- data/lib/bigbluebutton_rails/version.rb +1 -1
- data/lib/generators/bigbluebutton_rails/templates/migration.rb +0 -1
- data/lib/generators/bigbluebutton_rails/templates/migration_1_3_0_mweb1.rb +9 -0
- data/spec/controllers/bigbluebutton/rooms_controller_spec.rb +24 -1
- data/spec/models/bigbluebutton_room_spec.rb +62 -23
- metadata +4 -3
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -7,7 +7,7 @@ GIT
|
|
7
7
|
PATH
|
8
8
|
remote: .
|
9
9
|
specs:
|
10
|
-
bigbluebutton_rails (1.3.0.
|
10
|
+
bigbluebutton_rails (1.3.0.mweb1)
|
11
11
|
bigbluebutton-api-ruby (~> 1.2.0)
|
12
12
|
rails (>= 3.0.0)
|
13
13
|
|
@@ -115,6 +115,7 @@ GEM
|
|
115
115
|
addressable (~> 2.3)
|
116
116
|
ffi (~> 1.1.1)
|
117
117
|
spoon (~> 0.0.1)
|
118
|
+
libv8 (3.16.14.7)
|
118
119
|
libwebsocket (0.1.5)
|
119
120
|
addressable
|
120
121
|
mail (2.4.4)
|
@@ -171,6 +172,7 @@ GEM
|
|
171
172
|
rake (10.0.1)
|
172
173
|
rdoc (3.12)
|
173
174
|
json (~> 1.4)
|
175
|
+
ref (1.0.5)
|
174
176
|
rspec-core (2.12.0)
|
175
177
|
rspec-expectations (2.12.0)
|
176
178
|
diff-lcs (~> 1.1.3)
|
@@ -209,6 +211,9 @@ GEM
|
|
209
211
|
sqlite3 (1.3.6)
|
210
212
|
sqlite3-ruby (1.3.3)
|
211
213
|
sqlite3 (>= 1.3.3)
|
214
|
+
therubyracer (0.12.1)
|
215
|
+
libv8 (~> 3.16.14.0)
|
216
|
+
ref
|
212
217
|
thor (0.16.0)
|
213
218
|
tilt (1.3.3)
|
214
219
|
treetop (1.4.12)
|
@@ -254,5 +259,6 @@ DEPENDENCIES
|
|
254
259
|
shoulda-matchers
|
255
260
|
simplecov (>= 0.4.0)
|
256
261
|
sqlite3-ruby
|
262
|
+
therubyracer
|
257
263
|
uglifier (>= 1.0.3)
|
258
264
|
whenever
|
data/README.rdoc
CHANGED
@@ -186,10 +186,12 @@ check out the test application at <tt>spec/rails_app/</tt>!
|
|
186
186
|
Fork this repository, clone your fork and start by installing the dependencies:
|
187
187
|
|
188
188
|
bundle install
|
189
|
+
|
190
|
+
Note: if you're getting an error installing <tt>capybara-webkit</tt>, most likely you need to install QT, see: https://github.com/thoughtbot/capybara-webkit/wiki/Installing-Qt-and-compiling-capybara-webkit
|
189
191
|
|
190
192
|
Save <tt>spec/rails_app/features/config.yml.example</tt> as <tt>spec/rails_app/features/config.yml</tt> and edit it to set values for an existent BigBlueButton server. You will need it to run the integration tests. For more information see the page {Testing}[https://github.com/mconf/bigbluebutton_rails/wiki/Testing] in our wiki.
|
191
193
|
|
192
|
-
Prepare the rails_app used for tests:
|
194
|
+
Prepare the <tt>rails_app</tt> used for tests:
|
193
195
|
|
194
196
|
rake rails_app:install
|
195
197
|
rake rails_app:db SERVER=my-server # select a server you defined in 'config.yml'
|
@@ -215,6 +217,8 @@ Develop. :)
|
|
215
217
|
|
216
218
|
If you want your code to be integrated in this repository, please fork it, create a branch with your modifications and submit a pull request.
|
217
219
|
|
220
|
+
* See more about testing {in our wiki page}[https://github.com/mconf/bigbluebutton_rails/wiki/Testing].
|
221
|
+
|
218
222
|
=== Test Coverage
|
219
223
|
|
220
224
|
Coverage is analyzed by default when you run:
|
@@ -250,7 +250,7 @@ class Bigbluebutton::RoomsController < ApplicationController
|
|
250
250
|
else
|
251
251
|
respond_with do |format|
|
252
252
|
format.html {
|
253
|
-
redirect_to(bigbluebutton_room_path(@room), :notice => message)
|
253
|
+
redirect_to(params[:redir_url] || bigbluebutton_room_path(@room), :notice => message)
|
254
254
|
}
|
255
255
|
format.json { render :json => message }
|
256
256
|
end
|
@@ -330,7 +330,7 @@ class Bigbluebutton::RoomsController < ApplicationController
|
|
330
330
|
@room.create_meeting(username, id, request)
|
331
331
|
else
|
332
332
|
flash[:error] = t('bigbluebutton_rails.rooms.errors.auth.cannot_create')
|
333
|
-
render wait_action
|
333
|
+
render wait_action, :status => :unauthorized
|
334
334
|
return
|
335
335
|
end
|
336
336
|
end
|
@@ -23,7 +23,6 @@ class BigbluebuttonRoom < ActiveRecord::Base
|
|
23
23
|
:length => { :minimum => 1, :maximum => 150 }
|
24
24
|
validates :welcome_msg, :length => { :maximum => 250 }
|
25
25
|
validates :private, :inclusion => { :in => [true, false] }
|
26
|
-
validates :voice_bridge, :presence => true, :uniqueness => true
|
27
26
|
validates :record, :inclusion => { :in => [true, false] }
|
28
27
|
|
29
28
|
validates :duration,
|
@@ -147,6 +146,7 @@ class BigbluebuttonRoom < ActiveRecord::Base
|
|
147
146
|
unless response.nil?
|
148
147
|
self.attendee_password = response[:attendeePW]
|
149
148
|
self.moderator_password = response[:moderatorPW]
|
149
|
+
self.voice_bridge = response[:voiceBridge] if response.has_key?(:voiceBridge)
|
150
150
|
self.save unless self.new_record?
|
151
151
|
end
|
152
152
|
|
@@ -275,7 +275,6 @@ class BigbluebuttonRoom < ActiveRecord::Base
|
|
275
275
|
|
276
276
|
def init
|
277
277
|
self[:meetingid] ||= unique_meetingid
|
278
|
-
self[:voice_bridge] ||= random_voice_bridge
|
279
278
|
|
280
279
|
@request_headers = {}
|
281
280
|
|
@@ -289,16 +288,6 @@ class BigbluebuttonRoom < ActiveRecord::Base
|
|
289
288
|
@attendees = []
|
290
289
|
end
|
291
290
|
|
292
|
-
def random_voice_bridge
|
293
|
-
value = (70000 + SecureRandom.random_number(9999)).to_s
|
294
|
-
count = 1
|
295
|
-
while not BigbluebuttonRoom.find_by_voice_bridge(value).nil? and count < 10
|
296
|
-
count += 1
|
297
|
-
value = (70000 + SecureRandom.random_number(9999)).to_s
|
298
|
-
end
|
299
|
-
value
|
300
|
-
end
|
301
|
-
|
302
291
|
def do_create_meeting(username=nil, userid=nil)
|
303
292
|
opts = {
|
304
293
|
:record => self.record,
|
@@ -308,10 +297,15 @@ class BigbluebuttonRoom < ActiveRecord::Base
|
|
308
297
|
:welcome => self.welcome_msg.blank? ? default_welcome_message : self.welcome_msg,
|
309
298
|
:dialNumber => self.dial_number,
|
310
299
|
:logoutURL => self.full_logout_url || self.logout_url,
|
311
|
-
:maxParticipants => self.max_participants
|
312
|
-
:voiceBridge => self.voice_bridge
|
300
|
+
:maxParticipants => self.max_participants
|
313
301
|
}.merge(self.get_metadata_for_create)
|
314
302
|
|
303
|
+
# Set the voice bridge only if the gem is configured to do so and the voice bridge
|
304
|
+
# is not blank.
|
305
|
+
if BigbluebuttonRails.use_local_voice_bridges && !self.voice_bridge.blank?
|
306
|
+
opts.merge!({ :voiceBridge => self.voice_bridge })
|
307
|
+
end
|
308
|
+
|
315
309
|
# Add information about the user that is creating the meeting (if any)
|
316
310
|
opts.merge!({ "meta_#{BigbluebuttonRails.metadata_user_id}" => userid }) unless userid.nil?
|
317
311
|
opts.merge!({ "meta_#{BigbluebuttonRails.metadata_user_name}" => username }) unless username.nil?
|
data/lib/bigbluebutton_rails.rb
CHANGED
@@ -50,6 +50,16 @@ module BigbluebuttonRails
|
|
50
50
|
@@metadata_user_id,
|
51
51
|
@@metadata_user_name ]
|
52
52
|
|
53
|
+
# Whether or not the gem should pass the voice bridges set in the rooms when making
|
54
|
+
# API calls. By default it is false, meaning that the voice bridge will never be
|
55
|
+
# passed, so it will be generated by the web conference server. Setting it to true
|
56
|
+
# will make the voice bridge set locally in the room to be used in the web conference
|
57
|
+
# server. Notice that the voice bridge has to be unique in a web conference server, so
|
58
|
+
# if you are setting the voice bridges manually, you will also have to make sure that
|
59
|
+
# the voice bridges are unique (there's nothing in the gem to guarantee this uniqueness).
|
60
|
+
mattr_accessor :use_local_voice_bridges
|
61
|
+
@@use_local_voice_bridges = false
|
62
|
+
|
53
63
|
# Finds the BigbluebuttonRoom associated with the recording data in 'data', if any.
|
54
64
|
# TODO: if not found, remove the association or keep the old one?
|
55
65
|
def self.match_room_recording(data)
|
@@ -32,7 +32,6 @@ class CreateBigbluebuttonRails < ActiveRecord::Migration
|
|
32
32
|
end
|
33
33
|
add_index :bigbluebutton_rooms, :server_id
|
34
34
|
add_index :bigbluebutton_rooms, :meetingid, :unique => true
|
35
|
-
add_index :bigbluebutton_rooms, :voice_bridge, :unique => true
|
36
35
|
|
37
36
|
create_table :bigbluebutton_recordings do |t|
|
38
37
|
t.integer :server_id
|
@@ -319,6 +319,29 @@ describe Bigbluebutton::RoomsController do
|
|
319
319
|
it { should redirect_to(bigbluebutton_room_path(room)) }
|
320
320
|
it { should assign_to(:room).with(room) }
|
321
321
|
it { should set_the_flash.to(I18n.t('bigbluebutton_rails.rooms.notice.end.success')) }
|
322
|
+
|
323
|
+
end
|
324
|
+
|
325
|
+
context ":redir_url => '/'" do
|
326
|
+
before {
|
327
|
+
mocked_api.should_receive(:is_meeting_running?).and_return(true)
|
328
|
+
mocked_api.should_receive(:end_meeting).with(room.meetingid, room.moderator_password)
|
329
|
+
}
|
330
|
+
|
331
|
+
before(:each) { get :end, :id => room.to_param, :redir_url => '/' }
|
332
|
+
it { should respond_with(:redirect) }
|
333
|
+
it { should redirect_to('/') }
|
334
|
+
end
|
335
|
+
|
336
|
+
context ":redir_url => '/example'" do
|
337
|
+
before {
|
338
|
+
mocked_api.should_receive(:is_meeting_running?).and_return(true)
|
339
|
+
mocked_api.should_receive(:end_meeting).with(room.meetingid, room.moderator_password)
|
340
|
+
}
|
341
|
+
|
342
|
+
before { get :end, :id => room.to_param, :redir_url => '/example' }
|
343
|
+
it { should respond_with(:redirect) }
|
344
|
+
it { should redirect_to('/example') }
|
322
345
|
end
|
323
346
|
|
324
347
|
context "room is not running" do
|
@@ -806,7 +829,7 @@ describe Bigbluebutton::RoomsController do
|
|
806
829
|
room.should_not_receive(:create_meeting)
|
807
830
|
}
|
808
831
|
before(:each) { get :join, :id => room.to_param }
|
809
|
-
it { should respond_with(:
|
832
|
+
it { should respond_with(:unauthorized) }
|
810
833
|
it { should render_template(:join) }
|
811
834
|
it { should set_the_flash.to(I18n.t('bigbluebutton_rails.rooms.errors.auth.cannot_create')) }
|
812
835
|
end
|
@@ -23,9 +23,6 @@ describe BigbluebuttonRoom do
|
|
23
23
|
it { should validate_uniqueness_of(:meetingid) }
|
24
24
|
it { should ensure_length_of(:meetingid).is_at_least(1).is_at_most(100) }
|
25
25
|
|
26
|
-
it { should validate_presence_of(:voice_bridge) }
|
27
|
-
it { should validate_uniqueness_of(:voice_bridge) }
|
28
|
-
|
29
26
|
it { should validate_presence_of(:name) }
|
30
27
|
it { should validate_uniqueness_of(:name) }
|
31
28
|
it { should ensure_length_of(:name).is_at_least(1).is_at_most(150) }
|
@@ -146,24 +143,6 @@ describe BigbluebuttonRoom do
|
|
146
143
|
b.meetingid.should == "user defined"
|
147
144
|
}
|
148
145
|
end
|
149
|
-
|
150
|
-
context "voice_bridge" do
|
151
|
-
it {
|
152
|
-
b = BigbluebuttonRoom.new(:voice_bridge => "user defined")
|
153
|
-
b.voice_bridge.should == "user defined"
|
154
|
-
}
|
155
|
-
context "with a random value" do
|
156
|
-
it { room.voice_bridge.should_not be_nil }
|
157
|
-
it { room.voice_bridge.should =~ /7[0-9]{4}/ }
|
158
|
-
it "tries to randomize 10 times if voice_bridge already exists" do
|
159
|
-
room = FactoryGirl.create(:bigbluebutton_room, :voice_bridge => "70000")
|
160
|
-
BigbluebuttonRoom.stub!(:find_by_voice_bridge).and_return(room)
|
161
|
-
SecureRandom.should_receive(:random_number).exactly(10).and_return(0000)
|
162
|
-
room2 = BigbluebuttonRoom.new # triggers the random_number calls
|
163
|
-
room2.voice_bridge.should == "70000"
|
164
|
-
end
|
165
|
-
end
|
166
|
-
end
|
167
146
|
end
|
168
147
|
|
169
148
|
context "#param format" do
|
@@ -334,11 +313,13 @@ describe BigbluebuttonRoom do
|
|
334
313
|
describe "#send_create" do
|
335
314
|
let(:attendee_password) { Forgery(:basic).password }
|
336
315
|
let(:moderator_password) { Forgery(:basic).password }
|
316
|
+
let(:voice_bridge) { SecureRandom.random_number(99999) }
|
337
317
|
let(:hash_create) {
|
338
318
|
{
|
339
319
|
:returncode => "SUCCESS", :meetingID => "test_id",
|
340
320
|
:attendeePW => attendee_password, :moderatorPW => moderator_password,
|
341
|
-
:
|
321
|
+
:voiceBridge => voice_bridge, :hasBeenForciblyEnded => "false",
|
322
|
+
:messageKey => {}, :message => {}
|
342
323
|
}
|
343
324
|
}
|
344
325
|
before {
|
@@ -383,6 +364,7 @@ describe BigbluebuttonRoom do
|
|
383
364
|
end
|
384
365
|
it { room.attendee_password.should be(attendee_password) }
|
385
366
|
it { room.moderator_password.should be(moderator_password) }
|
367
|
+
it { room.voice_bridge.should be(voice_bridge) }
|
386
368
|
it { room.changed?.should be_false }
|
387
369
|
end
|
388
370
|
|
@@ -398,6 +380,7 @@ describe BigbluebuttonRoom do
|
|
398
380
|
end
|
399
381
|
it { new_room.attendee_password.should be(attendee_password) }
|
400
382
|
it { new_room.moderator_password.should be(moderator_password) }
|
383
|
+
it { new_room.voice_bridge.should be(voice_bridge) }
|
401
384
|
it("and do not save the record") { new_room.new_record?.should be_true }
|
402
385
|
end
|
403
386
|
|
@@ -415,6 +398,62 @@ describe BigbluebuttonRoom do
|
|
415
398
|
it { room.moderator_password.should be(moderator_password) }
|
416
399
|
it { room.changed?.should be_false }
|
417
400
|
end
|
401
|
+
|
402
|
+
context "when the call to create doesn't return a voice bridge" do
|
403
|
+
before do
|
404
|
+
hash_create.delete(:voiceBridge)
|
405
|
+
mocked_api.should_receive(:create_meeting)
|
406
|
+
.with(room.name, room.meetingid, get_create_params(room))
|
407
|
+
.and_return(hash_create)
|
408
|
+
room.stub(:select_server).and_return(mocked_server)
|
409
|
+
room.server = mocked_server
|
410
|
+
room.send_create
|
411
|
+
end
|
412
|
+
it { room.voice_bridge.should be_nil }
|
413
|
+
it { room.changed?.should be_false }
|
414
|
+
end
|
415
|
+
|
416
|
+
context "when it's set to use local voice bridges" do
|
417
|
+
before {
|
418
|
+
@use_local_voice_bridges = BigbluebuttonRails.use_local_voice_bridges
|
419
|
+
BigbluebuttonRails.use_local_voice_bridges = true
|
420
|
+
}
|
421
|
+
after {
|
422
|
+
BigbluebuttonRails.use_local_voice_bridges = @use_local_voice_bridges
|
423
|
+
}
|
424
|
+
|
425
|
+
context "sets the voice bridge in the params if there's a voice bridge" do
|
426
|
+
let(:voice_bridge) { SecureRandom.random_number(99999) }
|
427
|
+
before do
|
428
|
+
room.update_attributes(:voice_bridge => voice_bridge)
|
429
|
+
create_params = get_create_params(room)
|
430
|
+
create_params.merge!({ :voiceBridge => voice_bridge })
|
431
|
+
|
432
|
+
mocked_api.should_receive(:create_meeting)
|
433
|
+
.with(room.name, room.meetingid, create_params)
|
434
|
+
.and_return(hash_create)
|
435
|
+
room.stub(:select_server).and_return(mocked_server)
|
436
|
+
room.server = mocked_server
|
437
|
+
room.send_create
|
438
|
+
end
|
439
|
+
it { room.changed?.should be_false }
|
440
|
+
end
|
441
|
+
|
442
|
+
context "doesn't set the voice bridge if it's blank" do
|
443
|
+
let(:voice_bridge) { SecureRandom.random_number(99999) }
|
444
|
+
before do
|
445
|
+
room.update_attributes(:voice_bridge => "")
|
446
|
+
|
447
|
+
mocked_api.should_receive(:create_meeting)
|
448
|
+
.with(room.name, room.meetingid, get_create_params(room))
|
449
|
+
.and_return(hash_create)
|
450
|
+
room.stub(:select_server).and_return(mocked_server)
|
451
|
+
room.server = mocked_server
|
452
|
+
room.send_create
|
453
|
+
end
|
454
|
+
it { room.changed?.should be_false }
|
455
|
+
end
|
456
|
+
end
|
418
457
|
end
|
419
458
|
|
420
459
|
context "generates a meetingid if nil" do
|
@@ -674,7 +713,7 @@ def get_create_params(room, username=nil, userid=nil)
|
|
674
713
|
:dialNumber => room.dial_number,
|
675
714
|
:logoutURL => room.logout_url,
|
676
715
|
:maxParticipants => room.max_participants,
|
677
|
-
|
716
|
+
#:voiceBridge => room.voice_bridge,
|
678
717
|
:record => room.record,
|
679
718
|
:duration => room.duration
|
680
719
|
}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bigbluebutton_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.0.
|
4
|
+
version: 1.3.0.mweb1
|
5
5
|
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2014-12-10 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|
@@ -115,6 +115,7 @@ files:
|
|
115
115
|
- lib/generators/bigbluebutton_rails/templates/migration_0_0_5.rb
|
116
116
|
- lib/generators/bigbluebutton_rails/templates/migration_1_3_0.rb
|
117
117
|
- lib/generators/bigbluebutton_rails/templates/migration_1_3_0_b.rb
|
118
|
+
- lib/generators/bigbluebutton_rails/templates/migration_1_3_0_mweb1.rb
|
118
119
|
- lib/generators/bigbluebutton_rails/views_generator.rb
|
119
120
|
- lib/tasks/bigbluebutton_rails/recordings.rake
|
120
121
|
- spec/bigbluebutton_rails_spec.rb
|
@@ -258,7 +259,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
258
259
|
version: '0'
|
259
260
|
segments:
|
260
261
|
- 0
|
261
|
-
hash:
|
262
|
+
hash: 2534555688455246723
|
262
263
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
263
264
|
none: false
|
264
265
|
requirements:
|