bigbluebutton-api-ruby 1.8.0 → 1.9.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 25726eaedf0a5b63156a7786a793f27a419e349a177419fdaecb0e0aac0295d6
4
- data.tar.gz: 6e8ec707b2f53e06ba21163d2f5d34766436e49f852991434d3aa787a4108deb
3
+ metadata.gz: 895a139be87984c857d275c4d7df9268b06684da8afa4e645cbbdb89d52506f3
4
+ data.tar.gz: bc4c39bc4f9b9dd2e9985e2f70063df489ef0e43b46a43399550f0aa5a75cecc
5
5
  SHA512:
6
- metadata.gz: 810382ae7b2f54be6ac766e10db46a61f76a4120c84bb1a99600012266db562da53149d7ee0bde1c7a2b3939542398556a7faa85dd24153c669f04875ac90213
7
- data.tar.gz: 229132ef71db18f0a972daefb0b5b0ad49c53c63655877923323a163f99d15b383d4f0ac7344ebba61a6b5961f3a08abc2dc50a9ef217d4eccf0fcbfc2fdc527
6
+ metadata.gz: 30fc3a5fb527ffdfd58c9690075665e8a54b9385a184214b6d50da43ed3b5963b203b147426b02bcbe7644dfca65ca73ad30d831d7c2c8ad766d7aaa930c1fa6
7
+ data.tar.gz: 940781ee78ee9c962be935eff1c8d66b971c5658467dd92c827291b581a38a17badcfe4381a8e58bd1157176191a54f59d895fe197f1e6ca5399d9635d354067
@@ -0,0 +1,22 @@
1
+ name: Publish gem on tag push
2
+ on:
3
+ push:
4
+ tags:
5
+ - 'v*'
6
+ - '!v**-mconf*'
7
+ # Tags that will trigger: v1.9.0; v1.9.0-beta1
8
+ # Tags excluded (with the '!'): v1.9.0-mconf; v1.9.0-mconf-beta1
9
+
10
+ jobs:
11
+ publish-gem:
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - name: Checkout
15
+ uses: actions/checkout@v2
16
+ - name: Publish
17
+ uses: dawidd6/action-publish-gem@v1.2.0
18
+ with:
19
+ # Optional, will publish to RubyGems if specified
20
+ api_key: ${{secrets.RUBYGEMS_API_KEY}}
21
+ # Optional, will publish to GitHub Packages if specified
22
+ github_token: ${{secrets.GITHUB_TOKEN}}
data/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Change Log
2
2
 
