bigbluebutton-api-ruby 1.6.0 → 1.7.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.
- checksums.yaml +4 -4
- data/.rspec +1 -0
- data/CHANGELOG.md +14 -0
- data/Gemfile.lock +1 -1
- data/Rakefile +2 -1
- data/bigbluebutton-api-ruby.gemspec +1 -1
- data/lib/bigbluebutton_api.rb +49 -10
- data/lib/bigbluebutton_formatter.rb +1 -1
- data/spec/bigbluebutton_api_spec.rb +47 -11
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 281b4e206ec398cc651d0525256a68dd048d3db3
|
4
|
+
data.tar.gz: 4c6a8bddc03d8c5289926fab24d589442bc16095
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a2105c7f2d8f6b03a82e0f2bc42052f932e75de76318bcb7885d72e75b492696bd279dbc33e6bc537d37ed2a18e7d444e34ec4b2abe58d2e7e73421b4061164
|
7
|
+
data.tar.gz: 130aa32c3945507d661ef188dd158f545a0755be304ee3b1a55cdfc1bcd57ef168f41b5fd9e5a5488f62bf0b636566a6347ff85708dc32e35d2e3c87a8241bc3
|
data/.rspec
CHANGED
data/CHANGELOG.md
CHANGED
@@ -9,6 +9,18 @@ To find them, search for their description or ID in the new issue tracker.
|
|
9
9
|
------------------------------------
|
10
10
|
|
11
11
|
|
12
|
+
## [1.7.0] - 2018-08-17
|
13
|
+
|
14
|
+
* [#29] Add support to the API call `updateRecordings` introduced in BigBlueButton 1.1.
|
15
|
+
* [#31] Fixed issue with length=nil breaking multiple recording formats.
|
16
|
+
* Call `setConfigXML` via POST and change encoding method. Fixes issues with special
|
17
|
+
characters (such as `*`) in the config.xml.
|
18
|
+
* Add method to return the URL to `/check`.
|
19
|
+
|
20
|
+
## [1.6.0] - 2016-06-15
|
21
|
+
|
22
|
+
* Rename BigBlueButtonApi#salt to #secret
|
23
|
+
|
12
24
|
## [1.5.0] - 2016-04-07
|
13
25
|
|
14
26
|
* Add 1.0 as a supported version of BigBlueButton.
|
@@ -141,6 +153,8 @@ were different in cases when they were not.
|
|
141
153
|
(instead of browser URL). This call currently does not work as
|
142
154
|
documented.
|
143
155
|
|
156
|
+
[1.7.0]: https://github.com/mconf/bigbluebutton-api-ruby/compare/v1.6.0...v1.7.0
|
157
|
+
[1.6.0]: https://github.com/mconf/bigbluebutton-api-ruby/compare/v1.5.0...v1.6.0
|
144
158
|
[1.5.0]: https://github.com/mconf/bigbluebutton-api-ruby/compare/v1.4.0...v1.5.0
|
145
159
|
[1.4.0]: https://github.com/mconf/bigbluebutton-api-ruby/compare/v1.3.0...v1.4.0
|
146
160
|
[1.3.0]: https://github.com/mconf/bigbluebutton-api-ruby/compare/v1.2.0...v1.3.0
|
data/Gemfile.lock
CHANGED
data/Rakefile
CHANGED
@@ -2,7 +2,7 @@ $:.push File.expand_path("../lib", __FILE__)
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = "bigbluebutton-api-ruby"
|
5
|
-
s.version = "1.
|
5
|
+
s.version = "1.7.0"
|
6
6
|
s.licenses = ["MIT"]
|
7
7
|
s.extra_rdoc_files = ["README.md", "LICENSE", "LICENSE_003", "CHANGELOG.md"]
|
8
8
|
s.summary = "BigBlueButton integration for ruby"
|
data/lib/bigbluebutton_api.rb
CHANGED
@@ -226,7 +226,8 @@ module BigBlueButton
|
|
226
226
|
# in this hash and they will be added to the API call.
|
227
227
|
def join_meeting_url(meeting_id, user_name, password, options={})
|
228
228
|
params = { :meetingID => meeting_id, :password => password, :fullName => user_name }.merge(options)
|
229
|
-
get_url(:join, params)
|
229
|
+
url, data = get_url(:join, params)
|
230
|
+
url
|
230
231
|
end
|
231
232
|
|
232
233
|
# Returns a hash object containing the information of a meeting.
|
@@ -468,6 +469,30 @@ module BigBlueButton
|
|
468
469
|
response
|
469
470
|
end
|
470
471
|
|
472
|
+
# Available since BBB v1.1
|
473
|
+
# Update metadata (or other attributes depending on the API implementation) for a given recordID (or set of record IDs).
|
474
|
+
# recordIDs (string, Array):: ID or IDs of the target recordings.
|
475
|
+
# Any of the following values are accepted:
|
476
|
+
# "id1"
|
477
|
+
# "id1,id2,id3"
|
478
|
+
# ["id1"]
|
479
|
+
# ["id1", "id2", "id3"]
|
480
|
+
# meta (String):: Pass one or more metadata values to be update (format is the same as in create call)
|
481
|
+
# options (Hash):: Hash with additional parameters. This method doesn't accept additional
|
482
|
+
# parameters, but if you have a custom API with more parameters, you
|
483
|
+
# can simply pass them in this hash and they will be added to the API call.
|
484
|
+
#
|
485
|
+
# === Example responses
|
486
|
+
#
|
487
|
+
# { :returncode => success, :updated => true }
|
488
|
+
#
|
489
|
+
def update_recordings(recordIDs, meta=nil, options={})
|
490
|
+
recordIDs = recordIDs.join(",") if recordIDs.instance_of?(Array) # ["id1", "id2"] becomes "id1,id2"
|
491
|
+
params = { :recordID => recordIDs, :meta => meta }.merge(options)
|
492
|
+
send_api_request(:updateRecordings, params)
|
493
|
+
end
|
494
|
+
|
495
|
+
|
471
496
|
# Publish and unpublish recordings for a given recordID (or set of record IDs).
|
472
497
|
# recordIDs (string, Array):: ID or IDs of the target recordings.
|
473
498
|
# Any of the following values are accepted:
|
@@ -599,6 +624,11 @@ module BigBlueButton
|
|
599
624
|
response[:returncode]
|
600
625
|
end
|
601
626
|
|
627
|
+
def check_url
|
628
|
+
url, data = get_url(:check)
|
629
|
+
url
|
630
|
+
end
|
631
|
+
|
602
632
|
# API's are equal if all the following attributes are equal.
|
603
633
|
def ==(other)
|
604
634
|
r = true
|
@@ -623,11 +653,12 @@ module BigBlueButton
|
|
623
653
|
# params (Hash):: The parameters to be passed in the URL
|
624
654
|
def get_url(method, params={})
|
625
655
|
if method == :index
|
626
|
-
return @url
|
656
|
+
return @url, nil
|
657
|
+
elsif method == :check
|
658
|
+
baseurl = URI.join(@url, "/").to_s
|
659
|
+
return "#{baseurl}check", nil
|
627
660
|
end
|
628
661
|
|
629
|
-
url = "#{@url}/#{method}?"
|
630
|
-
|
631
662
|
# stringify and escape all params
|
632
663
|
params.delete_if { |k, v| v.nil? } unless params.nil?
|
633
664
|
# some API calls require the params to be sorted
|
@@ -635,16 +666,22 @@ module BigBlueButton
|
|
635
666
|
params = params.inject({}){ |memo,(k,v)| memo[k.to_sym] = v; memo }
|
636
667
|
params = Hash[params.sort]
|
637
668
|
params_string = ""
|
638
|
-
params_string = params.map{ |k,v| "#{k}=" +
|
669
|
+
params_string = params.map{ |k,v| "#{k}=" + URI.encode_www_form_component(v.to_s) unless k.nil? || v.nil? }.join("&")
|
639
670
|
|
640
671
|
# checksum calc
|
641
672
|
checksum_param = params_string + @secret
|
642
673
|
checksum_param = method.to_s + checksum_param
|
643
674
|
checksum = Digest::SHA1.hexdigest(checksum_param)
|
644
675
|
|
645
|
-
|
646
|
-
|
647
|
-
|
676
|
+
if method == :setConfigXML
|
677
|
+
params_string = "checksum=#{checksum}&#{params_string}"
|
678
|
+
return "#{@url}/#{method}", params_string
|
679
|
+
else
|
680
|
+
url = "#{@url}/#{method}?"
|
681
|
+
url += "#{params_string}&" unless params_string.empty?
|
682
|
+
url += "checksum=#{checksum}"
|
683
|
+
return url, nil
|
684
|
+
end
|
648
685
|
end
|
649
686
|
|
650
687
|
# Performs an API call.
|
@@ -661,7 +698,9 @@ module BigBlueButton
|
|
661
698
|
# raw (boolean):: If true, returns the data as it was received. Will not parse it into a Hash,
|
662
699
|
# check for errors or throw exceptions.
|
663
700
|
def send_api_request(method, params={}, data=nil, raw=false)
|
664
|
-
|
701
|
+
# if the method returns a body, use it as the data in the post request
|
702
|
+
url, body = get_url(method, params)
|
703
|
+
data = body if body
|
665
704
|
|
666
705
|
@http_response = send_request(url, data)
|
667
706
|
return {} if @http_response.body.empty?
|
@@ -711,7 +750,7 @@ module BigBlueButton
|
|
711
750
|
response = http.get(url_parsed.request_uri, @request_headers)
|
712
751
|
else
|
713
752
|
puts "BigBlueButtonAPI: Sending as a POST request with data.size = #{data.size}" if @debug
|
714
|
-
opts = { 'Content-Type' => '
|
753
|
+
opts = { 'Content-Type' => 'application/x-www-form-urlencoded' }.merge @request_headers
|
715
754
|
response = http.post(url_parsed.request_uri, data, opts)
|
716
755
|
end
|
717
756
|
puts "BigBlueButtonAPI: URL response = #{response.body}" if @debug
|
@@ -226,7 +226,7 @@ describe BigBlueButton::BigBlueButtonApi do
|
|
226
226
|
:userID => "id123", :webVoiceConf => 12345678, :createTime => 9876543 }
|
227
227
|
}
|
228
228
|
|
229
|
-
before { api.should_receive(:get_url).with(:join, params).and_return("test-url") }
|
229
|
+
before { api.should_receive(:get_url).with(:join, params).and_return(["test-url", nil]) }
|
230
230
|
it {
|
231
231
|
options = { :userID => "id123", :webVoiceConf => 12345678, :createTime => 9876543 }
|
232
232
|
api.join_meeting_url("meeting-id", "Name", "pw", options).should == "test-url"
|
@@ -340,6 +340,15 @@ describe BigBlueButton::BigBlueButtonApi do
|
|
340
340
|
end
|
341
341
|
end
|
342
342
|
|
343
|
+
describe "#check_url" do
|
344
|
+
context "when method = :check" do
|
345
|
+
it {
|
346
|
+
api.url = 'http://my-test-server.com/bigbluebutton/api'
|
347
|
+
api.check_url.should == 'http://my-test-server.com/check'
|
348
|
+
}
|
349
|
+
end
|
350
|
+
end
|
351
|
+
|
343
352
|
describe "#==" do
|
344
353
|
let(:api2) { BigBlueButton::BigBlueButtonApi.new(url, secret, version, debug) }
|
345
354
|
|
@@ -400,14 +409,21 @@ describe BigBlueButton::BigBlueButtonApi do
|
|
400
409
|
describe "#get_url" do
|
401
410
|
|
402
411
|
context "when method = :index" do
|
403
|
-
it { api.get_url(:index).should == api.url }
|
412
|
+
it { api.get_url(:index).should == [api.url, nil] }
|
413
|
+
end
|
414
|
+
|
415
|
+
context "when method = :check" do
|
416
|
+
it {
|
417
|
+
api.url = 'http://my-test-server.com/bigbluebutton/api'
|
418
|
+
api.get_url(:check).should == ['http://my-test-server.com/check', nil]
|
419
|
+
}
|
404
420
|
end
|
405
421
|
|
406
422
|
context "when method != :index" do
|
407
423
|
context "validates the entire url" do
|
408
424
|
context "with params" do
|
409
425
|
let(:params) { { :param1 => "value1", :param2 => "value2" } }
|
410
|
-
subject { api.get_url(:join, params) }
|
426
|
+
subject { api.get_url(:join, params)[0] }
|
411
427
|
it {
|
412
428
|
# the hash can be sorted differently depending on the ruby version
|
413
429
|
if params.map{ |k,v| "#{k}" }.join =~ /^param1/
|
@@ -419,35 +435,54 @@ describe BigBlueButton::BigBlueButtonApi do
|
|
419
435
|
end
|
420
436
|
|
421
437
|
context "without params" do
|
422
|
-
subject { api.get_url(:join) }
|
438
|
+
subject { api.get_url(:join)[0] }
|
423
439
|
it { subject.should match(/#{url}\/join\?[^&]/) }
|
424
440
|
end
|
425
441
|
end
|
426
442
|
|
443
|
+
context "when method = :setConfigXML" do
|
444
|
+
it {
|
445
|
+
api.url = 'http://my-test-server.com/bigbluebutton/api'
|
446
|
+
response = api.get_url(:setConfigXML, { param1: 1, param2: 2 })
|
447
|
+
response[0].should eql('http://my-test-server.com/bigbluebutton/api/setConfigXML')
|
448
|
+
response[1].should match(/checksum=.*¶m1=1¶m2=2/)
|
449
|
+
}
|
450
|
+
end
|
451
|
+
|
427
452
|
context "discards params with nil value" do
|
428
453
|
let(:params) { { :param1 => "value1", :param2 => nil } }
|
429
|
-
subject { api.get_url(:join, params) }
|
454
|
+
subject { api.get_url(:join, params)[0] }
|
430
455
|
it { subject.should_not match(/param2=/) }
|
431
456
|
end
|
432
457
|
|
433
458
|
context "escapes all params" do
|
434
459
|
let(:params) { { :param1 => "value with spaces", :param2 => "@$" } }
|
435
|
-
subject { api.get_url(:join, params) }
|
460
|
+
subject { api.get_url(:join, params)[0] }
|
436
461
|
it { subject.should match(/param1=value\+with\+spaces/) }
|
437
462
|
it { subject.should match(/param2=%40%24/) }
|
438
463
|
end
|
439
464
|
|
465
|
+
[ [' ', '+'],
|
466
|
+
['*', '*']
|
467
|
+
].each do |values|
|
468
|
+
context "escapes #{values[0].inspect} as #{values[1].inspect}" do
|
469
|
+
let(:params) { { param1: "before#{values[0]}after" } }
|
470
|
+
subject { api.get_url(:join, params)[0] }
|
471
|
+
it { subject.should match(/param1=before#{Regexp.quote(values[1])}after/) }
|
472
|
+
end
|
473
|
+
end
|
474
|
+
|
440
475
|
context "includes the checksum" do
|
441
476
|
let(:params) { { :param1 => "value1", :param2 => "value2" } }
|
442
477
|
let(:checksum) {
|
443
478
|
# the hash can be sorted differently depending on the ruby version
|
444
|
-
if params.map{ |k,v|
|
479
|
+
if params.map{ |k,v| k }.join =~ /^param1/
|
445
480
|
"67882ae54f49600f56f358c10d24697ef7d8c6b2"
|
446
481
|
else
|
447
482
|
"85a54e28e4ec18bfdcb214a73f74d35b09a84176"
|
448
483
|
end
|
449
484
|
}
|
450
|
-
subject { api.get_url(:join, params) }
|
485
|
+
subject { api.get_url(:join, params)[0] }
|
451
486
|
it { subject.should match(/checksum=#{checksum}$/) }
|
452
487
|
end
|
453
488
|
end
|
@@ -461,7 +496,7 @@ describe BigBlueButton::BigBlueButtonApi do
|
|
461
496
|
let(:make_request) { api.send_api_request(method, params, data) }
|
462
497
|
let(:response_mock) { mock() } # mock of what send_request() would return
|
463
498
|
|
464
|
-
before { api.should_receive(:get_url).with(method, params).and_return(url) }
|
499
|
+
before { api.should_receive(:get_url).with(method, params).and_return([url, nil]) }
|
465
500
|
|
466
501
|
context "returns an empty hash if the response body is empty" do
|
467
502
|
before do
|
@@ -551,7 +586,7 @@ describe BigBlueButton::BigBlueButtonApi do
|
|
551
586
|
let(:data) { "any data" }
|
552
587
|
before {
|
553
588
|
path = "/res?param1=value1&checksum=12345"
|
554
|
-
opts = { 'Content-Type' => '
|
589
|
+
opts = { 'Content-Type' => 'application/x-www-form-urlencoded' }
|
555
590
|
@http_mock.should_receive(:post).with(path, data, opts).and_return("ok")
|
556
591
|
}
|
557
592
|
it {
|
@@ -573,7 +608,7 @@ describe BigBlueButton::BigBlueButtonApi do
|
|
573
608
|
let(:data) { "any data" }
|
574
609
|
before {
|
575
610
|
path = "/res?param1=value1&checksum=12345"
|
576
|
-
opts = { 'Content-Type' => '
|
611
|
+
opts = { 'Content-Type' => 'application/x-www-form-urlencoded', :anything => "anything" }
|
577
612
|
@http_mock.should_receive(:post).with(path, data, opts).and_return("ok")
|
578
613
|
}
|
579
614
|
it {
|
@@ -755,4 +790,5 @@ describe BigBlueButton::BigBlueButtonApi do
|
|
755
790
|
it_should_behave_like "BigBlueButtonApi", "0.8"
|
756
791
|
it_should_behave_like "BigBlueButtonApi", "0.81"
|
757
792
|
it_should_behave_like "BigBlueButtonApi", "0.9"
|
793
|
+
it_should_behave_like "BigBlueButtonApi", "1.0"
|
758
794
|
end
|
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.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mconf
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2018-08-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: xml-simple
|