bigbluebutton-api-ruby 1.9.0 → 2.0.0.pre.rc.1
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.
- checksums.yaml +4 -4
- data/.github/workflows/publish-gem-on-tag-push.yml +20 -0
- data/.ruby-version +1 -1
- data/CHANGELOG.md +6 -0
- data/Dockerfile +6 -2
- data/Gemfile +5 -10
- data/Gemfile.lock +26 -78
- data/Rakefile +0 -22
- data/bigbluebutton-api-ruby.gemspec +3 -7
- data/features/step_definitions/check_status_steps.rb +9 -9
- data/features/step_definitions/common_steps.rb +6 -6
- data/features/step_definitions/end_meetings_steps.rb +3 -3
- data/features/step_definitions/recordings_steps.rb +4 -4
- data/lib/bigbluebutton_api.rb +5 -91
- data/spec/bigbluebutton_api_spec.rb +38 -47
- data/spec/bigbluebutton_formatter_spec.rb +5 -5
- metadata +18 -93
- data/examples/config_xml.rb +0 -74
- data/lib/bigbluebutton_config_layout.rb +0 -58
- data/lib/bigbluebutton_config_xml.rb +0 -125
- data/spec/bigbluebutton_api_0.81_spec.rb +0 -153
- data/spec/bigbluebutton_config_layout_spec.rb +0 -86
- data/spec/bigbluebutton_config_xml_spec.rb +0 -302
@@ -302,9 +302,9 @@ describe BigBlueButton::BigBlueButtonApi do
|
|
302
302
|
before {
|
303
303
|
api.should_receive(:send_api_request).with(:getMeetings, {}).
|
304
304
|
and_return(flattened_response)
|
305
|
-
|
306
|
-
|
307
|
-
BigBlueButton::BigBlueButtonFormatter.should_receive(:new).and_return(
|
305
|
+
formatter_double = double(BigBlueButton::BigBlueButtonFormatter)
|
306
|
+
formatter_double.should_receive(:flatten_objects).with(:meetings, :meeting)
|
307
|
+
BigBlueButton::BigBlueButtonFormatter.should_receive(:new).and_return(formatter_double)
|
308
308
|
BigBlueButton::BigBlueButtonFormatter.should_receive(:format_meeting).with(meeting_hash1)
|
309
309
|
BigBlueButton::BigBlueButtonFormatter.should_receive(:format_meeting).with(meeting_hash2)
|
310
310
|
}
|
@@ -381,27 +381,27 @@ describe BigBlueButton::BigBlueButtonApi do
|
|
381
381
|
describe "#last_http_response" do
|
382
382
|
# we test this through a #test_connection call
|
383
383
|
|
384
|
-
let(:
|
384
|
+
let(:request_double) { double }
|
385
385
|
before {
|
386
386
|
api.should_receive(:get_url)
|
387
387
|
# this return value will be stored in @http_response
|
388
|
-
api.should_receive(:send_request).and_return(
|
388
|
+
api.should_receive(:send_request).and_return(request_double)
|
389
389
|
# to return fast from #send_api_request
|
390
|
-
|
390
|
+
request_double.should_receive(:body).and_return("")
|
391
391
|
api.test_connection
|
392
392
|
}
|
393
|
-
it { api.last_http_response.should ==
|
393
|
+
it { api.last_http_response.should == request_double }
|
394
394
|
end
|
395
395
|
|
396
396
|
describe "#last_xml_response" do
|
397
397
|
# we test this through a #test_connection call
|
398
398
|
|
399
|
-
let(:
|
399
|
+
let(:request_double) { double }
|
400
400
|
let(:expected_xml) { "<response><returncode>SUCCESS</returncode></response>" }
|
401
401
|
before {
|
402
402
|
api.should_receive(:get_url)
|
403
|
-
api.should_receive(:send_request).and_return(
|
404
|
-
|
403
|
+
api.should_receive(:send_request).and_return(request_double)
|
404
|
+
request_double.should_receive(:body).at_least(1).and_return(expected_xml)
|
405
405
|
api.test_connection
|
406
406
|
}
|
407
407
|
it { api.last_xml_response.should == expected_xml }
|
@@ -441,15 +441,6 @@ describe BigBlueButton::BigBlueButtonApi do
|
|
441
441
|
end
|
442
442
|
end
|
443
443
|
|
444
|
-
context "when method = :setConfigXML" do
|
445
|
-
it {
|
446
|
-
api.url = 'http://my-test-server.com/bigbluebutton/api'
|
447
|
-
response = api.get_url(:setConfigXML, { param1: 1, param2: 2 })
|
448
|
-
response[0].should eql('http://my-test-server.com/bigbluebutton/api/setConfigXML')
|
449
|
-
response[1].should match(/checksum=.*¶m1=1¶m2=2/)
|
450
|
-
}
|
451
|
-
end
|
452
|
-
|
453
444
|
context "discards params with nil value" do
|
454
445
|
let(:params) { { :param1 => "value1", :param2 => nil } }
|
455
446
|
subject { api.get_url(:join, params)[0] }
|
@@ -512,22 +503,22 @@ describe BigBlueButton::BigBlueButtonApi do
|
|
512
503
|
let(:data) { "any data" }
|
513
504
|
let(:url) { "http://test-server:8080?param1=value1&checksum=12345" }
|
514
505
|
let(:make_request) { api.send_api_request(method, params, data) }
|
515
|
-
let(:
|
506
|
+
let(:response_double) { double() } # mock of what send_request() would return
|
516
507
|
|
517
508
|
before { api.should_receive(:get_url).with(method, params).and_return([url, nil]) }
|
518
509
|
|
519
510
|
context "returns an empty hash if the response body is empty" do
|
520
511
|
before do
|
521
|
-
api.should_receive(:send_request).with(url, data).and_return(
|
522
|
-
|
512
|
+
api.should_receive(:send_request).with(url, data).and_return(response_double)
|
513
|
+
response_double.should_receive(:body).and_return("")
|
523
514
|
end
|
524
515
|
it { make_request.should == { } }
|
525
516
|
end
|
526
517
|
|
527
518
|
context "hashfies and validates the response body" do
|
528
519
|
before do
|
529
|
-
api.should_receive(:send_request).with(url, data).and_return(
|
530
|
-
|
520
|
+
api.should_receive(:send_request).with(url, data).and_return(response_double)
|
521
|
+
response_double.should_receive(:body).twice.and_return("response-body")
|
531
522
|
end
|
532
523
|
|
533
524
|
context "checking if it has a :response key" do
|
@@ -545,15 +536,15 @@ describe BigBlueButton::BigBlueButtonApi do
|
|
545
536
|
let(:response) { { :returncode => "SUCCESS" } }
|
546
537
|
let(:formatted_response) { { :returncode => true, :messageKey => "", :message => "" } }
|
547
538
|
before do
|
548
|
-
api.should_receive(:send_request).with(url, data).and_return(
|
549
|
-
|
539
|
+
api.should_receive(:send_request).with(url, data).and_return(response_double)
|
540
|
+
response_double.should_receive(:body).twice.and_return("response-body")
|
550
541
|
BigBlueButton::BigBlueButtonHash.should_receive(:from_xml).with("response-body").and_return(response)
|
551
542
|
|
552
543
|
# here starts the validation
|
553
544
|
# doesn't test the resulting format, only that the formatter was called
|
554
|
-
|
555
|
-
BigBlueButton::BigBlueButtonFormatter.should_receive(:new).with(response).and_return(
|
556
|
-
|
545
|
+
formatter_double = double(BigBlueButton::BigBlueButtonFormatter)
|
546
|
+
BigBlueButton::BigBlueButtonFormatter.should_receive(:new).with(response).and_return(formatter_double)
|
547
|
+
formatter_double.should_receive(:default_formatting).and_return(formatted_response)
|
557
548
|
end
|
558
549
|
it { make_request }
|
559
550
|
end
|
@@ -562,13 +553,13 @@ describe BigBlueButton::BigBlueButtonApi do
|
|
562
553
|
let(:response) { { :returncode => true } }
|
563
554
|
let(:formatted_response) { { } }
|
564
555
|
before do
|
565
|
-
api.should_receive(:send_request).with(url, data).and_return(
|
566
|
-
|
556
|
+
api.should_receive(:send_request).with(url, data).and_return(response_double)
|
557
|
+
response_double.should_receive(:body).twice.and_return("response-body")
|
567
558
|
BigBlueButton::BigBlueButtonHash.should_receive(:from_xml).with("response-body").and_return(response)
|
568
559
|
|
569
|
-
|
570
|
-
BigBlueButton::BigBlueButtonFormatter.should_receive(:new).with(response).and_return(
|
571
|
-
|
560
|
+
formatter_double = double(BigBlueButton::BigBlueButtonFormatter)
|
561
|
+
BigBlueButton::BigBlueButtonFormatter.should_receive(:new).with(response).and_return(formatter_double)
|
562
|
+
formatter_double.should_receive(:default_formatting).and_return(formatted_response)
|
572
563
|
end
|
573
564
|
it { expect { make_request }.to raise_error(BigBlueButton::BigBlueButtonException) }
|
574
565
|
end
|
@@ -580,25 +571,25 @@ describe BigBlueButton::BigBlueButtonApi do
|
|
580
571
|
let(:res) { Net::HTTPResponse.new(1.0, '200', 'OK') }
|
581
572
|
|
582
573
|
before do
|
583
|
-
@
|
584
|
-
@
|
585
|
-
@
|
586
|
-
Net::HTTP.should_receive(:new).with("test-server", 8080).and_return(@
|
574
|
+
@http_double = double(Net::HTTP)
|
575
|
+
@http_double.should_receive(:"open_timeout=").with(api.timeout)
|
576
|
+
@http_double.should_receive(:"read_timeout=").with(api.timeout)
|
577
|
+
Net::HTTP.should_receive(:new).with("test-server", 8080).and_return(@http_double)
|
587
578
|
res.stub(:body) { "ok" }
|
588
579
|
end
|
589
580
|
|
590
581
|
context "standard case" do
|
591
|
-
before { @
|
582
|
+
before { @http_double.should_receive(:get).with("/res?param1=value1&checksum=12345", {}).and_return(res) }
|
592
583
|
it { api.send(:send_request, url).should == res }
|
593
584
|
end
|
594
585
|
|
595
586
|
context "handles a TimeoutError" do
|
596
|
-
before { @
|
587
|
+
before { @http_double.should_receive(:get) { raise TimeoutError } }
|
597
588
|
it { expect { api.send(:send_request, url) }.to raise_error(BigBlueButton::BigBlueButtonException) }
|
598
589
|
end
|
599
590
|
|
600
591
|
context "handles general Exceptions" do
|
601
|
-
before { @
|
592
|
+
before { @http_double.should_receive(:get) { raise Exception } }
|
602
593
|
it { expect { api.send(:send_request, url) }.to raise_error(BigBlueButton::BigBlueButtonException) }
|
603
594
|
end
|
604
595
|
|
@@ -607,7 +598,7 @@ describe BigBlueButton::BigBlueButtonApi do
|
|
607
598
|
before {
|
608
599
|
path = "/res?param1=value1&checksum=12345"
|
609
600
|
opts = { 'Content-Type' => 'application/xml' }
|
610
|
-
@
|
601
|
+
@http_double.should_receive(:post).with(path, data, opts).and_return(res)
|
611
602
|
}
|
612
603
|
it {
|
613
604
|
api.send(:send_request, url, data).should == res
|
@@ -616,7 +607,7 @@ describe BigBlueButton::BigBlueButtonApi do
|
|
616
607
|
|
617
608
|
context "get with headers" do
|
618
609
|
let(:headers_hash) { { :anything => "anything" } }
|
619
|
-
before { @
|
610
|
+
before { @http_double.should_receive(:get).with("/res?param1=value1&checksum=12345", headers_hash).and_return(res) }
|
620
611
|
it {
|
621
612
|
api.request_headers = headers_hash
|
622
613
|
api.send(:send_request, url).should == res
|
@@ -629,7 +620,7 @@ describe BigBlueButton::BigBlueButtonApi do
|
|
629
620
|
before {
|
630
621
|
path = "/res?param1=value1&checksum=12345"
|
631
622
|
opts = { 'Content-Type' => 'application/xml', :anything => "anything" }
|
632
|
-
@
|
623
|
+
@http_double.should_receive(:post).with(path, data, opts).and_return(res)
|
633
624
|
}
|
634
625
|
it {
|
635
626
|
api.request_headers = headers_hash
|
@@ -694,11 +685,11 @@ describe BigBlueButton::BigBlueButtonApi do
|
|
694
685
|
context "formats the response" do
|
695
686
|
before {
|
696
687
|
api.should_receive(:send_api_request).with(:getRecordings, anything).and_return(flattened_response)
|
697
|
-
|
698
|
-
|
688
|
+
formatter_double = double(BigBlueButton::BigBlueButtonFormatter)
|
689
|
+
formatter_double.should_receive(:flatten_objects).with(:recordings, :recording)
|
699
690
|
BigBlueButton::BigBlueButtonFormatter.should_receive(:format_recording).with(recording1)
|
700
691
|
BigBlueButton::BigBlueButtonFormatter.should_receive(:format_recording).with(recording2)
|
701
|
-
BigBlueButton::BigBlueButtonFormatter.should_receive(:new).and_return(
|
692
|
+
BigBlueButton::BigBlueButtonFormatter.should_receive(:new).and_return(formatter_double)
|
702
693
|
}
|
703
694
|
it { api.get_recordings }
|
704
695
|
end
|
@@ -53,10 +53,10 @@ describe BigBlueButton::BigBlueButtonFormatter do
|
|
53
53
|
formatter.to_boolean(:false1)
|
54
54
|
formatter.to_boolean(:false2)
|
55
55
|
}
|
56
|
-
it { hash[:true1].should
|
57
|
-
it { hash[:true2].should
|
58
|
-
it { hash[:false1].should
|
59
|
-
it { hash[:false2].should
|
56
|
+
it { hash[:true1].should be true }
|
57
|
+
it { hash[:true2].should be true }
|
58
|
+
it { hash[:false1].should be false }
|
59
|
+
it { hash[:false2].should be false }
|
60
60
|
|
61
61
|
context "returns false if the param doesn't exists" do
|
62
62
|
subject { BigBlueButton::BigBlueButtonFormatter.new({ :param => 1}) }
|
@@ -207,7 +207,7 @@ describe BigBlueButton::BigBlueButtonFormatter do
|
|
207
207
|
context "when :returncode should be false" do
|
208
208
|
before { input[:returncode] = "ERROR" }
|
209
209
|
subject { formatter.default_formatting }
|
210
|
-
it { subject[:returncode].should
|
210
|
+
it { subject[:returncode].should be false }
|
211
211
|
end
|
212
212
|
|
213
213
|
context "when :messageKey is empty" do
|
metadata
CHANGED
@@ -1,114 +1,44 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bigbluebutton-api-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0.pre.rc.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mconf
|
8
8
|
- Leonardo Crauss Daronco
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2025-09-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
-
name:
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
17
|
-
requirements:
|
18
|
-
- - ">="
|
19
|
-
- !ruby/object:Gem::Version
|
20
|
-
version: 1.0.1
|
21
|
-
type: :runtime
|
22
|
-
prerelease: false
|
23
|
-
version_requirements: !ruby/object:Gem::Requirement
|
24
|
-
requirements:
|
25
|
-
- - ">="
|
26
|
-
- !ruby/object:Gem::Version
|
27
|
-
version: 1.0.1
|
28
|
-
- !ruby/object:Gem::Dependency
|
29
|
-
name: ffi
|
30
|
-
requirement: !ruby/object:Gem::Requirement
|
31
|
-
requirements:
|
32
|
-
- - ">="
|
33
|
-
- !ruby/object:Gem::Version
|
34
|
-
version: 1.9.24
|
35
|
-
type: :runtime
|
36
|
-
prerelease: false
|
37
|
-
version_requirements: !ruby/object:Gem::Requirement
|
38
|
-
requirements:
|
39
|
-
- - ">="
|
40
|
-
- !ruby/object:Gem::Version
|
41
|
-
version: 1.9.24
|
42
|
-
- !ruby/object:Gem::Dependency
|
43
|
-
name: json
|
44
|
-
requirement: !ruby/object:Gem::Requirement
|
45
|
-
requirements:
|
46
|
-
- - ">="
|
47
|
-
- !ruby/object:Gem::Version
|
48
|
-
version: 1.8.6
|
49
|
-
type: :runtime
|
50
|
-
prerelease: false
|
51
|
-
version_requirements: !ruby/object:Gem::Requirement
|
52
|
-
requirements:
|
53
|
-
- - ">="
|
54
|
-
- !ruby/object:Gem::Version
|
55
|
-
version: 1.8.6
|
56
|
-
- !ruby/object:Gem::Dependency
|
57
|
-
name: nokogiri
|
58
|
-
requirement: !ruby/object:Gem::Requirement
|
59
|
-
requirements:
|
60
|
-
- - ">="
|
61
|
-
- !ruby/object:Gem::Version
|
62
|
-
version: 1.10.4
|
63
|
-
type: :runtime
|
64
|
-
prerelease: false
|
65
|
-
version_requirements: !ruby/object:Gem::Requirement
|
66
|
-
requirements:
|
67
|
-
- - ">="
|
68
|
-
- !ruby/object:Gem::Version
|
69
|
-
version: 1.10.4
|
70
|
-
- !ruby/object:Gem::Dependency
|
71
|
-
name: rack
|
15
|
+
name: xml-simple
|
72
16
|
requirement: !ruby/object:Gem::Requirement
|
73
17
|
requirements:
|
74
|
-
- - "
|
18
|
+
- - "~>"
|
75
19
|
- !ruby/object:Gem::Version
|
76
|
-
version: 1.
|
20
|
+
version: '1.1'
|
77
21
|
type: :runtime
|
78
22
|
prerelease: false
|
79
23
|
version_requirements: !ruby/object:Gem::Requirement
|
80
24
|
requirements:
|
81
|
-
- - "
|
25
|
+
- - "~>"
|
82
26
|
- !ruby/object:Gem::Version
|
83
|
-
version: 1.
|
27
|
+
version: '1.1'
|
84
28
|
- !ruby/object:Gem::Dependency
|
85
|
-
name:
|
29
|
+
name: base64
|
86
30
|
requirement: !ruby/object:Gem::Requirement
|
87
31
|
requirements:
|
88
32
|
- - ">="
|
89
33
|
- !ruby/object:Gem::Version
|
90
|
-
version: 1.
|
34
|
+
version: 0.1.0
|
91
35
|
type: :runtime
|
92
36
|
prerelease: false
|
93
37
|
version_requirements: !ruby/object:Gem::Requirement
|
94
38
|
requirements:
|
95
39
|
- - ">="
|
96
40
|
- !ruby/object:Gem::Version
|
97
|
-
version: 1.
|
98
|
-
- !ruby/object:Gem::Dependency
|
99
|
-
name: xml-simple
|
100
|
-
requirement: !ruby/object:Gem::Requirement
|
101
|
-
requirements:
|
102
|
-
- - "~>"
|
103
|
-
- !ruby/object:Gem::Version
|
104
|
-
version: '1.1'
|
105
|
-
type: :runtime
|
106
|
-
prerelease: false
|
107
|
-
version_requirements: !ruby/object:Gem::Requirement
|
108
|
-
requirements:
|
109
|
-
- - "~>"
|
110
|
-
- !ruby/object:Gem::Version
|
111
|
-
version: '1.1'
|
41
|
+
version: 0.1.0
|
112
42
|
description: Provides methods to access BigBlueButton in a ruby application through
|
113
43
|
its API
|
114
44
|
email:
|
@@ -122,6 +52,7 @@ extra_rdoc_files:
|
|
122
52
|
- LICENSE_003
|
123
53
|
- CHANGELOG.md
|
124
54
|
files:
|
55
|
+
- ".github/workflows/publish-gem-on-tag-push.yml"
|
125
56
|
- ".gitignore"
|
126
57
|
- ".rspec"
|
127
58
|
- ".ruby-version"
|
@@ -136,7 +67,6 @@ files:
|
|
136
67
|
- Rakefile
|
137
68
|
- bigbluebutton-api-ruby.gemspec
|
138
69
|
- docker-compose.yml
|
139
|
-
- examples/config_xml.rb
|
140
70
|
- examples/create.rb
|
141
71
|
- examples/get_version_example.rb
|
142
72
|
- examples/join_example.rb
|
@@ -161,17 +91,12 @@ files:
|
|
161
91
|
- features/support/features_helpers.rb
|
162
92
|
- features/support/hooks.rb
|
163
93
|
- lib/bigbluebutton_api.rb
|
164
|
-
- lib/bigbluebutton_config_layout.rb
|
165
|
-
- lib/bigbluebutton_config_xml.rb
|
166
94
|
- lib/bigbluebutton_exception.rb
|
167
95
|
- lib/bigbluebutton_formatter.rb
|
168
96
|
- lib/bigbluebutton_hash_to_xml.rb
|
169
97
|
- lib/bigbluebutton_modules.rb
|
170
|
-
- spec/bigbluebutton_api_0.81_spec.rb
|
171
98
|
- spec/bigbluebutton_api_0.9_spec.rb
|
172
99
|
- spec/bigbluebutton_api_spec.rb
|
173
|
-
- spec/bigbluebutton_config_layout_spec.rb
|
174
|
-
- spec/bigbluebutton_config_xml_spec.rb
|
175
100
|
- spec/bigbluebutton_exception_spec.rb
|
176
101
|
- spec/bigbluebutton_formatter_spec.rb
|
177
102
|
- spec/bigbluebutton_hash_to_xml_spec.rb
|
@@ -184,7 +109,7 @@ homepage: https://github.com/mconf/bigbluebutton-api-ruby/
|
|
184
109
|
licenses:
|
185
110
|
- MIT
|
186
111
|
metadata: {}
|
187
|
-
post_install_message:
|
112
|
+
post_install_message:
|
188
113
|
rdoc_options: []
|
189
114
|
require_paths:
|
190
115
|
- lib
|
@@ -192,15 +117,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
192
117
|
requirements:
|
193
118
|
- - ">="
|
194
119
|
- !ruby/object:Gem::Version
|
195
|
-
version:
|
120
|
+
version: 3.2.0
|
196
121
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
197
122
|
requirements:
|
198
|
-
- - "
|
123
|
+
- - ">"
|
199
124
|
- !ruby/object:Gem::Version
|
200
|
-
version:
|
125
|
+
version: 1.3.1
|
201
126
|
requirements: []
|
202
|
-
rubygems_version: 3.
|
203
|
-
signing_key:
|
127
|
+
rubygems_version: 3.4.20
|
128
|
+
signing_key:
|
204
129
|
specification_version: 4
|
205
130
|
summary: BigBlueButton integration for ruby
|
206
131
|
test_files: []
|
data/examples/config_xml.rb
DELETED
@@ -1,74 +0,0 @@
|
|
1
|
-
$:.unshift File.expand_path(File.dirname(__FILE__))
|
2
|
-
$:.unshift File.join(File.expand_path(File.dirname(__FILE__)), '..', 'lib')
|
3
|
-
|
4
|
-
require 'bigbluebutton_api'
|
5
|
-
require 'prepare'
|
6
|
-
|
7
|
-
begin
|
8
|
-
prepare
|
9
|
-
|
10
|
-
puts "---------------------------------------------------"
|
11
|
-
config_xml = @api.get_default_config_xml
|
12
|
-
config_xml = BigBlueButton::BigBlueButtonConfigXml.new(config_xml)
|
13
|
-
puts "The default config.xml was taken from the server"
|
14
|
-
|
15
|
-
puts "---------------------------------------------------"
|
16
|
-
layouts = @api.get_available_layouts
|
17
|
-
puts "The available layouts are"
|
18
|
-
puts layouts.inspect
|
19
|
-
puts "The default layouts are"
|
20
|
-
puts @api.get_default_layouts.inspect
|
21
|
-
|
22
|
-
puts "---------------------------------------------------"
|
23
|
-
num = rand(1000)
|
24
|
-
meeting_name = "Test Meeting #{num}"
|
25
|
-
meeting_id = "test-meeting-#{num}"
|
26
|
-
username = "House #{rand(1000)}"
|
27
|
-
username2 = "Cameron #{rand(1000)}"
|
28
|
-
options = { :moderatorPW => "54321",
|
29
|
-
:attendeePW => "12345",
|
30
|
-
:welcome => 'Welcome to my meeting',
|
31
|
-
:dialNumber => '1-800-000-0000x00000#',
|
32
|
-
:logoutURL => 'https://github.com/mconf/bigbluebutton-api-ruby',
|
33
|
-
:maxParticipants => 25 }
|
34
|
-
response = @api.create_meeting(meeting_name, meeting_id, options)
|
35
|
-
puts "A meeting has been created: #{meeting_id}"
|
36
|
-
|
37
|
-
puts "---------------------------------------------------"
|
38
|
-
url = @api.join_meeting_url(meeting_id, username, options[:moderatorPW])
|
39
|
-
puts "Please join the meeting as moderator using the link: #{url}"
|
40
|
-
puts "*** You will be using the DEFAULT config.xml ***"
|
41
|
-
puts "Waiting 30 seconds for you to join..."
|
42
|
-
puts
|
43
|
-
sleep(30)
|
44
|
-
|
45
|
-
puts "---------------------------------------------------"
|
46
|
-
puts "Creating a new config.xml"
|
47
|
-
# config_xml.set_attribute("layout", "showToolbar", "false", false)
|
48
|
-
config_xml.set_attribute("skinning", "enabled", "false", false)
|
49
|
-
config_xml.set_attribute("layout", "defaultLayout", "Webinar", false)
|
50
|
-
config_xml.set_attribute("layout", "showLayoutTools", "false", false)
|
51
|
-
config_xml.set_attribute("ChatModule", "privateEnabled", "false")
|
52
|
-
config_xml.set_attribute("VideoconfModule", "resolutions", "320x240")
|
53
|
-
config_xml.set_attribute("VideoconfModule", "presenterShareOnly", "true")
|
54
|
-
|
55
|
-
puts "---------------------------------------------------"
|
56
|
-
token = @api.set_config_xml(meeting_id, config_xml)
|
57
|
-
puts "Setting the new config.xml returned the token: #{token}"
|
58
|
-
|
59
|
-
puts "---------------------------------------------------"
|
60
|
-
url = @api.join_meeting_url(meeting_id, username2, options[:moderatorPW], { :configToken => token })
|
61
|
-
puts "Please join the meeting again using the link: #{url}"
|
62
|
-
puts "*** You will be using the MODIFIED config.xml, with the following modifications: ***"
|
63
|
-
puts "*** - Disabled layout (will show the default layout, as was used in BBB < 0.8)"
|
64
|
-
puts "*** - Default layout to Webinar"
|
65
|
-
puts "*** - Hidden layout tools"
|
66
|
-
puts "*** - Disabled private chat"
|
67
|
-
puts "*** - Restricted video resolutions to 320x240 only"
|
68
|
-
puts "*** - Disabled video sharing except for the presenter"
|
69
|
-
puts
|
70
|
-
|
71
|
-
rescue Exception => ex
|
72
|
-
puts "Failed with error #{ex.message}"
|
73
|
-
puts ex.backtrace
|
74
|
-
end
|
@@ -1,58 +0,0 @@
|
|
1
|
-
require "xmlsimple"
|
2
|
-
|
3
|
-
module BigBlueButton
|
4
|
-
|
5
|
-
# A helper class to work with layout definition files.
|
6
|
-
# You set an xml file on it (usually obtained from a property of in the XML obtained from
|
7
|
-
# BigBlueButtonApi#get_default_config_xml), use it to work with the layouts, and then get
|
8
|
-
# the new xml from this class.
|
9
|
-
#
|
10
|
-
# === Usage example:
|
11
|
-
#
|
12
|
-
# xml = api.get_default_config_xml
|
13
|
-
# config_xml = BigBlueButton::BigBlueButtonConfigXml.new(xml)
|
14
|
-
# url = config_xml.get_attribute("LayoutModule", "layoutConfig", true)
|
15
|
-
# # send a request to 'url' to fetch the xml file into 'response'
|
16
|
-
#
|
17
|
-
# layout_config = BigBlueButton::BigBlueButtonConfigLayout.new(response)
|
18
|
-
# layout_config.get_available_layouts
|
19
|
-
#
|
20
|
-
class BigBlueButtonConfigLayout
|
21
|
-
|
22
|
-
attr_accessor :xml
|
23
|
-
|
24
|
-
# xml (string):: The XML that has the definition of all layouts, usually fetched from
|
25
|
-
# the web conference server.
|
26
|
-
def initialize(xml)
|
27
|
-
@xml = nil
|
28
|
-
opts = { 'ForceArray' => false, 'KeepRoot' => true }
|
29
|
-
begin
|
30
|
-
@xml = XmlSimple.xml_in(xml, opts)
|
31
|
-
rescue Exception => e
|
32
|
-
exception = BigBlueButton::BigBlueButtonException.new("Error parsing the layouts XML. Error: #{e.message}")
|
33
|
-
exception.key = 'XMLParsingError'
|
34
|
-
raise exception
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
# Returns an array with the name of each layout available in the XML.
|
39
|
-
# Will return only unique names, ordered the way they are ordered in the XML.
|
40
|
-
# Returns nil if the XML is not properly formatted and an empty
|
41
|
-
# array if there are no layouts in the file.
|
42
|
-
def get_available_layouts
|
43
|
-
if xml_has_layouts
|
44
|
-
xml["layouts"]["layout"].map{ |l| l["name"] }.uniq
|
45
|
-
else
|
46
|
-
nil
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
protected
|
51
|
-
|
52
|
-
def xml_has_layouts
|
53
|
-
@xml and @xml["layouts"] and @xml["layouts"]["layout"]
|
54
|
-
end
|
55
|
-
|
56
|
-
end
|
57
|
-
|
58
|
-
end
|
@@ -1,125 +0,0 @@
|
|
1
|
-
require "xmlsimple"
|
2
|
-
|
3
|
-
module BigBlueButton
|
4
|
-
|
5
|
-
# A helper class to work with config.xml files.
|
6
|
-
# You set an xml file on it (usually obtained via BigBlueButtonApi#get_default_config_xml),
|
7
|
-
# use it to modify this xml, and then get the new xml from this class (usually to set in the
|
8
|
-
# server using BigBlueButtonApi#set_config_xml).
|
9
|
-
#
|
10
|
-
# === Usage example:
|
11
|
-
#
|
12
|
-
# xml = api.get_default_config_xml
|
13
|
-
# config_xml = BigBlueButton::BigBlueButtonConfigXml.new(xml)
|
14
|
-
#
|
15
|
-
# # change the xml a bit
|
16
|
-
# config_xml.set_attribute("skinning", "enabled", "false", false)
|
17
|
-
# config_xml.set_attribute("layout", "defaultLayout", "Webinar", false)
|
18
|
-
# config_xml.set_attribute("layout", "showLayoutTools", "false", false)
|
19
|
-
#
|
20
|
-
# # set the new xml in the server
|
21
|
-
# api.set_config_xml("meeting-id", config_xml)
|
22
|
-
#
|
23
|
-
class BigBlueButtonConfigXml
|
24
|
-
|
25
|
-
attr_accessor :xml
|
26
|
-
|
27
|
-
def initialize(xml)
|
28
|
-
@original_string = nil
|
29
|
-
@xml = nil
|
30
|
-
unless xml.nil?
|
31
|
-
opts = { 'ForceArray' => false, 'KeepRoot' => true }
|
32
|
-
begin
|
33
|
-
@xml = XmlSimple.xml_in(xml, opts)
|
34
|
-
@original_string = self.as_string.clone
|
35
|
-
rescue Exception => e
|
36
|
-
exception = BigBlueButton::BigBlueButtonException.new("Error parsing the config XML. Error: #{e.message}")
|
37
|
-
exception.key = 'XMLParsingError'
|
38
|
-
raise exception
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
def get_attribute(finder, attr_name, is_module=true)
|
44
|
-
if is_module
|
45
|
-
tag = find_module(finder)
|
46
|
-
else
|
47
|
-
tag = find_tag(finder)
|
48
|
-
end
|
49
|
-
if tag
|
50
|
-
find_attribute(tag, attr_name)
|
51
|
-
else
|
52
|
-
nil
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
def set_attribute(finder, attr_name, value, is_module=true)
|
57
|
-
if is_module
|
58
|
-
tag = find_module(finder)
|
59
|
-
else
|
60
|
-
tag = find_tag(finder)
|
61
|
-
end
|
62
|
-
if tag
|
63
|
-
attr = find_attribute(tag, attr_name)
|
64
|
-
if attr
|
65
|
-
# saves always as string
|
66
|
-
tag[attr_name] = value.is_a?(String) ? value : value.to_s
|
67
|
-
else
|
68
|
-
nil
|
69
|
-
end
|
70
|
-
else
|
71
|
-
nil
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
def as_string
|
76
|
-
XmlSimple.xml_out(@xml, { 'RootName' => nil, 'XmlDeclaration' => false, 'NoIndent' => true })
|
77
|
-
end
|
78
|
-
|
79
|
-
def is_modified?
|
80
|
-
@xml and
|
81
|
-
self.as_string != @original_string
|
82
|
-
end
|
83
|
-
|
84
|
-
protected
|
85
|
-
|
86
|
-
def find_module(module_name)
|
87
|
-
if xml_has_modules
|
88
|
-
modules = @xml["config"]["modules"]["module"]
|
89
|
-
modules = [modules] unless modules.is_a?(Array)
|
90
|
-
modules.each do |mod|
|
91
|
-
if mod["name"] == module_name
|
92
|
-
return mod
|
93
|
-
end
|
94
|
-
end
|
95
|
-
end
|
96
|
-
nil
|
97
|
-
end
|
98
|
-
|
99
|
-
def find_tag(name)
|
100
|
-
if xml_has_config
|
101
|
-
@xml["config"][name]
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
def find_attribute(mod, attr_name)
|
106
|
-
if mod and mod[attr_name]
|
107
|
-
return mod[attr_name]
|
108
|
-
else
|
109
|
-
return nil
|
110
|
-
end
|
111
|
-
end
|
112
|
-
|
113
|
-
def xml_has_modules
|
114
|
-
xml_has_config and
|
115
|
-
@xml["config"]["modules"] and
|
116
|
-
@xml["config"]["modules"]["module"]
|
117
|
-
end
|
118
|
-
|
119
|
-
def xml_has_config
|
120
|
-
@xml and @xml["config"]
|
121
|
-
end
|
122
|
-
|
123
|
-
end
|
124
|
-
|
125
|
-
end
|