3
+ ## [1.9.1] - 2023-03-31
4
+ * [#60] Prevent problems with double slashes on API calls [thanks to [@farhatahmad](https://github.com/farhatahmad)]
5
+
6
+ [#60]: https://github.com/mconf/bigbluebutton-api-ruby/pull/60
7
+ [1.9.1]: https://github.com/mconf/bigbluebutton-api-ruby/compare/v1.9.0...v1.9.1
8
+
9
+ ## [1.9.0] - 2022-05-03
10
+ * [#56] Add support for checksum using SHA256
11
+
12
+ [#56]: https://github.com/mconf/bigbluebutton-api-ruby/pull/56
13
+ [1.9.0]: https://github.com/mconf/bigbluebutton-api-ruby/compare/v1.8.0...v1.9.0
14
+
3
15
  ## [1.8.0] - 2021-12-06
4
16
  * [#43] Add keys to every `BigBlueButtonException`, to better identify them.
5
17
  * [#42] Change `BigBlueButtonException` to inherit from `StandardError` instead of `Exception`.
data/Gemfile.lock CHANGED
@@ -7,7 +7,7 @@ GIT
7
7
  PATH
8
8
  remote: .
9
9
  specs:
10
- bigbluebutton-api-ruby (1.8.0)
10
+ bigbluebutton-api-ruby (1.9.1)
11
11
  childprocess (>= 1.0.1)
12
12
  ffi (>= 1.9.24)
13
13
  json (>= 1.8.6)
@@ -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.8.0"
5
+ s.version = "1.9.1"
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"
@@ -2,6 +2,7 @@ require 'net/http'
2
2
  require 'cgi'
3
3
  require 'rexml/document'
4
4
  require 'digest/sha1'
5
+ require 'digest/sha2'
5
6
  require 'rubygems'
6
7
  require 'bigbluebutton_hash_to_xml'
7
8
  require 'bigbluebutton_exception'
@@ -68,13 +69,17 @@ module BigBlueButton
68
69
  # url:: URL to a BigBlueButton server (e.g. http://demo.bigbluebutton.org/bigbluebutton/api)
69
70
  # secret:: Shared secret for this server
70
71
  # version:: API version e.g. 0.81
71
- def initialize(url, secret, version=nil, logger=nil)
72
+ # logger:: Logger object to log actions (so apps can use their own loggers)
73
+ # sha256:: Flag to use sha256 when hashing url contents for checksum
74
+ def initialize(url, secret, version=nil, logger=nil, sha256=false)
72
75
  @supported_versions = ['0.8', '0.81', '0.9', '1.0']
73
- @url = url
76
+ @url = url.chomp('/')
74
77
  @secret = secret
75
78
  @timeout = 10 # default timeout for api requests
76
79
  @request_headers = {} # http headers sent in all requests
77
80
  @logger = logger
81
+ @sha256 = sha256
82
+ # If logger is not informed, it defaults to STDOUT with INFO level
78
83
  if logger.nil?
79
84
  @logger = Logger.new(STDOUT)
80
85
  @logger.level = Logger::INFO
@@ -680,7 +685,7 @@ module BigBlueButton
680
685
  # checksum calc
681
686
  checksum_param = params_string + @secret
682
687
  checksum_param = method.to_s + checksum_param
683
- checksum = Digest::SHA1.hexdigest(checksum_param)
688
+ checksum = @sha256 ? Digest::SHA256.hexdigest(checksum_param) : Digest::SHA1.hexdigest(checksum_param)
684
689
 
685
690
  if method == :setConfigXML
686
691
  params_string = "checksum=#{checksum}&#{params_string}"
@@ -474,17 +474,34 @@ describe BigBlueButton::BigBlueButtonApi do
474
474
  end
475
475
 
476
476
  context "includes the checksum" do
477
- let(:params) { { :param1 => "value1", :param2 => "value2" } }
478
- let(:checksum) {
479
- # the hash can be sorted differently depending on the ruby version
480
- if params.map{ |k,v| k }.join =~ /^param1/
481
- "67882ae54f49600f56f358c10d24697ef7d8c6b2"
482
- else
483
- "85a54e28e4ec18bfdcb214a73f74d35b09a84176"
484
- end
485
- }
486
- subject { api.get_url(:join, params)[0] }
487
- it { subject.should match(/checksum=#{checksum}$/) }
477
+ context "when @sha256 is false or nil" do
478
+ let(:params) { { param1: "value1", param2: "value2" } }
479
+ let(:checksum) {
480
+ # the hash can be sorted differently depending on the ruby version
481
+ if params.map{ |k, v| k }.join =~ /^param1/
482
+ "67882ae54f49600f56f358c10d24697ef7d8c6b2"
483
+ else
484
+ "85a54e28e4ec18bfdcb214a73f74d35b09a84176"
485
+ end
486
+ }
487
+ subject { api.get_url(:join, params)[0] }
488
+ it('uses SHA1') { subject.should match(/checksum=#{checksum}$/) }
489
+ end
490
+
491
+ context "when @sha256 flag is true" do
492
+ let(:api) { BigBlueButton::BigBlueButtonApi.new(url, secret, version, logger, true) }
493
+ let(:params) { { param1: "value1", param2: "value2" } }
494
+ let(:checksum) {
495
+ # the hash can be sorted differently depending on the ruby version
496
+ if params.map{ |k,v| k }.join =~ /^param1/
497
+ "0e7b1611809fad890a114dddae1a37fecf14c28971afc10ee3eac432da5b8b41"
498
+ else
499
+ "21bf2d24c27251c4b2b2f0d5dd4b966a2f16fbfc7882e102b44c6d67f728f0c8"
500
+ end
501
+ }
502
+ subject { api.get_url(:join, params)[0] }
503
+ it('uses SHA256') { subject.should match(/checksum=#{checksum}$/) }
504
+ end
488
505
  end
489
506
  end
490
507
  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.8.0
4
+ version: 1.9.1
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: 2021-12-06 00:00:00.000000000 Z
12
+ date: 2023-03-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: childprocess
@@ -122,6 +122,7 @@ extra_rdoc_files:
122
122
  - LICENSE_003
123
123
  - CHANGELOG.md
124
124
  files:
125
+ - ".github/workflows/publish-gem-on-tag-push.yml"
125
126
  - ".gitignore"
126
127
  - ".rspec"
127
128
  - ".ruby-version"
@@ -199,7 +200,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
199
200
  - !ruby/object:Gem::Version
200
201
  version: '0'
201
202
  requirements: []
202
- rubygems_version: 3.0.3
203
+ rubygems_version: 3.3.5
203
204
  signing_key:
204
205
  specification_version: 4
205
206
  summary: BigBlueButton integration for ruby