bigbluebutton_rails 1.3.0.mweb1 → 1.3.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.
- data/CHANGELOG.rdoc +1 -1
- data/Gemfile +0 -1
- data/Gemfile.lock +2 -8
- data/app/models/bigbluebutton_room.rb +14 -8
- data/lib/bigbluebutton_rails/version.rb +1 -1
- data/lib/bigbluebutton_rails.rb +0 -10
- data/lib/generators/bigbluebutton_rails/templates/migration.rb +1 -0
- data/spec/models/bigbluebutton_room_spec.rb +23 -62
- metadata +9 -7
- data/lib/generators/bigbluebutton_rails/templates/migration_1_3_0_mweb1.rb +0 -9
data/CHANGELOG.rdoc
CHANGED
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)
|
11
11
|
bigbluebutton-api-ruby (~> 1.2.0)
|
12
12
|
rails (>= 3.0.0)
|
13
13
|
|
@@ -115,7 +115,6 @@ GEM
|
|
115
115
|
addressable (~> 2.3)
|
116
116
|
ffi (~> 1.1.1)
|
117
117
|
spoon (~> 0.0.1)
|
118
|
-
libv8 (3.16.14.7)
|
119
118
|
libwebsocket (0.1.5)
|
120
119
|
addressable
|
121
120
|
mail (2.4.4)
|
@@ -172,7 +171,6 @@ GEM
|
|
172
171
|
rake (10.0.1)
|
173
172
|
rdoc (3.12)
|
174
173
|
json (~> 1.4)
|
175
|
-
ref (1.0.5)
|
176
174
|
rspec-core (2.12.0)
|
177
175
|
rspec-expectations (2.12.0)
|
178
176
|
diff-lcs (~> 1.1.3)
|
@@ -211,12 +209,9 @@ GEM
|
|
211
209
|
sqlite3 (1.3.6)
|
212
210
|
sqlite3-ruby (1.3.3)
|
213
211
|
sqlite3 (>= 1.3.3)
|
214
|
-
therubyracer (0.12.1)
|
215
|
-
libv8 (~> 3.16.14.0)
|
216
|
-
ref
|
217
212
|
thor (0.16.0)
|
218
213
|
tilt (1.3.3)
|
219
|
-
treetop (1.4.
|
214
|
+
treetop (1.4.14)
|
220
215
|
polyglot
|
221
216
|
polyglot (>= 0.3.1)
|
222
217
|
tzinfo (0.3.35)
|
@@ -259,6 +254,5 @@ DEPENDENCIES
|
|
259
254
|
shoulda-matchers
|
260
255
|
simplecov (>= 0.4.0)
|
261
256
|
sqlite3-ruby
|
262
|
-
therubyracer
|
263
257
|
uglifier (>= 1.0.3)
|
264
258
|
whenever
|
@@ -23,6 +23,7 @@ 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
|
26
27
|
validates :record, :inclusion => { :in => [true, false] }
|
27
28
|
|
28
29
|
validates :duration,
|
@@ -146,7 +147,6 @@ class BigbluebuttonRoom < ActiveRecord::Base
|
|
146
147
|
unless response.nil?
|
147
148
|
self.attendee_password = response[:attendeePW]
|
148
149
|
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,6 +275,7 @@ class BigbluebuttonRoom < ActiveRecord::Base
|
|
275
275
|
|
276
276
|
def init
|
277
277
|
self[:meetingid] ||= unique_meetingid
|
278
|
+
self[:voice_bridge] ||= random_voice_bridge
|
278
279
|
|
279
280
|
@request_headers = {}
|
280
281
|
|
@@ -288,6 +289,16 @@ class BigbluebuttonRoom < ActiveRecord::Base
|
|
288
289
|
@attendees = []
|
289
290
|
end
|
290
291
|
|
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
|
+
|
291
302
|
def do_create_meeting(username=nil, userid=nil)
|
292
303
|
opts = {
|
293
304
|
:record => self.record,
|
@@ -297,15 +308,10 @@ class BigbluebuttonRoom < ActiveRecord::Base
|
|
297
308
|
:welcome => self.welcome_msg.blank? ? default_welcome_message : self.welcome_msg,
|
298
309
|
:dialNumber => self.dial_number,
|
299
310
|
:logoutURL => self.full_logout_url || self.logout_url,
|
300
|
-
:maxParticipants => self.max_participants
|
311
|
+
:maxParticipants => self.max_participants,
|
312
|
+
:voiceBridge => self.voice_bridge
|
301
313
|
}.merge(self.get_metadata_for_create)
|
302
314
|
|
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
|
-
|
309
315
|
# Add information about the user that is creating the meeting (if any)
|
310
316
|
opts.merge!({ "meta_#{BigbluebuttonRails.metadata_user_id}" => userid }) unless userid.nil?
|
311
317
|
opts.merge!({ "meta_#{BigbluebuttonRails.metadata_user_name}" => username }) unless username.nil?
|
data/lib/bigbluebutton_rails.rb
CHANGED
@@ -50,16 +50,6 @@ 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
|
-
|
63
53
|
# Finds the BigbluebuttonRoom associated with the recording data in 'data', if any.
|
64
54
|
# TODO: if not found, remove the association or keep the old one?
|
65
55
|
def self.match_room_recording(data)
|
@@ -32,6 +32,7 @@ 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
|
35
36
|
|
36
37
|
create_table :bigbluebutton_recordings do |t|
|
37
38
|
t.integer :server_id
|
@@ -23,6 +23,9 @@ 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
|
+
|
26
29
|
it { should validate_presence_of(:name) }
|
27
30
|
it { should validate_uniqueness_of(:name) }
|
28
31
|
it { should ensure_length_of(:name).is_at_least(1).is_at_most(150) }
|
@@ -143,6 +146,24 @@ describe BigbluebuttonRoom do
|
|
143
146
|
b.meetingid.should == "user defined"
|
144
147
|
}
|
145
148
|
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
|
146
167
|
end
|
147
168
|
|
148
169
|
context "#param format" do
|
@@ -313,13 +334,11 @@ describe BigbluebuttonRoom do
|
|
313
334
|
describe "#send_create" do
|
314
335
|
let(:attendee_password) { Forgery(:basic).password }
|
315
336
|
let(:moderator_password) { Forgery(:basic).password }
|
316
|
-
let(:voice_bridge) { SecureRandom.random_number(99999) }
|
317
337
|
let(:hash_create) {
|
318
338
|
{
|
319
339
|
:returncode => "SUCCESS", :meetingID => "test_id",
|
320
340
|
:attendeePW => attendee_password, :moderatorPW => moderator_password,
|
321
|
-
:
|
322
|
-
:messageKey => {}, :message => {}
|
341
|
+
:hasBeenForciblyEnded => "false", :messageKey => {}, :message => {}
|
323
342
|
}
|
324
343
|
}
|
325
344
|
before {
|
@@ -364,7 +383,6 @@ describe BigbluebuttonRoom do
|
|
364
383
|
end
|
365
384
|
it { room.attendee_password.should be(attendee_password) }
|
366
385
|
it { room.moderator_password.should be(moderator_password) }
|
367
|
-
it { room.voice_bridge.should be(voice_bridge) }
|
368
386
|
it { room.changed?.should be_false }
|
369
387
|
end
|
370
388
|
|
@@ -380,7 +398,6 @@ describe BigbluebuttonRoom do
|
|
380
398
|
end
|
381
399
|
it { new_room.attendee_password.should be(attendee_password) }
|
382
400
|
it { new_room.moderator_password.should be(moderator_password) }
|
383
|
-
it { new_room.voice_bridge.should be(voice_bridge) }
|
384
401
|
it("and do not save the record") { new_room.new_record?.should be_true }
|
385
402
|
end
|
386
403
|
|
@@ -398,62 +415,6 @@ describe BigbluebuttonRoom do
|
|
398
415
|
it { room.moderator_password.should be(moderator_password) }
|
399
416
|
it { room.changed?.should be_false }
|
400
417
|
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
|
457
418
|
end
|
458
419
|
|
459
420
|
context "generates a meetingid if nil" do
|
@@ -713,7 +674,7 @@ def get_create_params(room, username=nil, userid=nil)
|
|
713
674
|
:dialNumber => room.dial_number,
|
714
675
|
:logoutURL => room.logout_url,
|
715
676
|
:maxParticipants => room.max_participants,
|
716
|
-
|
677
|
+
:voiceBridge => room.voice_bridge,
|
717
678
|
:record => room.record,
|
718
679
|
:duration => room.duration
|
719
680
|
}
|
metadata
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bigbluebutton_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.0
|
5
|
-
prerelease:
|
4
|
+
version: 1.3.0
|
5
|
+
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Mconf
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2013-07-27 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|
@@ -115,7 +115,6 @@ 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
|
119
118
|
- lib/generators/bigbluebutton_rails/views_generator.rb
|
120
119
|
- lib/tasks/bigbluebutton_rails/recordings.rake
|
121
120
|
- spec/bigbluebutton_rails_spec.rb
|
@@ -259,13 +258,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
259
258
|
version: '0'
|
260
259
|
segments:
|
261
260
|
- 0
|
262
|
-
hash:
|
261
|
+
hash: 4548361948436062604
|
263
262
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
264
263
|
none: false
|
265
264
|
requirements:
|
266
|
-
- - ! '
|
265
|
+
- - ! '>='
|
267
266
|
- !ruby/object:Gem::Version
|
268
|
-
version:
|
267
|
+
version: '0'
|
268
|
+
segments:
|
269
|
+
- 0
|
270
|
+
hash: 4548361948436062604
|
269
271
|
requirements: []
|
270
272
|
rubyforge_project:
|
271
273
|
rubygems_version: 1.8.23
|