bigbluebutton-api-ruby 2.0.0 → 2.1.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/Gemfile.lock +1 -1
- data/bigbluebutton-api-ruby.gemspec +1 -1
- data/lib/bigbluebutton_api.rb +14 -4
- data/spec/bigbluebutton_api_spec.rb +44 -20
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0e1ed8b5e115c66225c9d24e69b3abcb89bb7cdda0a2d54428b05322ac6eafbd
|
|
4
|
+
data.tar.gz: bef1ef6931bf78098f563c9138658695c33d8bb29ecc87fea4f982457f0a69a3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b852593d483c21c5ae5d12c5ba1c3d623e6edbcbcfd15fb4f88c9dd54d346a5f1ae336182950d2f1657189bcc33a9fdf053c6930743b055d00b44df053d492ff
|
|
7
|
+
data.tar.gz: 8b8e3eb8255aa8a88f3f5827f87e4fa028ff12ec9ad7229e7295fe3469d4ab37f6537d10de15e85da5758d8f0cc19c48679e2648a538b5e752831f2407533fee
|
data/Gemfile.lock
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 = "2.
|
|
5
|
+
s.version = "2.1.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
|
@@ -67,15 +67,15 @@ module BigBlueButton
|
|
|
67
67
|
# secret:: Shared secret for this server
|
|
68
68
|
# version:: API version e.g. 0.81
|
|
69
69
|
# logger:: Logger object to log actions (so apps can use their own loggers)
|
|
70
|
-
#
|
|
71
|
-
def initialize(url, secret, version=nil, logger=nil,
|
|
70
|
+
# algorithm:: Define which algorithm to use [sha1, sha256, sha512]
|
|
71
|
+
def initialize(url, secret, version=nil, logger=nil, algorithm="sha1")
|
|
72
72
|
@supported_versions = ['0.8', '0.81', '0.9', '1.0']
|
|
73
73
|
@url = url.chomp('/')
|
|
74
74
|
@secret = secret
|
|
75
75
|
@timeout = 10 # default timeout for api requests
|
|
76
76
|
@request_headers = {} # http headers sent in all requests
|
|
77
77
|
@logger = logger
|
|
78
|
-
@
|
|
78
|
+
@algorithm = algorithm
|
|
79
79
|
# If logger is not informed, it defaults to STDOUT with INFO level
|
|
80
80
|
if logger.nil?
|
|
81
81
|
@logger = Logger.new(STDOUT)
|
|
@@ -604,7 +604,7 @@ module BigBlueButton
|
|
|
604
604
|
# checksum calc
|
|
605
605
|
checksum_param = params_string + @secret
|
|
606
606
|
checksum_param = method.to_s + checksum_param
|
|
607
|
-
checksum =
|
|
607
|
+
checksum = calculate_checksum(checksum_param)
|
|
608
608
|
|
|
609
609
|
url = "#{@url}/#{method}?"
|
|
610
610
|
url += "#{params_string}&" unless params_string.empty?
|
|
@@ -721,5 +721,15 @@ module BigBlueButton
|
|
|
721
721
|
end
|
|
722
722
|
end
|
|
723
723
|
|
|
724
|
+
def calculate_checksum(checksum_param)
|
|
725
|
+
case @algorithm
|
|
726
|
+
when "sha512"
|
|
727
|
+
Digest::SHA512.hexdigest(checksum_param)
|
|
728
|
+
when "sha2", "sha256", true # checks true for legacy support
|
|
729
|
+
Digest::SHA256.hexdigest(checksum_param)
|
|
730
|
+
else
|
|
731
|
+
Digest::SHA1.hexdigest(checksum_param)
|
|
732
|
+
end
|
|
733
|
+
end
|
|
724
734
|
end
|
|
725
735
|
end
|
|
@@ -465,31 +465,55 @@ describe BigBlueButton::BigBlueButtonApi do
|
|
|
465
465
|
end
|
|
466
466
|
|
|
467
467
|
context "includes the checksum" do
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
}
|
|
468
|
+
let(:method) { "join" }
|
|
469
|
+
let(:params) { { param1: "value1", param2: "value2" } }
|
|
470
|
+
let(:params_string) { params.map{ |k,v| "#{k}=" + URI.encode_www_form_component(v.to_s) unless k.nil? || v.nil? }.join("&") }
|
|
471
|
+
let(:checksum_param) { method.to_s + params_string + secret }
|
|
472
|
+
|
|
473
|
+
context "when @algorithm is false or nil" do
|
|
474
|
+
let(:checksum) { Digest::SHA1.hexdigest(checksum_param ) }
|
|
475
|
+
|
|
476
|
+
subject { api.get_url(:join, params)[0] }
|
|
477
|
+
it('uses SHA1') { subject.should match(/checksum=#{checksum}$/) }
|
|
478
|
+
end
|
|
479
|
+
|
|
480
|
+
context "when @algorithm is is set to 'sha1'" do
|
|
481
|
+
let(:api) { BigBlueButton::BigBlueButtonApi.new(url, secret, version, logger, "sha1") }
|
|
482
|
+
let(:checksum) { Digest::SHA1.hexdigest(checksum_param ) }
|
|
483
|
+
|
|
478
484
|
subject { api.get_url(:join, params)[0] }
|
|
479
485
|
it('uses SHA1') { subject.should match(/checksum=#{checksum}$/) }
|
|
480
486
|
end
|
|
481
487
|
|
|
482
|
-
context "when @
|
|
488
|
+
context "when @algorithm flag is set to 'sha2'" do
|
|
489
|
+
let(:api) { BigBlueButton::BigBlueButtonApi.new(url, secret, version, logger, "sha2") }
|
|
490
|
+
let(:checksum) { Digest::SHA256.hexdigest(checksum_param ) }
|
|
491
|
+
|
|
492
|
+
subject { api.get_url(:join, params)[0] }
|
|
493
|
+
it('uses SHA256') { subject.should match(/checksum=#{checksum}$/) }
|
|
494
|
+
end
|
|
495
|
+
|
|
496
|
+
context "when @algorithm flag is set to 'sha256'" do
|
|
497
|
+
let(:api) { BigBlueButton::BigBlueButtonApi.new(url, secret, version, logger, "sha256") }
|
|
498
|
+
let(:checksum) { Digest::SHA256.hexdigest(checksum_param ) }
|
|
499
|
+
|
|
500
|
+
subject { api.get_url(:join, params)[0] }
|
|
501
|
+
it('uses SHA256') { subject.should match(/checksum=#{checksum}$/) }
|
|
502
|
+
end
|
|
503
|
+
|
|
504
|
+
context "when @algorithm flag is set to 'sha512'" do
|
|
505
|
+
let(:api) { BigBlueButton::BigBlueButtonApi.new(url, secret, version, logger, "sha512") }
|
|
506
|
+
let(:checksum) { Digest::SHA512.hexdigest(checksum_param ) }
|
|
507
|
+
|
|
508
|
+
subject { api.get_url(:join, params)[0] }
|
|
509
|
+
it('uses SHA256') { subject.should match(/checksum=#{checksum}$/) }
|
|
510
|
+
end
|
|
511
|
+
|
|
512
|
+
# Ensure legacy support
|
|
513
|
+
context "when @algorithm flag is true" do
|
|
483
514
|
let(:api) { BigBlueButton::BigBlueButtonApi.new(url, secret, version, logger, true) }
|
|
484
|
-
let(:
|
|
485
|
-
|
|
486
|
-
# the hash can be sorted differently depending on the ruby version
|
|
487
|
-
if params.map{ |k,v| k }.join =~ /^param1/
|
|
488
|
-
"0e7b1611809fad890a114dddae1a37fecf14c28971afc10ee3eac432da5b8b41"
|
|
489
|
-
else
|
|
490
|
-
"21bf2d24c27251c4b2b2f0d5dd4b966a2f16fbfc7882e102b44c6d67f728f0c8"
|
|
491
|
-
end
|
|
492
|
-
}
|
|
515
|
+
let(:checksum) { Digest::SHA256.hexdigest(checksum_param ) }
|
|
516
|
+
|
|
493
517
|
subject { api.get_url(:join, params)[0] }
|
|
494
518
|
it('uses SHA256') { subject.should match(/checksum=#{checksum}$/) }
|
|
495
519
|
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: 2.
|
|
4
|
+
version: 2.1.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: 2026-03-11 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: xml-simple
|