bigbluebutton-api-ruby 1.2.0 → 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/.gitignore +1 -0
- data/.ruby-version +1 -0
- data/CHANGELOG.rdoc +8 -0
- data/Gemfile.lock +3 -3
- data/README.rdoc +20 -16
- data/Rakefile +5 -4
- data/bigbluebutton-api-ruby.gemspec +1 -1
- data/examples/config_xml.rb +74 -0
- data/examples/create.rb +29 -0
- data/examples/join_example.rb +0 -8
- data/examples/{overall_0.7_example.rb → overall_example.rb} +0 -0
- data/features/config.yml.example +6 -5
- data/features/create_meetings.feature +1 -10
- data/features/end_meetings.feature +3 -21
- data/features/pre_upload_slides.feature +1 -1
- data/features/recordings.feature +1 -1
- data/features/support/features_helpers.rb +1 -1
- data/lib/bigbluebutton_api.rb +342 -176
- data/lib/bigbluebutton_config_layout.rb +56 -0
- data/lib/bigbluebutton_config_xml.rb +122 -0
- data/lib/bigbluebutton_formatter.rb +12 -6
- data/lib/bigbluebutton_hash_to_xml.rb +35 -0
- data/lib/bigbluebutton_modules.rb +1 -2
- data/spec/bigbluebutton_api_0.81_spec.rb +154 -0
- data/spec/bigbluebutton_api_spec.rb +327 -75
- data/spec/bigbluebutton_config_layout_spec.rb +86 -0
- data/spec/bigbluebutton_config_xml_spec.rb +276 -0
- data/spec/bigbluebutton_formatter_spec.rb +28 -6
- data/spec/{hash_to_xml_spec.rb → bigbluebutton_hash_to_xml_spec.rb} +13 -13
- metadata +16 -10
- data/.rvmrc +0 -6
- data/lib/hash_to_xml.rb +0 -33
- data/spec/bigbluebutton_api_0.8_spec.rb +0 -273
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bigbluebutton-api-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
prerelease:
|
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-05-11 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: xml-simple
|
@@ -42,7 +42,7 @@ extra_rdoc_files:
|
|
42
42
|
files:
|
43
43
|
- .gitignore
|
44
44
|
- .rspec
|
45
|
-
- .
|
45
|
+
- .ruby-version
|
46
46
|
- .travis.yml
|
47
47
|
- CHANGELOG.rdoc
|
48
48
|
- Gemfile
|
@@ -52,9 +52,11 @@ files:
|
|
52
52
|
- README.rdoc
|
53
53
|
- Rakefile
|
54
54
|
- bigbluebutton-api-ruby.gemspec
|
55
|
+
- examples/config_xml.rb
|
56
|
+
- examples/create.rb
|
55
57
|
- examples/get_version_example.rb
|
56
58
|
- examples/join_example.rb
|
57
|
-
- examples/
|
59
|
+
- examples/overall_example.rb
|
58
60
|
- examples/prepare.rb
|
59
61
|
- extras/test-presentation.pdf
|
60
62
|
- features/check_status.feature
|
@@ -75,17 +77,21 @@ files:
|
|
75
77
|
- features/support/features_helpers.rb
|
76
78
|
- features/support/hooks.rb
|
77
79
|
- lib/bigbluebutton_api.rb
|
80
|
+
- lib/bigbluebutton_config_layout.rb
|
81
|
+
- lib/bigbluebutton_config_xml.rb
|
78
82
|
- lib/bigbluebutton_exception.rb
|
79
83
|
- lib/bigbluebutton_formatter.rb
|
84
|
+
- lib/bigbluebutton_hash_to_xml.rb
|
80
85
|
- lib/bigbluebutton_modules.rb
|
81
|
-
-
|
82
|
-
- spec/bigbluebutton_api_0.8_spec.rb
|
86
|
+
- spec/bigbluebutton_api_0.81_spec.rb
|
83
87
|
- spec/bigbluebutton_api_spec.rb
|
88
|
+
- spec/bigbluebutton_config_layout_spec.rb
|
89
|
+
- spec/bigbluebutton_config_xml_spec.rb
|
84
90
|
- spec/bigbluebutton_exception_spec.rb
|
85
91
|
- spec/bigbluebutton_formatter_spec.rb
|
92
|
+
- spec/bigbluebutton_hash_to_xml_spec.rb
|
86
93
|
- spec/bigbluebutton_modules_spec.rb
|
87
94
|
- spec/data/hash_to_xml_complex.xml
|
88
|
-
- spec/hash_to_xml_spec.rb
|
89
95
|
- spec/spec_helper.rb
|
90
96
|
- spec/support/forgery/forgeries/random_name.rb
|
91
97
|
- spec/support/forgery/forgeries/url.rb
|
@@ -103,7 +109,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
103
109
|
version: '0'
|
104
110
|
segments:
|
105
111
|
- 0
|
106
|
-
hash:
|
112
|
+
hash: -1402282552445394412
|
107
113
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
108
114
|
none: false
|
109
115
|
requirements:
|
@@ -112,10 +118,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
112
118
|
version: '0'
|
113
119
|
segments:
|
114
120
|
- 0
|
115
|
-
hash:
|
121
|
+
hash: -1402282552445394412
|
116
122
|
requirements: []
|
117
123
|
rubyforge_project:
|
118
|
-
rubygems_version: 1.8.
|
124
|
+
rubygems_version: 1.8.23
|
119
125
|
signing_key:
|
120
126
|
specification_version: 3
|
121
127
|
summary: Provides an interface to the BigBlueButton web meeting API (https://github.com/mconf/bigbluebutton-api-ruby)
|
data/.rvmrc
DELETED
data/lib/hash_to_xml.rb
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
require 'xmlsimple'
|
2
|
-
|
3
|
-
class Hash
|
4
|
-
class << self
|
5
|
-
def from_xml(xml_io)
|
6
|
-
begin
|
7
|
-
# we'll not use 'KeyToSymbol' because it doesn't symbolize the keys for node attributes
|
8
|
-
opts = { 'ForceArray' => false, 'ForceContent' => false } #
|
9
|
-
hash = XmlSimple.xml_in(xml_io, opts)
|
10
|
-
return symbolize_keys(hash)
|
11
|
-
rescue Exception => e
|
12
|
-
raise BigBlueButton::BigBlueButtonException.new("Impossible to convert XML to hash. Error: #{e.message}")
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
def symbolize_keys(arg)
|
17
|
-
case arg
|
18
|
-
when Array
|
19
|
-
arg.map { |elem| symbolize_keys elem }
|
20
|
-
when Hash
|
21
|
-
Hash[
|
22
|
-
arg.map { |key, value|
|
23
|
-
k = key.is_a?(String) ? key.to_sym : key
|
24
|
-
v = symbolize_keys value
|
25
|
-
[k,v]
|
26
|
-
}]
|
27
|
-
else
|
28
|
-
arg
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
end
|
33
|
-
end
|
@@ -1,273 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
# Tests for BBB API version 0.8
|
4
|
-
describe BigBlueButton::BigBlueButtonApi do
|
5
|
-
|
6
|
-
# default variables and API object for all tests
|
7
|
-
let(:url) { "http://server.com" }
|
8
|
-
let(:salt) { "1234567890abcdefghijkl" }
|
9
|
-
let(:version) { "0.8" }
|
10
|
-
let(:debug) { false }
|
11
|
-
let(:api) { BigBlueButton::BigBlueButtonApi.new(url, salt, version, debug) }
|
12
|
-
|
13
|
-
describe "#create_meeting" do
|
14
|
-
|
15
|
-
context "without modules" do
|
16
|
-
let(:req_params) {
|
17
|
-
{ :name => "name", :meetingID => "meeting-id", :moderatorPW => "mp", :attendeePW => "ap",
|
18
|
-
:welcome => "Welcome!", :dialNumber => 12345678, :logoutURL => "http://example.com",
|
19
|
-
:maxParticipants => 25, :voiceBridge => 12345, :record => "true", :duration => 20,
|
20
|
-
:meta_1 => "meta1", :meta_2 => "meta2" }
|
21
|
-
}
|
22
|
-
let(:req_response) {
|
23
|
-
{ :meetingID => 123, :moderatorPW => 111, :attendeePW => 222, :hasBeenForciblyEnded => "FALSE", :createTime => "123123123" }
|
24
|
-
}
|
25
|
-
let(:final_response) {
|
26
|
-
{ :meetingID => "123", :moderatorPW => "111", :attendeePW => "222", :hasBeenForciblyEnded => false, :createTime => 123123123 }
|
27
|
-
}
|
28
|
-
|
29
|
-
before { api.should_receive(:send_api_request).with(:create, req_params).and_return(req_response) }
|
30
|
-
subject {
|
31
|
-
options = { :moderatorPW => "mp", :attendeePW => "ap", :welcome => "Welcome!", :dialNumber => 12345678,
|
32
|
-
:logoutURL => "http://example.com", :maxParticipants => 25, :voiceBridge => 12345, :record => true,
|
33
|
-
:duration => 20, :meta_1 => "meta1", :meta_2 => "meta2" }
|
34
|
-
api.create_meeting("name", "meeting-id", options)
|
35
|
-
}
|
36
|
-
it { subject.should == final_response }
|
37
|
-
end
|
38
|
-
|
39
|
-
context "with modules" do
|
40
|
-
let(:req_params) {
|
41
|
-
{ :name => "name", :meetingID => "meeting-id", :moderatorPW => "mp", :attendeePW => "ap" }
|
42
|
-
}
|
43
|
-
let(:req_response) {
|
44
|
-
{ :meetingID => 123, :moderatorPW => 111, :attendeePW => 222, :hasBeenForciblyEnded => "FALSE", :createTime => "123123123" }
|
45
|
-
}
|
46
|
-
let(:final_response) {
|
47
|
-
{ :meetingID => "123", :moderatorPW => "111", :attendeePW => "222", :hasBeenForciblyEnded => false, :createTime => 123123123 }
|
48
|
-
}
|
49
|
-
let(:modules) {
|
50
|
-
m = BigBlueButton::BigBlueButtonModules.new
|
51
|
-
m.add_presentation(:url, "http://www.samplepdf.com/sample.pdf")
|
52
|
-
m.add_presentation(:url, "http://www.samplepdf.com/sample2.pdf")
|
53
|
-
m.add_presentation(:base64, "JVBERi0xLjQKJ....[clipped here]....0CiUlRU9GCg==", "first-class.pdf")
|
54
|
-
m
|
55
|
-
}
|
56
|
-
|
57
|
-
before {
|
58
|
-
api.should_receive(:send_api_request).with(:create, req_params, modules.to_xml).
|
59
|
-
and_return(req_response)
|
60
|
-
}
|
61
|
-
subject {
|
62
|
-
options = { :moderatorPW => "mp", :attendeePW => "ap" }
|
63
|
-
api.create_meeting("name", "meeting-id", options, modules)
|
64
|
-
}
|
65
|
-
it { subject.should == final_response }
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
describe "#join_meeting_url" do
|
70
|
-
let(:params) {
|
71
|
-
{ :meetingID => "meeting-id", :password => "pw", :fullName => "Name",
|
72
|
-
:userID => "id123", :webVoiceConf => 12345678, :createTime => 9876543 }
|
73
|
-
}
|
74
|
-
|
75
|
-
before { api.should_receive(:get_url).with(:join, params).and_return("test-url") }
|
76
|
-
it {
|
77
|
-
options = { :userID => "id123", :webVoiceConf => 12345678, :createTime => 9876543 }
|
78
|
-
api.join_meeting_url("meeting-id", "Name", "pw", options).should == "test-url"
|
79
|
-
}
|
80
|
-
end
|
81
|
-
|
82
|
-
describe "#join_meeting" do
|
83
|
-
let(:params) {
|
84
|
-
{ :meetingID => "meeting-id", :password => "pw", :fullName => "Name",
|
85
|
-
:userID => "id123", :webVoiceConf => 12345678, :createTime => 9876543 }
|
86
|
-
}
|
87
|
-
|
88
|
-
before { api.should_receive(:send_api_request).with(:join, params).and_return("join-return") }
|
89
|
-
it {
|
90
|
-
options = { :userID => "id123", :webVoiceConf => 12345678, :createTime => 9876543 }
|
91
|
-
api.join_meeting("meeting-id", "Name", "pw", options).should == "join-return"
|
92
|
-
}
|
93
|
-
end
|
94
|
-
|
95
|
-
describe "#get_recordings" do
|
96
|
-
let(:recording1) { { :recordID => "id1", :meetindID => "meeting-id" } } # simplified "recording" node in the response
|
97
|
-
let(:recording2) { { :recordID => "id2", :meetindID => "meeting-id" } }
|
98
|
-
let(:response) {
|
99
|
-
{ :returncode => true, :recordings => { :recording => [ recording1, recording2 ] }, :messageKey => "mkey", :message => "m" }
|
100
|
-
}
|
101
|
-
let(:flattened_response) {
|
102
|
-
{ :returncode => true, :recordings => [ recording1, recording2 ], :messageKey => "mkey", :message => "m" }
|
103
|
-
} # hash *after* the flatten_objects call
|
104
|
-
|
105
|
-
context "only supported for >= 0.8" do
|
106
|
-
let(:api) { BigBlueButton::BigBlueButtonApi.new(url, salt, "0.7", debug) }
|
107
|
-
it { expect { api.get_recordings }.to raise_error(BigBlueButton::BigBlueButtonException) }
|
108
|
-
end
|
109
|
-
|
110
|
-
context "accepts non standard options" do
|
111
|
-
let(:params) { { :meetingID => "meeting-id", :nonStandard => 1 } }
|
112
|
-
before { api.should_receive(:send_api_request).with(:getRecordings, params).and_return(response) }
|
113
|
-
it { api.get_recordings(params) }
|
114
|
-
end
|
115
|
-
|
116
|
-
context "without meeting ID" do
|
117
|
-
before { api.should_receive(:send_api_request).with(:getRecordings, {}).and_return(response) }
|
118
|
-
it { api.get_recordings.should == response }
|
119
|
-
end
|
120
|
-
|
121
|
-
context "with one meeting ID" do
|
122
|
-
context "in an array" do
|
123
|
-
let(:options) { { :meetingID => ["meeting-id"] } }
|
124
|
-
let(:req_params) { { :meetingID => "meeting-id" } }
|
125
|
-
before { api.should_receive(:send_api_request).with(:getRecordings, req_params).and_return(response) }
|
126
|
-
it { api.get_recordings(options).should == response }
|
127
|
-
end
|
128
|
-
|
129
|
-
context "in a string" do
|
130
|
-
let(:options) { { :meetingID => "meeting-id" } }
|
131
|
-
let(:req_params) { { :meetingID => "meeting-id" } }
|
132
|
-
before { api.should_receive(:send_api_request).with(:getRecordings, req_params).and_return(response) }
|
133
|
-
it { api.get_recordings(options).should == response }
|
134
|
-
end
|
135
|
-
end
|
136
|
-
|
137
|
-
context "with several meeting IDs" do
|
138
|
-
context "in an array" do
|
139
|
-
let(:options) { { :meetingID => ["meeting-id-1", "meeting-id-2"] } }
|
140
|
-
let(:req_params) { { :meetingID => "meeting-id-1,meeting-id-2" } }
|
141
|
-
before { api.should_receive(:send_api_request).with(:getRecordings, req_params).and_return(response) }
|
142
|
-
it { api.get_recordings(options).should == response }
|
143
|
-
end
|
144
|
-
|
145
|
-
context "in a string" do
|
146
|
-
let(:options) { { :meetingID => "meeting-id-1,meeting-id-2" } }
|
147
|
-
let(:req_params) { { :meetingID => "meeting-id-1,meeting-id-2" } }
|
148
|
-
before { api.should_receive(:send_api_request).with(:getRecordings, req_params).and_return(response) }
|
149
|
-
it { api.get_recordings(options).should == response }
|
150
|
-
end
|
151
|
-
end
|
152
|
-
|
153
|
-
context "formats the response" do
|
154
|
-
before {
|
155
|
-
api.should_receive(:send_api_request).with(:getRecordings, anything).and_return(flattened_response)
|
156
|
-
formatter_mock = mock(BigBlueButton::BigBlueButtonFormatter)
|
157
|
-
formatter_mock.should_receive(:flatten_objects).with(:recordings, :recording)
|
158
|
-
BigBlueButton::BigBlueButtonFormatter.should_receive(:format_recording).with(recording1)
|
159
|
-
BigBlueButton::BigBlueButtonFormatter.should_receive(:format_recording).with(recording2)
|
160
|
-
BigBlueButton::BigBlueButtonFormatter.should_receive(:new).and_return(formatter_mock)
|
161
|
-
}
|
162
|
-
it { api.get_recordings }
|
163
|
-
end
|
164
|
-
end
|
165
|
-
|
166
|
-
describe "#publish_recordings" do
|
167
|
-
context "only supported for >= 0.8" do
|
168
|
-
let(:api) { BigBlueButton::BigBlueButtonApi.new(url, salt, "0.7", debug) }
|
169
|
-
it { expect { api.publish_recordings("id", true) }.to raise_error(BigBlueButton::BigBlueButtonException) }
|
170
|
-
end
|
171
|
-
|
172
|
-
context "publish is converted to string" do
|
173
|
-
let(:recordIDs) { "any" }
|
174
|
-
let(:req_params) { { :publish => "false", :recordID => "any" } }
|
175
|
-
before { api.should_receive(:send_api_request).with(:publishRecordings, req_params) }
|
176
|
-
it { api.publish_recordings(recordIDs, false) }
|
177
|
-
end
|
178
|
-
|
179
|
-
context "with one recording ID" do
|
180
|
-
context "in an array" do
|
181
|
-
let(:recordIDs) { ["id-1"] }
|
182
|
-
let(:req_params) { { :publish => "true", :recordID => "id-1" } }
|
183
|
-
before { api.should_receive(:send_api_request).with(:publishRecordings, req_params) }
|
184
|
-
it { api.publish_recordings(recordIDs, true) }
|
185
|
-
end
|
186
|
-
|
187
|
-
context "in a string" do
|
188
|
-
let(:recordIDs) { "id-1" }
|
189
|
-
let(:req_params) { { :publish => "true", :recordID => "id-1" } }
|
190
|
-
before { api.should_receive(:send_api_request).with(:publishRecordings, req_params) }
|
191
|
-
it { api.publish_recordings(recordIDs, true) }
|
192
|
-
end
|
193
|
-
end
|
194
|
-
|
195
|
-
context "with several recording IDs" do
|
196
|
-
context "in an array" do
|
197
|
-
let(:recordIDs) { ["id-1", "id-2"] }
|
198
|
-
let(:req_params) { { :publish => "true", :recordID => "id-1,id-2" } }
|
199
|
-
before { api.should_receive(:send_api_request).with(:publishRecordings, req_params) }
|
200
|
-
it { api.publish_recordings(recordIDs, true) }
|
201
|
-
end
|
202
|
-
|
203
|
-
context "in a string" do
|
204
|
-
let(:recordIDs) { "id-1,id-2,id-3" }
|
205
|
-
let(:req_params) { { :publish => "true", :recordID => "id-1,id-2,id-3" } }
|
206
|
-
before { api.should_receive(:send_api_request).with(:publishRecordings, req_params) }
|
207
|
-
it { api.publish_recordings(recordIDs, true) }
|
208
|
-
end
|
209
|
-
end
|
210
|
-
end
|
211
|
-
|
212
|
-
describe "#delete_recordings" do
|
213
|
-
context "only supported for >= 0.8" do
|
214
|
-
let(:api) { BigBlueButton::BigBlueButtonApi.new(url, salt, "0.7", debug) }
|
215
|
-
it { expect { api.delete_recordings("id") }.to raise_error(BigBlueButton::BigBlueButtonException) }
|
216
|
-
end
|
217
|
-
|
218
|
-
context "with one recording ID" do
|
219
|
-
context "in an array" do
|
220
|
-
let(:recordIDs) { ["id-1"] }
|
221
|
-
let(:req_params) { { :recordID => "id-1" } }
|
222
|
-
before { api.should_receive(:send_api_request).with(:deleteRecordings, req_params) }
|
223
|
-
it { api.delete_recordings(recordIDs) }
|
224
|
-
end
|
225
|
-
|
226
|
-
context "in a string" do
|
227
|
-
let(:recordIDs) { "id-1" }
|
228
|
-
let(:req_params) { { :recordID => "id-1" } }
|
229
|
-
before { api.should_receive(:send_api_request).with(:deleteRecordings, req_params) }
|
230
|
-
it { api.delete_recordings(recordIDs) }
|
231
|
-
end
|
232
|
-
end
|
233
|
-
|
234
|
-
context "with several recording IDs" do
|
235
|
-
context "in an array" do
|
236
|
-
let(:recordIDs) { ["id-1", "id-2"] }
|
237
|
-
let(:req_params) { { :recordID => "id-1,id-2" } }
|
238
|
-
before { api.should_receive(:send_api_request).with(:deleteRecordings, req_params) }
|
239
|
-
it { api.delete_recordings(recordIDs) }
|
240
|
-
end
|
241
|
-
|
242
|
-
context "in a string" do
|
243
|
-
let(:recordIDs) { "id-1,id-2,id-3" }
|
244
|
-
let(:req_params) { { :recordID => "id-1,id-2,id-3" } }
|
245
|
-
before { api.should_receive(:send_api_request).with(:deleteRecordings, req_params) }
|
246
|
-
it { api.delete_recordings(recordIDs) }
|
247
|
-
end
|
248
|
-
end
|
249
|
-
end
|
250
|
-
|
251
|
-
describe "#get_meeting_info" do
|
252
|
-
let(:params) { { :meetingID => "meeting-id", :password => "password" } }
|
253
|
-
|
254
|
-
# new values were added in the response in 0.8 (we'll only test these values):
|
255
|
-
# meetingName, participantCount, maxUsers, voiceBridge, recording, metadata
|
256
|
-
let(:response) {
|
257
|
-
{ :meetingName => 123, :maxUsers => "100", :voiceBridge => "12341234",
|
258
|
-
:createTime => "123123123", :attendees => { :attendee => [ ] },
|
259
|
-
:messageKey => "mkey", :message => "m", :recording => "false", :meta_1 => "abc", :meta_2 => "2" }
|
260
|
-
}
|
261
|
-
|
262
|
-
before { api.should_receive(:send_api_request).with(:getMeetingInfo, params).and_return(response) }
|
263
|
-
subject { api.get_meeting_info("meeting-id", "password") }
|
264
|
-
it { subject[:meetingName].should == "123" }
|
265
|
-
it { subject[:maxUsers].should == 100 }
|
266
|
-
it { subject[:voiceBridge].should == 12341234 }
|
267
|
-
it { subject[:createTime].should == 123123123 }
|
268
|
-
it { subject[:recording].should == false }
|
269
|
-
it { subject[:meta_1].should == "abc" }
|
270
|
-
it { subject[:meta_2].should == "2" }
|
271
|
-
end
|
272
|
-
|
273
|
-
end
|