bigbluebutton-api-ruby 0.0.11 → 0.1.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +5 -2
- data/.rvmrc +1 -1
- data/.travis.yml +6 -0
- data/CHANGELOG.rdoc +19 -8
- data/Gemfile +9 -1
- data/Gemfile.lock +62 -9
- data/LICENSE +5 -7
- data/LICENSE_003 +20 -0
- data/README.rdoc +42 -19
- data/Rakefile +31 -19
- data/bigbluebutton-api-ruby.gemspec +5 -5
- data/examples/get_version_example.rb +18 -0
- data/examples/join_example.rb +59 -0
- data/examples/overall_0.7_example.rb +92 -0
- data/examples/prepare.rb +38 -0
- data/extras/bigbluebutton_bot.rb +64 -0
- data/extras/download_bot_from.txt +1 -0
- data/extras/test-presentation.pdf +0 -0
- data/features/check_status.feature +45 -0
- data/features/config.yml.example +21 -0
- data/features/create_meetings.feature +29 -0
- data/features/end_meetings.feature +27 -0
- data/features/join_meetings.feature +29 -0
- data/features/pre_upload_slides.feature +14 -0
- data/features/recordings.feature +34 -0
- data/features/step_definitions/check_status_steps.rb +119 -0
- data/features/step_definitions/common_steps.rb +122 -0
- data/features/step_definitions/create_meetings_steps.rb +54 -0
- data/features/step_definitions/end_meetings_steps.rb +49 -0
- data/features/step_definitions/join_meetings_steps.rb +39 -0
- data/features/step_definitions/pre_upload_slides_steps.rb +13 -0
- data/features/step_definitions/recordings_steps.rb +38 -0
- data/features/support/api_tests/configs.rb +51 -0
- data/features/support/env.rb +7 -0
- data/features/support/hooks.rb +11 -0
- data/lib/bigbluebutton_api.rb +301 -97
- data/lib/bigbluebutton_formatter.rb +105 -19
- data/lib/bigbluebutton_modules.rb +92 -0
- data/lib/hash_to_xml.rb +22 -51
- data/spec/bigbluebutton_api_0.8_spec.rb +273 -0
- data/spec/bigbluebutton_api_spec.rb +211 -117
- data/spec/bigbluebutton_formatter_spec.rb +178 -29
- data/spec/bigbluebutton_modules_spec.rb +95 -0
- data/spec/data/hash_to_xml_complex.xml +45 -0
- data/spec/hash_to_xml_spec.rb +143 -0
- data/spec/spec_helper.rb +4 -2
- data/spec/support/forgery/forgeries/random_name.rb +7 -0
- data/spec/support/forgery/forgeries/url.rb +5 -0
- metadata +47 -12
- data/test/config.yml.example +0 -9
- data/test/test.rb +0 -154
@@ -0,0 +1,95 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'tempfile'
|
3
|
+
|
4
|
+
describe BigBlueButton::BigBlueButtonModules do
|
5
|
+
let(:modules) { BigBlueButton::BigBlueButtonModules.new }
|
6
|
+
|
7
|
+
describe "#presentation_urls" do
|
8
|
+
subject { modules }
|
9
|
+
it { should respond_to(:presentation_urls) }
|
10
|
+
it { should respond_to("presentation_urls=") }
|
11
|
+
end
|
12
|
+
|
13
|
+
describe "#presentation_files" do
|
14
|
+
subject { modules }
|
15
|
+
it { should respond_to(:presentation_files) }
|
16
|
+
it { should respond_to("presentation_files=") }
|
17
|
+
end
|
18
|
+
|
19
|
+
describe "#presentation_base64s" do
|
20
|
+
subject { modules }
|
21
|
+
it { should respond_to(:presentation_base64s) }
|
22
|
+
it { should respond_to("presentation_base64s=") }
|
23
|
+
end
|
24
|
+
|
25
|
+
describe "#add_presentation" do
|
26
|
+
context "when type = :url" do
|
27
|
+
before {
|
28
|
+
modules.add_presentation(:url, "http://anything")
|
29
|
+
modules.add_presentation(:url, "http://anything2")
|
30
|
+
}
|
31
|
+
it { modules.presentation_urls.size.should == 2 }
|
32
|
+
it { modules.presentation_urls.first.should == "http://anything" }
|
33
|
+
it { modules.presentation_urls.last.should == "http://anything2" }
|
34
|
+
end
|
35
|
+
|
36
|
+
context "when type = :file" do
|
37
|
+
before {
|
38
|
+
modules.add_presentation(:file, "myfile.ppt")
|
39
|
+
modules.add_presentation(:file, "myfile2.ppt")
|
40
|
+
}
|
41
|
+
it { modules.presentation_files.size.should == 2 }
|
42
|
+
it { modules.presentation_files.first.should == "myfile.ppt" }
|
43
|
+
it { modules.presentation_files.last.should == "myfile2.ppt" }
|
44
|
+
end
|
45
|
+
|
46
|
+
context "when type = :base64" do
|
47
|
+
before {
|
48
|
+
modules.add_presentation(:base64, "1234567890", "file1.pdf")
|
49
|
+
modules.add_presentation(:base64, "0987654321", "file2.pdf")
|
50
|
+
}
|
51
|
+
it { modules.presentation_base64s.size.should == 2 }
|
52
|
+
it { modules.presentation_base64s.first.should == ["file1.pdf", "1234567890"] }
|
53
|
+
it { modules.presentation_base64s.last.should == ["file2.pdf", "0987654321"] }
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
describe "#to_xml" do
|
58
|
+
context "when nothing was added" do
|
59
|
+
it { modules.to_xml.should == "" }
|
60
|
+
end
|
61
|
+
|
62
|
+
context "with presentations" do
|
63
|
+
let(:file) {
|
64
|
+
f = Tempfile.new(['file1', '.pdf'])
|
65
|
+
f.write("First\nSecond")
|
66
|
+
f.close
|
67
|
+
f
|
68
|
+
}
|
69
|
+
let(:file_encoded) {
|
70
|
+
File.open(file.path, "r") do |f|
|
71
|
+
Base64.encode64(f.read)
|
72
|
+
end
|
73
|
+
}
|
74
|
+
let(:xml) {
|
75
|
+
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
|
76
|
+
"<modules>" +
|
77
|
+
"<module name=\"presentation\">" +
|
78
|
+
"<document url=\"http://anything\" />" +
|
79
|
+
"<document url=\"http://anything2\" />" +
|
80
|
+
"<document name=\"file1.pdf\">1234567890</document>" +
|
81
|
+
"<document name=\"#{File.basename(file.path)}\">#{file_encoded}</document>" +
|
82
|
+
"</module>" +
|
83
|
+
"</modules>"
|
84
|
+
}
|
85
|
+
before {
|
86
|
+
modules.add_presentation(:url, "http://anything")
|
87
|
+
modules.add_presentation(:url, "http://anything2")
|
88
|
+
modules.add_presentation(:base64, "1234567890", "file1.pdf")
|
89
|
+
modules.add_presentation(:file, file.path)
|
90
|
+
}
|
91
|
+
it { modules.to_xml.should == xml }
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
<response>
|
2
|
+
<returncode>SUCCESS</returncode>
|
3
|
+
<recordings>
|
4
|
+
<recording>
|
5
|
+
<recordID>7f5745a08b24fa27551e7a065849dda3ce65dd32-1321618219268</recordID>
|
6
|
+
<meetingID>bd1811beecd20f24314819a52ec202bf446ab94b</meetingID>
|
7
|
+
<name><![CDATA[Evening Class1]]></name>
|
8
|
+
<published>true</published>
|
9
|
+
<startTime>Fri Nov 18 12:10:23 UTC 2011</startTime>
|
10
|
+
<endTime>Fri Nov 18 12:12:25 UTC 2011</endTime>
|
11
|
+
<metadata>
|
12
|
+
<course><![CDATA[Fundamentals Of JAVA]]></course>
|
13
|
+
<description><![CDATA[List of recordings]]></description>
|
14
|
+
<activity><![CDATA[Evening Class1]]></activity>
|
15
|
+
</metadata>
|
16
|
+
<playback>
|
17
|
+
<format>
|
18
|
+
<type>slides</type>
|
19
|
+
<url>http://test-install.blindsidenetworks.com/playback/slides/playback.html?meetingId=7f5745</url>
|
20
|
+
<length>3</length>
|
21
|
+
</format>
|
22
|
+
</playback>
|
23
|
+
</recording>
|
24
|
+
<recording>
|
25
|
+
<recordID>6c1d35b82e2552bb254d239540e4f994c4a77367-1316717270941</recordID>
|
26
|
+
<meetingID>585a44eb32b526b100e12b7b755d971fbbd19ab0</meetingID>
|
27
|
+
<name><![CDATA[Test de fonctionnalité]]></name>
|
28
|
+
<published>false</published>
|
29
|
+
<startTime>2011-09-22 18:47:55 UTC</startTime>
|
30
|
+
<endTime>2011-09-22 19:08:35 UTC</endTime>
|
31
|
+
<metadata>
|
32
|
+
<course><![CDATA[Ressources technologiques]]></course>
|
33
|
+
<activity><![CDATA[Test de fonctionnalité]]></activity>
|
34
|
+
<recording><![CDATA[true]]></recording>
|
35
|
+
</metadata>
|
36
|
+
<playback>
|
37
|
+
<format>
|
38
|
+
<type>slides</type>
|
39
|
+
<url>http://test-install.blindsidenetworks.com/playback/slides/playback.html?meetingId=6c1d35</url>
|
40
|
+
<length>0</length>
|
41
|
+
</format>
|
42
|
+
</playback>
|
43
|
+
</recording>
|
44
|
+
</recordings>
|
45
|
+
</response>
|
@@ -0,0 +1,143 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Hash do
|
4
|
+
|
5
|
+
describe ".from_xml" do
|
6
|
+
it "simple example" do
|
7
|
+
xml = "<response><returncode>1</returncode></response>"
|
8
|
+
hash = { :returncode => "1" }
|
9
|
+
Hash.from_xml(xml).should == hash
|
10
|
+
end
|
11
|
+
|
12
|
+
it "maintains all values as strings" do
|
13
|
+
xml = "<parent>" \
|
14
|
+
" <node1>1</node1>" \
|
15
|
+
" <node2>string</node2>" \
|
16
|
+
" <node3>true</node3>" \
|
17
|
+
"</parent>"
|
18
|
+
hash = { :node1 => "1", :node2 => "string", :node3 => "true" }
|
19
|
+
Hash.from_xml(xml).should == hash
|
20
|
+
end
|
21
|
+
|
22
|
+
it "works for xmls with multiple levels" do
|
23
|
+
xml = "<parent>" \
|
24
|
+
" <node1>" \
|
25
|
+
" <node2>" \
|
26
|
+
" <node3>true</node3>" \
|
27
|
+
" </node2>" \
|
28
|
+
" </node1>" \
|
29
|
+
"</parent>"
|
30
|
+
hash = { :node1 => { :node2 => { :node3 => "true" } } }
|
31
|
+
Hash.from_xml(xml).should == hash
|
32
|
+
end
|
33
|
+
|
34
|
+
it "transforms CDATA fields to string" do
|
35
|
+
xml = "<parent>" \
|
36
|
+
" <name><![CDATA[Evening Class]]></name>" \
|
37
|
+
" <course><![CDATA[Advanced Ruby]]></course>" \
|
38
|
+
"</parent>"
|
39
|
+
hash = { :name => "Evening Class", :course => "Advanced Ruby" }
|
40
|
+
Hash.from_xml(xml).should == hash
|
41
|
+
end
|
42
|
+
|
43
|
+
it "transforms duplicated keys in arrays" do
|
44
|
+
xml = "<parent>" \
|
45
|
+
" <meetings>" \
|
46
|
+
" <meeting>1</meeting>" \
|
47
|
+
" <meeting>2</meeting>" \
|
48
|
+
" <meeting><details>3</details></meeting>" \
|
49
|
+
" <other>4</other>" \
|
50
|
+
" </meetings>" \
|
51
|
+
"</parent>"
|
52
|
+
hash = { :meetings => { :meeting => [ "1", "2", { :details => "3" } ],
|
53
|
+
:other => "4" } }
|
54
|
+
Hash.from_xml(xml).should == hash
|
55
|
+
end
|
56
|
+
|
57
|
+
it "works with attributes" do
|
58
|
+
xml = "<parent>" \
|
59
|
+
" <meeting attr1=\"v1\">1</meeting>" \
|
60
|
+
"</parent>"
|
61
|
+
hash = { :meeting => { :attr1 => "v1", :content => "1" } }
|
62
|
+
Hash.from_xml(xml).should == hash
|
63
|
+
end
|
64
|
+
|
65
|
+
it "complex real example" do
|
66
|
+
xml = File.open("spec/data/hash_to_xml_complex.xml")
|
67
|
+
|
68
|
+
hash = { :returncode => "SUCCESS",
|
69
|
+
:recordings =>
|
70
|
+
{ :recording => [
|
71
|
+
{ :recordID => "7f5745a08b24fa27551e7a065849dda3ce65dd32-1321618219268",
|
72
|
+
:meetingID => "bd1811beecd20f24314819a52ec202bf446ab94b",
|
73
|
+
:name => "Evening Class1",
|
74
|
+
:published => "true",
|
75
|
+
:startTime => "Fri Nov 18 12:10:23 UTC 2011",
|
76
|
+
:endTime => "Fri Nov 18 12:12:25 UTC 2011",
|
77
|
+
:metadata =>
|
78
|
+
{ :course => "Fundamentals Of JAVA",
|
79
|
+
:description => "List of recordings",
|
80
|
+
:activity => "Evening Class1" },
|
81
|
+
:playback =>
|
82
|
+
{ :format =>
|
83
|
+
{ :type => "slides",
|
84
|
+
:url => "http://test-install.blindsidenetworks.com/playback/slides/playback.html?meetingId=7f5745",
|
85
|
+
:length => "3" }
|
86
|
+
}
|
87
|
+
},
|
88
|
+
{ :recordID => "6c1d35b82e2552bb254d239540e4f994c4a77367-1316717270941",
|
89
|
+
:meetingID => "585a44eb32b526b100e12b7b755d971fbbd19ab0",
|
90
|
+
:name => "Test de fonctionnalité",
|
91
|
+
:published => "false",
|
92
|
+
:startTime => "2011-09-22 18:47:55 UTC",
|
93
|
+
:endTime => "2011-09-22 19:08:35 UTC",
|
94
|
+
:metadata =>
|
95
|
+
{ :course => "Ressources technologiques",
|
96
|
+
:activity => "Test de fonctionnalité",
|
97
|
+
:recording => "true" },
|
98
|
+
:playback =>
|
99
|
+
{ :format =>
|
100
|
+
{ :type => "slides",
|
101
|
+
:url => "http://test-install.blindsidenetworks.com/playback/slides/playback.html?meetingId=6c1d35",
|
102
|
+
:length => "0" }
|
103
|
+
}
|
104
|
+
} ]
|
105
|
+
}
|
106
|
+
}
|
107
|
+
Hash.from_xml(xml).should == hash
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
describe ".symbolize_keys" do
|
112
|
+
it "converts string-keys to symbols" do
|
113
|
+
before = { "one" => 1, "two" => 2, "three" => 3 }
|
114
|
+
after = { :one => 1, :two => 2, :three => 3 }
|
115
|
+
Hash.symbolize_keys(before).should == after
|
116
|
+
end
|
117
|
+
|
118
|
+
it "maintains case" do
|
119
|
+
before = { "One" => 1, "tWo" => 2, "thrEE" => 3 }
|
120
|
+
after = { :One => 1, :tWo => 2, :thrEE => 3 }
|
121
|
+
Hash.symbolize_keys(before).should == after
|
122
|
+
end
|
123
|
+
|
124
|
+
it "works with multilevel hashes" do
|
125
|
+
before = { "l1" => { "l2" => { "l3" => 1 } }, "l1b" => 2 }
|
126
|
+
after = { :l1 => { :l2 => { :l3 => 1 } }, :l1b => 2 }
|
127
|
+
Hash.symbolize_keys(before).should == after
|
128
|
+
end
|
129
|
+
|
130
|
+
it "works with arrays" do
|
131
|
+
before = { "a1" => [ "b1" => 1, "b2" => 2 ], "b2" => 2 }
|
132
|
+
after = { :a1 => [ :b1 => 1, :b2 => 2 ], :b2 => 2 }
|
133
|
+
Hash.symbolize_keys(before).should == after
|
134
|
+
end
|
135
|
+
|
136
|
+
it "doesn't convert values" do
|
137
|
+
before = { "a" => "a", "b" => "b" }
|
138
|
+
after = { :a => "a", :b => "b" }
|
139
|
+
Hash.symbolize_keys(before).should == after
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,10 +1,12 @@
|
|
1
|
+
require 'forgery'
|
2
|
+
|
1
3
|
# Load support files
|
2
4
|
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
3
5
|
|
4
6
|
# Load Factories
|
5
7
|
#require 'factory_girl'
|
6
|
-
#require
|
7
|
-
|
8
|
+
# Dir["#{ File.dirname(__FILE__)}/factories/*.rb"].each { |f| require f }
|
9
|
+
|
8
10
|
|
9
11
|
RSpec.configure do |config|
|
10
12
|
config.mock_with :rspec
|
metadata
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bigbluebutton-api-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.1.0.rc1
|
5
|
+
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Leonardo Crauss Daronco
|
@@ -10,19 +10,19 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2011-
|
13
|
+
date: 2011-11-23 00:00:00.000000000Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
|
-
name:
|
17
|
-
requirement: &
|
16
|
+
name: xml-simple
|
17
|
+
requirement: &84100630 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
|
-
- -
|
20
|
+
- - ! '>='
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 1.
|
22
|
+
version: 1.1.1
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *84100630
|
26
26
|
description: Provides an interface to the BigBlueButton web meeting API (https://github.com/mconf/bigbluebutton-api-ruby)
|
27
27
|
email:
|
28
28
|
- leonardodaronco@gmail.com
|
@@ -32,28 +32,60 @@ extensions: []
|
|
32
32
|
extra_rdoc_files:
|
33
33
|
- README.rdoc
|
34
34
|
- LICENSE
|
35
|
+
- LICENSE_003
|
35
36
|
- CHANGELOG.rdoc
|
36
37
|
files:
|
37
38
|
- .gitignore
|
38
39
|
- .rspec
|
39
40
|
- .rvmrc
|
41
|
+
- .travis.yml
|
40
42
|
- CHANGELOG.rdoc
|
41
43
|
- Gemfile
|
42
44
|
- Gemfile.lock
|
43
45
|
- LICENSE
|
46
|
+
- LICENSE_003
|
44
47
|
- README.rdoc
|
45
48
|
- Rakefile
|
46
49
|
- bigbluebutton-api-ruby.gemspec
|
50
|
+
- examples/get_version_example.rb
|
51
|
+
- examples/join_example.rb
|
52
|
+
- examples/overall_0.7_example.rb
|
53
|
+
- examples/prepare.rb
|
54
|
+
- extras/bigbluebutton_bot.rb
|
55
|
+
- extras/download_bot_from.txt
|
56
|
+
- extras/test-presentation.pdf
|
57
|
+
- features/check_status.feature
|
58
|
+
- features/config.yml.example
|
59
|
+
- features/create_meetings.feature
|
60
|
+
- features/end_meetings.feature
|
61
|
+
- features/join_meetings.feature
|
62
|
+
- features/pre_upload_slides.feature
|
63
|
+
- features/recordings.feature
|
64
|
+
- features/step_definitions/check_status_steps.rb
|
65
|
+
- features/step_definitions/common_steps.rb
|
66
|
+
- features/step_definitions/create_meetings_steps.rb
|
67
|
+
- features/step_definitions/end_meetings_steps.rb
|
68
|
+
- features/step_definitions/join_meetings_steps.rb
|
69
|
+
- features/step_definitions/pre_upload_slides_steps.rb
|
70
|
+
- features/step_definitions/recordings_steps.rb
|
71
|
+
- features/support/api_tests/configs.rb
|
72
|
+
- features/support/env.rb
|
73
|
+
- features/support/hooks.rb
|
47
74
|
- lib/bigbluebutton_api.rb
|
48
75
|
- lib/bigbluebutton_exception.rb
|
49
76
|
- lib/bigbluebutton_formatter.rb
|
77
|
+
- lib/bigbluebutton_modules.rb
|
50
78
|
- lib/hash_to_xml.rb
|
79
|
+
- spec/bigbluebutton_api_0.8_spec.rb
|
51
80
|
- spec/bigbluebutton_api_spec.rb
|
52
81
|
- spec/bigbluebutton_exception_spec.rb
|
53
82
|
- spec/bigbluebutton_formatter_spec.rb
|
83
|
+
- spec/bigbluebutton_modules_spec.rb
|
84
|
+
- spec/data/hash_to_xml_complex.xml
|
85
|
+
- spec/hash_to_xml_spec.rb
|
54
86
|
- spec/spec_helper.rb
|
55
|
-
-
|
56
|
-
-
|
87
|
+
- spec/support/forgery/forgeries/random_name.rb
|
88
|
+
- spec/support/forgery/forgeries/url.rb
|
57
89
|
homepage: https://github.com/mconf/bigbluebutton-api-ruby/
|
58
90
|
licenses: []
|
59
91
|
post_install_message:
|
@@ -66,12 +98,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
66
98
|
- - ! '>='
|
67
99
|
- !ruby/object:Gem::Version
|
68
100
|
version: '0'
|
101
|
+
segments:
|
102
|
+
- 0
|
103
|
+
hash: 999658801
|
69
104
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
70
105
|
none: false
|
71
106
|
requirements:
|
72
|
-
- - ! '
|
107
|
+
- - ! '>'
|
73
108
|
- !ruby/object:Gem::Version
|
74
|
-
version:
|
109
|
+
version: 1.3.1
|
75
110
|
requirements: []
|
76
111
|
rubyforge_project:
|
77
112
|
rubygems_version: 1.8.10
|
data/test/config.yml.example
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
bbb_salt: 'insert-a-valid-salt-here'
|
2
|
-
bbb_url: 'http://devbuild.bigbluebutton.org/bigbluebutton/api'
|
3
|
-
bbb_version: '0.7'
|
4
|
-
meeting_id: 'bigbluebutton-api-ruby-test'
|
5
|
-
meeting_name: 'Test Meeting For Ruby Gem'
|
6
|
-
moderator_name: 'House'
|
7
|
-
moderator_password: '4321'
|
8
|
-
attendee_name: 'Cameron'
|
9
|
-
attendee_password: '1234'
|
data/test/test.rb
DELETED
@@ -1,154 +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 'thread'
|
6
|
-
require 'yaml'
|
7
|
-
|
8
|
-
def prepare
|
9
|
-
|
10
|
-
config_file = File.join(File.dirname(__FILE__), 'config.yml')
|
11
|
-
unless File.exist? config_file
|
12
|
-
puts config_file + " does not exists. Copy the example and configure your server."
|
13
|
-
puts "cp test/config.yml.example test/config.yml"
|
14
|
-
puts
|
15
|
-
Kernel.exit!
|
16
|
-
end
|
17
|
-
@config = YAML.load_file(config_file)
|
18
|
-
|
19
|
-
puts "config:"
|
20
|
-
@config.each do |k,v|
|
21
|
-
puts k + ": " + v
|
22
|
-
end
|
23
|
-
|
24
|
-
@api = BigBlueButton::BigBlueButtonApi.new(@config['bbb_url'], @config['bbb_salt'], @config['bbb_version'].to_s, true)
|
25
|
-
|
26
|
-
end
|
27
|
-
|
28
|
-
def general_test
|
29
|
-
|
30
|
-
puts
|
31
|
-
puts "---------------------------------------------------"
|
32
|
-
if @api.test_connection
|
33
|
-
puts "Connection successful! continuing..."
|
34
|
-
else
|
35
|
-
puts "Connection failed! The server might be unreachable. Exiting..."
|
36
|
-
Kernel.exit!
|
37
|
-
end
|
38
|
-
|
39
|
-
puts
|
40
|
-
puts "---------------------------------------------------"
|
41
|
-
version = @api.get_api_version
|
42
|
-
puts "The API version of your server is #{version}"
|
43
|
-
|
44
|
-
puts
|
45
|
-
puts "---------------------------------------------------"
|
46
|
-
response = @api.get_meetings
|
47
|
-
puts "Existent meetings in your server:"
|
48
|
-
response[:meetings].each do |m|
|
49
|
-
puts " " + m[:meetingID] + ": " + m.inspect
|
50
|
-
end
|
51
|
-
|
52
|
-
puts
|
53
|
-
puts "---------------------------------------------------"
|
54
|
-
@api.create_meeting(@config['meeting_name'], @config['meeting_id'], @config['moderator_password'], @config['attendee_password'],
|
55
|
-
'Welcome to my meeting', '1-800-000-0000x00000#', 'https://github.com/mconf/bigbluebutton-api-ruby', 10)
|
56
|
-
puts "The meeting has been created. Please open a web browser and enter the meeting using either of the URLs below."
|
57
|
-
|
58
|
-
puts
|
59
|
-
puts "---------------------------------------------------"
|
60
|
-
url = @api.join_meeting_url(@config['meeting_id'], @config['moderator_name'], @config['moderator_password'])
|
61
|
-
puts "1) Moderator URL = #{url}"
|
62
|
-
puts ""
|
63
|
-
url = @api.join_meeting_url(@config['meeting_id'], @config['attendee_name'], @config['attendee_password'])
|
64
|
-
puts "2) Attendee URL = #{url}"
|
65
|
-
|
66
|
-
puts
|
67
|
-
puts "---------------------------------------------------"
|
68
|
-
puts "Waiting 30 seconds for you to enter via browser"
|
69
|
-
sleep(30)
|
70
|
-
|
71
|
-
unless @api.is_meeting_running?(@config['meeting_id'])
|
72
|
-
puts "You have NOT entered the meeting"
|
73
|
-
Kernel.exit!
|
74
|
-
end
|
75
|
-
puts "You have successfully entered the meeting"
|
76
|
-
|
77
|
-
puts
|
78
|
-
puts "---------------------------------------------------"
|
79
|
-
response = @api.get_meeting_info(@config['meeting_id'], @config['moderator_password'])
|
80
|
-
puts "Meeting info:"
|
81
|
-
puts response.inspect
|
82
|
-
|
83
|
-
puts
|
84
|
-
puts "---------------------------------------------------"
|
85
|
-
puts "Attendees:"
|
86
|
-
response[:attendees].each do |m|
|
87
|
-
puts " " + m[:fullName] + " (" + m[:userID] + "): " + m.inspect
|
88
|
-
end
|
89
|
-
|
90
|
-
|
91
|
-
puts
|
92
|
-
puts "---------------------------------------------------"
|
93
|
-
@api.end_meeting(@config['meeting_id'], @config['moderator_password'])
|
94
|
-
puts "The meeting has been ended"
|
95
|
-
|
96
|
-
rescue Exception => ex
|
97
|
-
puts "Failed with error #{ex.message}"
|
98
|
-
puts ex.backtrace
|
99
|
-
|
100
|
-
end
|
101
|
-
|
102
|
-
def join_test
|
103
|
-
unless @api.is_meeting_running?(@config['meeting_id'])
|
104
|
-
@api.create_meeting(@config['meeting_name'], @config['meeting_id'], @config['moderator_password'], @config['attendee_password'],
|
105
|
-
'Welcome to my meeting', '1-800-000-0000x00000#', 'https://github.com/mconf/bigbluebutton-api-ruby', 10)
|
106
|
-
puts "The meeting has been created. Please open a web browser and enter the meeting as moderator."
|
107
|
-
|
108
|
-
puts
|
109
|
-
puts "---------------------------------------------------"
|
110
|
-
url = @api.join_meeting_url(@config['meeting_id'], @config['moderator_name'], @config['moderator_password'])
|
111
|
-
puts "1) Moderator URL = #{url}"
|
112
|
-
|
113
|
-
puts
|
114
|
-
puts "---------------------------------------------------"
|
115
|
-
puts "Waiting 30 seconds for you to enter via browser"
|
116
|
-
sleep(30)
|
117
|
-
end
|
118
|
-
|
119
|
-
unless @api.is_meeting_running?(@config['meeting_id'])
|
120
|
-
puts "You have NOT entered the meeting"
|
121
|
-
Kernel.exit!
|
122
|
-
end
|
123
|
-
puts "You have successfully entered the meeting"
|
124
|
-
|
125
|
-
puts
|
126
|
-
puts "---------------------------------------------------"
|
127
|
-
response = @api.get_meeting_info(@config['meeting_id'], @config['moderator_password'])
|
128
|
-
puts "Meeting info:"
|
129
|
-
puts response.inspect
|
130
|
-
|
131
|
-
puts
|
132
|
-
puts
|
133
|
-
puts
|
134
|
-
puts "---------------------------------------------------"
|
135
|
-
response = @api.join_meeting(@config['meeting_id'], @config['attendee_name'], @config['attendee_password'])
|
136
|
-
puts "Join meeting response:"
|
137
|
-
puts response.inspect
|
138
|
-
|
139
|
-
end
|
140
|
-
|
141
|
-
def get_version_test
|
142
|
-
@api = BigBlueButton::BigBlueButtonApi.new(@config['bbb_url'], @config['bbb_salt'], nil, true)
|
143
|
-
|
144
|
-
puts
|
145
|
-
puts "---------------------------------------------------"
|
146
|
-
puts "The version of your BBB server is: #{@api.version}"
|
147
|
-
end
|
148
|
-
|
149
|
-
begin
|
150
|
-
prepare
|
151
|
-
general_test
|
152
|
-
#join_test
|
153
|
-
#get_version_test
|
154
|
-
end
|