bigbluebutton-api-ruby 1.7.0 → 1.8.0

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
- SHA1:
3
- metadata.gz: 281b4e206ec398cc651d0525256a68dd048d3db3
4
- data.tar.gz: 4c6a8bddc03d8c5289926fab24d589442bc16095
2
+ SHA256:
3
+ metadata.gz: 25726eaedf0a5b63156a7786a793f27a419e349a177419fdaecb0e0aac0295d6
4
+ data.tar.gz: 6e8ec707b2f53e06ba21163d2f5d34766436e49f852991434d3aa787a4108deb
5
5
  SHA512:
6
- metadata.gz: 2a2105c7f2d8f6b03a82e0f2bc42052f932e75de76318bcb7885d72e75b492696bd279dbc33e6bc537d37ed2a18e7d444e34ec4b2abe58d2e7e73421b4061164
7
- data.tar.gz: 130aa32c3945507d661ef188dd158f545a0755be304ee3b1a55cdfc1bcd57ef168f41b5fd9e5a5488f62bf0b636566a6347ff85708dc32e35d2e3c87a8241bc3
6
+ metadata.gz: 810382ae7b2f54be6ac766e10db46a61f76a4120c84bb1a99600012266db562da53149d7ee0bde1c7a2b3939542398556a7faa85dd24153c669f04875ac90213
7
+ data.tar.gz: 229132ef71db18f0a972daefb0b5b0ad49c53c63655877923323a163f99d15b383d4f0ac7344ebba61a6b5961f3a08abc2dc50a9ef217d4eccf0fcbfc2fdc527
data/.gitignore CHANGED
@@ -5,4 +5,5 @@ features/config.yml
5
5
  logs/bbb.log
6
6
  rdoc/
7
7
  logs/*
8
- .bundle/
8
+ .bundle/
9
+ .volumes/
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.2.0
1
+ 2.6.5
data/CHANGELOG.md CHANGED
@@ -1,13 +1,26 @@
1
1
  # Change Log
2
2
 
3
-
4
- ------------------------------------
5
-
6
- All tickets below use references to IDs in our old issue tracking system.
7
- To find them, search for their description or ID in the new issue tracker.
8
-
9
- ------------------------------------
10
-
3
+ ## [1.8.0] - 2021-12-06
4
+ * [#43] Add keys to every `BigBlueButtonException`, to better identify them.
5
+ * [#42] Change `BigBlueButtonException` to inherit from `StandardError` instead of `Exception`.
6
+ * [#50] [BREAKING-CHANGE] Replace `debug` flag with a optional Logger. The application using the
7
+ gem can pass its own logger as argument for the `BigBlueButtonApi` initialization.
8
+ If none is passed, the gem will use its own default logger on `STDOUT` with `INFO` level.
9
+ * [#40] Fix issue preventing documents from being preuploaded using the create call.
10
+ * Fix parse of recordings with invalid times. It would break at `getRecordings` if one
11
+ of them had an empty `startTime` or `endTime`.
12
+ * Add a Dockerfile and compose to help run tests.
13
+ * Fix deprecated `TimeoutError` constant.
14
+ * [#35] Make `get_recordings` accept multiple `state` params.
15
+ * [#34] Update `rubyzip` gem to the newest version with no vulnerability, from 1.2.2 to 1.3.0
16
+ * [#33] Upgrade dependencies:
17
+ - `childprocess` from 0.3.2 to 1.0.1
18
+ - `ffi` from 1.0.11 to 1.9.24
19
+ - `json` from 1.8.3 to 1.8.6
20
+ - `nokogiri` from 1.6.6.2 to 1.10.4
21
+ - `rack` from 1.4.1 to 1.6.11
22
+ - `rdoc` from 3.12 to 3.12.1
23
+ - `rubyzip` from 0.9.8 to 1.2.2
11
24
 
12
25
  ## [1.7.0] - 2018-08-17
13
26
 
@@ -153,6 +166,19 @@ were different in cases when they were not.
153
166
  (instead of browser URL). This call currently does not work as
154
167
  documented.
155
168
 
169
+ <!-- PRs -->
170
+ [#50]: https://github.com/mconf/bigbluebutton-api-ruby/pull/50
171
+ [#43]: https://github.com/mconf/bigbluebutton-api-ruby/pull/43
172
+ [#42]: https://github.com/mconf/bigbluebutton-api-ruby/pull/42
173
+ [#40]: https://github.com/mconf/bigbluebutton-api-ruby/pull/40
174
+ [#35]: https://github.com/mconf/bigbluebutton-api-ruby/pull/35
175
+ [#34]: https://github.com/mconf/bigbluebutton-api-ruby/pull/34
176
+ [#33]: https://github.com/mconf/bigbluebutton-api-ruby/pull/33
177
+ [#31]: https://github.com/mconf/bigbluebutton-api-ruby/pull/31
178
+ [#29]: https://github.com/mconf/bigbluebutton-api-ruby/pull/29
179
+
180
+ <!-- Versions -->
181
+ [1.8.0]: https://github.com/mconf/bigbluebutton-api-ruby/compare/v1.7.0...v1.8.0
156
182
  [1.7.0]: https://github.com/mconf/bigbluebutton-api-ruby/compare/v1.6.0...v1.7.0
157
183
  [1.6.0]: https://github.com/mconf/bigbluebutton-api-ruby/compare/v1.5.0...v1.6.0
158
184
  [1.5.0]: https://github.com/mconf/bigbluebutton-api-ruby/compare/v1.4.0...v1.5.0
data/Dockerfile ADDED
@@ -0,0 +1,13 @@
1
+ FROM ruby:2.6.5
2
+
3
+ ENV app /usr/src/app
4
+
5
+ # Create app directory
6
+ RUN mkdir -p $app
7
+ WORKDIR $app
8
+
9
+ # Bundle app source
10
+ COPY . $app
11
+
12
+ # Install app dependencies
13
+ RUN bundle install
data/Gemfile CHANGED
@@ -4,7 +4,7 @@ gemspec
4
4
 
5
5
  group :developement do
6
6
  gem 'rake', '>= 0.9'
7
- gem 'rdoc'
7
+ gem 'rdoc', '3.12.1'
8
8
  end
9
9
 
10
10
  group :development, :test do
data/Gemfile.lock CHANGED
@@ -7,7 +7,13 @@ GIT
7
7
  PATH
8
8
  remote: .
9
9
  specs:
10
- bigbluebutton-api-ruby (1.7.0)
10
+ bigbluebutton-api-ruby (1.8.0)
11
+ childprocess (>= 1.0.1)
12
+ ffi (>= 1.9.24)
13
+ json (>= 1.8.6)
14
+ nokogiri (>= 1.10.4)
15
+ rack (>= 1.6.11)
16
+ rubyzip (>= 1.3.0)
11
17
  xml-simple (~> 1.1)
12
18
 
13
19
  GEM
@@ -22,8 +28,8 @@ GEM
22
28
  rack-test (>= 0.5.4)
23
29
  selenium-webdriver (~> 2.0)
24
30
  xpath (~> 0.1.4)
25
- childprocess (0.3.2)
26
- ffi (~> 1.0.6)
31
+ childprocess (1.0.1)
32
+ rake (< 13.0)
27
33
  cucumber (1.1.9)
28
34
  builder (>= 2.1.2)
29
35
  diff-lcs (>= 1.1.2)
@@ -35,24 +41,25 @@ GEM
35
41
  cucumber (>= 1.1.8)
36
42
  nokogiri (>= 1.5.0)
37
43
  diff-lcs (1.1.3)
38
- ffi (1.0.11)
44
+ ffi (1.9.24)
39
45
  forgery (0.5.0)
40
46
  gherkin (2.9.3)
41
47
  json (>= 1.4.6)
42
- json (1.8.3)
48
+ json (1.8.6)
43
49
  libwebsocket (0.1.3)
44
50
  addressable
45
51
  mime-types (1.18)
46
- mini_portile (0.6.2)
52
+ mini_portile2 (2.4.0)
47
53
  multi_json (1.3.4)
48
- nokogiri (1.6.6.2)
49
- mini_portile (~> 0.6.0)
50
- rack (1.4.1)
54
+ nokogiri (1.10.4)
55
+ mini_portile2 (~> 2.4.0)
56
+ rack (1.6.11)
51
57
  rack-test (0.6.1)
52
58
  rack (>= 1.0)
53
59
  rake (0.9.2.2)
54
- rdoc (3.12)
60
+ rdoc (3.12.1)
55
61
  json (~> 1.4)
62
+ rexml (3.2.5)
56
63
  rspec (2.10.0)
57
64
  rspec-core (~> 2.10.0)
58
65
  rspec-expectations (~> 2.10.0)
@@ -61,7 +68,7 @@ GEM
61
68
  rspec-expectations (2.10.0)
62
69
  diff-lcs (~> 1.1.3)
63
70
  rspec-mocks (2.10.0)
64
- rubyzip (0.9.8)
71
+ rubyzip (1.3.0)
65
72
  selenium-webdriver (2.21.2)
66
73
  childprocess (>= 0.2.5)
67
74
  ffi (~> 1.0)
@@ -69,7 +76,8 @@ GEM
69
76
  multi_json (~> 1.0)
70
77
  rubyzip
71
78
  term-ansicolor (1.0.7)
72
- xml-simple (1.1.5)
79
+ xml-simple (1.1.9)
80
+ rexml
73
81
  xpath (0.1.4)
74
82
  nokogiri (~> 1.3)
75
83
 
@@ -82,5 +90,8 @@ DEPENDENCIES
82
90
  cucumber-rails
83
91
  forgery
84
92
  rake (>= 0.9)
85
- rdoc
93
+ rdoc (= 3.12.1)
86
94
  rspec (~> 2.10)
95
+
96
+ BUNDLED WITH
97
+ 1.17.3
@@ -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.7.0"
5
+ s.version = "1.8.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"
@@ -14,5 +14,11 @@ Gem::Specification.new do |s|
14
14
  s.files = `git ls-files`.split("\n")
15
15
  s.require_paths = ["lib"]
16
16
 
17
- s.add_runtime_dependency("xml-simple", "~> 1.1")
17
+ s.add_runtime_dependency('childprocess', '>= 1.0.1')
18
+ s.add_runtime_dependency('ffi', '>= 1.9.24')
19
+ s.add_runtime_dependency('json', '>= 1.8.6')
20
+ s.add_runtime_dependency('nokogiri', '>= 1.10.4')
21
+ s.add_runtime_dependency('rack', '>= 1.6.11')
22
+ s.add_runtime_dependency('rubyzip', '>= 1.3.0')
23
+ s.add_runtime_dependency('xml-simple', '~> 1.1')
18
24
  end
@@ -0,0 +1,10 @@
1
+ version: '2'
2
+ services:
3
+
4
+ test:
5
+ build: .
6
+ tty: true
7
+ volumes:
8
+ - $PWD:/usr/src/app
9
+ - .volumes/bundle/:/usr/local/bundle
10
+ command: bundle exec rake
@@ -1,4 +1,4 @@
1
- debug: false
1
+ logger: nil
2
2
 
3
3
  # maximum wait for a response to any API request (secs)
4
4
  timeout_req: 60
@@ -4,7 +4,7 @@ When /^the default BigBlueButton server$/ do
4
4
  @api = BigBlueButton::BigBlueButtonApi.new(@config_server['url'],
5
5
  @config_server['secret'],
6
6
  @config_server['version'].to_s,
7
- @config['debug'])
7
+ @config['logger'])
8
8
  @api.timeout = @config['timeout_req']
9
9
  end
10
10
 
@@ -9,6 +9,7 @@ require 'bigbluebutton_formatter'
9
9
  require 'bigbluebutton_modules'
10
10
  require 'bigbluebutton_config_xml'
11
11
  require 'bigbluebutton_config_layout'
12
+ require 'logger'
12
13
 
13
14
  module BigBlueButton
14
15
 
@@ -50,8 +51,8 @@ module BigBlueButton
50
51
  # API version e.g. 0.81
51
52
  attr_accessor :version
52
53
 
53
- # Flag to turn on/off debug mode
54
- attr_accessor :debug
54
+ # logger to log reponses and infos
55
+ attr_accessor :logger
55
56
 
56
57
  # Maximum wait time for HTTP requests (secs)
57
58
  attr_accessor :timeout
@@ -67,21 +68,25 @@ module BigBlueButton
67
68
  # url:: URL to a BigBlueButton server (e.g. http://demo.bigbluebutton.org/bigbluebutton/api)
68
69
  # secret:: Shared secret for this server
69
70
  # version:: API version e.g. 0.81
70
- def initialize(url, secret, version=nil, debug=false)
71
+ def initialize(url, secret, version=nil, logger=nil)
71
72
  @supported_versions = ['0.8', '0.81', '0.9', '1.0']
72
73
  @url = url
73
74
  @secret = secret
74
- @debug = debug
75
75
  @timeout = 10 # default timeout for api requests
76
76
  @request_headers = {} # http headers sent in all requests
77
-
77
+ @logger = logger
78
+ if logger.nil?
79
+ @logger = Logger.new(STDOUT)
80
+ @logger.level = Logger::INFO
81
+ end
82
+
78
83
  version = nil if version && version.strip.empty?
79
84
  @version = nearest_version(version || get_api_version)
80
85
  unless @supported_versions.include?(@version)
81
- puts "BigBlueButtonAPI: detected unsupported version, using the closest one that is supported (#{@version})"
86
+ @logger.warn("BigBlueButtonAPI: detected unsupported version, using the closest one that is supported (#{@version})")
82
87
  end
83
88
 
84
- puts "BigBlueButtonAPI: Using version #{@version}" if @debug
89
+ @logger.debug("BigBlueButtonAPI: Using version #{@version}")
85
90
  end
86
91
 
87
92
  # Creates a new meeting. Returns the hash with the response or throws BigBlueButtonException
@@ -461,6 +466,10 @@ module BigBlueButton
461
466
  options[:meetingID] = options[:meetingID].join(",") if options[:meetingID].instance_of?(Array)
462
467
  end
463
468
 
469
+ if options.has_key?(:state)
470
+ options[:state] = options[:state].join(",") if options[:state].instance_of?(Array)
471
+ end
472
+
464
473
  response = send_api_request(:getRecordings, options)
465
474
 
466
475
  formatter = BigBlueButtonFormatter.new(response)
@@ -632,7 +641,7 @@ module BigBlueButton
632
641
  # API's are equal if all the following attributes are equal.
633
642
  def ==(other)
634
643
  r = true
635
- [:url, :supported_versions, :secret, :version, :debug].each do |param|
644
+ [:url, :supported_versions, :secret, :version, :logger].each do |param|
636
645
  r = r && self.send(param) == other.send(param)
637
646
  end
638
647
  r
@@ -739,7 +748,7 @@ module BigBlueButton
739
748
  # Otherwise uses GET
740
749
  def send_request(url, data=nil)
741
750
  begin
742
- puts "BigBlueButtonAPI: URL request = #{url}" if @debug
751
+ @logger.debug("BigBlueButtonAPI: URL request = #{url}")
743
752
  url_parsed = URI.parse(url)
744
753
  http = Net::HTTP.new(url_parsed.host, url_parsed.port)
745
754
  http.open_timeout = @timeout
@@ -749,17 +758,22 @@ module BigBlueButton
749
758
  if data.nil?
750
759
  response = http.get(url_parsed.request_uri, @request_headers)
751
760
  else
752
- puts "BigBlueButtonAPI: Sending as a POST request with data.size = #{data.size}" if @debug
753
- opts = { 'Content-Type' => 'application/x-www-form-urlencoded' }.merge @request_headers
761
+ @logger.debug("BigBlueButtonAPI: Sending as a POST request with data.size = #{data.size}")
762
+ opts = { 'Content-Type' => 'application/xml' }.merge @request_headers
754
763
  response = http.post(url_parsed.request_uri, data, opts)
755
764
  end
756
- puts "BigBlueButtonAPI: URL response = #{response.body}" if @debug
765
+ @logger.info("BigBlueButtonAPI: request=#{url} response_status=#{response.class.name} response_code=#{response.code} message_key=#{response.message}")
766
+ @logger.debug("BigBlueButtonAPI: URL response = #{response.body}")
757
767
 
758
- rescue TimeoutError => error
759
- raise BigBlueButtonException.new("Timeout error. Your server is probably down: \"#{@url}\". Error: #{error}")
768
+ rescue Timeout::Error => error
769
+ exception = BigBlueButtonException.new("Timeout error. Your server is probably down: \"#{@url}\". Error: #{error}")
770
+ exception.key = 'TimeoutError'
771
+ raise exception
760
772
 
761
773
  rescue Exception => error
762
- raise BigBlueButtonException.new("Connection error. Your URL is probably incorrect: \"#{@url}\". Error: #{error}")
774
+ exception = BigBlueButtonException.new("Connection error. Your URL is probably incorrect: \"#{@url}\". Error: #{error}")
775
+ exception.key = 'IncorrectUrlError'
776
+ raise exception
763
777
  end
764
778
 
765
779
  response
@@ -775,7 +789,9 @@ module BigBlueButton
775
789
 
776
790
  # we don't allow older versions than the one supported, use an old version of the gem for that
777
791
  if Gem::Version.new(version) < Gem::Version.new(@supported_versions[0])
778
- raise BigBlueButtonException.new("BigBlueButton error: Invalid API version #{version}. Supported versions: #{@supported_versions.join(', ')}")
792
+ exception = BigBlueButtonException.new("BigBlueButton error: Invalid API version #{version}. Supported versions: #{@supported_versions.join(', ')}")
793
+ exception.key = 'APIVersionError'
794
+ raise exception
779
795
 
780
796
  # allow newer versions by using the newest one we support
781
797
  elsif Gem::Version.new(version) > Gem::Version.new(@supported_versions.last)
@@ -29,7 +29,9 @@ module BigBlueButton
29
29
  begin
30
30
  @xml = XmlSimple.xml_in(xml, opts)
31
31
  rescue Exception => e
32
- raise BigBlueButton::BigBlueButtonException.new("Error parsing the layouts XML. Error: #{e.message}")
32
+ exception = BigBlueButton::BigBlueButtonException.new("Error parsing the layouts XML. Error: #{e.message}")
33
+ exception.key = 'XMLParsingError'
34
+ raise exception
33
35
  end
34
36
  end
35
37
 
@@ -33,7 +33,9 @@ module BigBlueButton
33
33
  @xml = XmlSimple.xml_in(xml, opts)
34
34
  @original_string = self.as_string.clone
35
35
  rescue Exception => e
36
- raise BigBlueButton::BigBlueButtonException.new("Error parsing the config XML. Error: #{e.message}")
36
+ exception = BigBlueButton::BigBlueButtonException.new("Error parsing the config XML. Error: #{e.message}")
37
+ exception.key = 'XMLParsingError'
38
+ raise exception
37
39
  end
38
40
  end
39
41
  end
@@ -1,6 +1,6 @@
1
1
  module BigBlueButton
2
2
 
3
- class BigBlueButtonException < Exception
3
+ class BigBlueButtonException < StandardError
4
4
  attr_accessor :key
5
5
 
6
6
  def to_s
@@ -49,7 +49,9 @@ module BigBlueButton
49
49
  if value.is_a?(Numeric)
50
50
  result = value == 0 ? nil : DateTime.parse(Time.at(value/1000.0).to_s)
51
51
  else
52
- if value.downcase == "null"
52
+ if (value.is_a?(Hash) || value.is_a?(Array)) && value.empty?
53
+ result = nil
54
+ elsif value.is_a?(String) && (value.empty? || value.downcase == 'null')
53
55
  result = nil
54
56
  else
55
57
  # note: just in case the value comes as a string in the format: "Thu Sep 01 17:51:42 UTC 2011"
@@ -10,7 +10,9 @@ module BigBlueButton
10
10
  hash = XmlSimple.xml_in(xml_io, opts)
11
11
  return symbolize_keys(hash)
12
12
  rescue Exception => e
13
- raise BigBlueButtonException.new("Impossible to convert XML to hash. Error: #{e.message}")
13
+ exception = BigBlueButtonException.new("Impossible to convert XML to hash. Error: #{e.message}")
14
+ exception.key = 'XMLConversionError'
15
+ raise exception
14
16
  end
15
17
  end
16
18
 
@@ -7,8 +7,7 @@ describe BigBlueButton::BigBlueButtonApi do
7
7
  let(:url) { "http://server.com" }
8
8
  let(:secret) { "1234567890abcdefghijkl" }
9
9
  let(:version) { "0.81" }
10
- let(:debug) { false }
11
- let(:api) { BigBlueButton::BigBlueButtonApi.new(url, secret, version, debug) }
10
+ let(:api) { BigBlueButton::BigBlueButtonApi.new(url, secret, version) }
12
11
 
13
12
  describe "#get_default_config_xml" do
14
13
  let(:response) { "<response><returncode>1</returncode></response>" }
@@ -7,8 +7,7 @@ describe BigBlueButton::BigBlueButtonApi do
7
7
  let(:url) { "http://server.com" }
8
8
  let(:secret) { "1234567890abcdefghijkl" }
9
9
  let(:version) { "0.9" }
10
- let(:debug) { false }
11
- let(:api) { BigBlueButton::BigBlueButtonApi.new(url, secret, version, debug) }
10
+ let(:api) { BigBlueButton::BigBlueButtonApi.new(url, secret, version) }
12
11
 
13
12
  describe "#create_meeting" do
14
13
  context "accepts the new parameters" do
@@ -9,16 +9,17 @@ describe BigBlueButton::BigBlueButtonApi do
9
9
  # default variables and API object for all tests
10
10
  let(:url) { "http://server.com" }
11
11
  let(:secret) { "1234567890abcdefghijkl" }
12
- let(:debug) { false }
13
- let(:api) { BigBlueButton::BigBlueButtonApi.new(url, secret, version, debug) }
12
+ let(:logger) { Logger.new(STDOUT) }
13
+ let(:api) { BigBlueButton::BigBlueButtonApi.new(url, secret, version, logger) }
14
+ before { logger.level = Logger::INFO }
14
15
 
15
16
  describe "#initialize" do
16
17
  context "standard initialization" do
17
- subject { BigBlueButton::BigBlueButtonApi.new(url, secret, version, debug) }
18
+ subject { BigBlueButton::BigBlueButtonApi.new(url, secret, version, logger) }
18
19
  it { subject.url.should == url }
19
20
  it { subject.secret.should == secret }
20
21
  it { subject.version.should == version }
21
- it { subject.debug.should == debug }
22
+ it { subject.logger.should == logger }
22
23
  it { subject.timeout.should == 10 }
23
24
  it { subject.supported_versions.should include("0.8") }
24
25
  it { subject.supported_versions.should include("0.81") }
@@ -350,14 +351,14 @@ describe BigBlueButton::BigBlueButtonApi do
350
351
  end
351
352
 
352
353
  describe "#==" do
353
- let(:api2) { BigBlueButton::BigBlueButtonApi.new(url, secret, version, debug) }
354
+ let(:api2) { BigBlueButton::BigBlueButtonApi.new(url, secret, version, logger) }
354
355
 
355
356
  context "compares attributes" do
356
357
  it { api.should == api2 }
357
358
  end
358
359
 
359
- context "differs #debug" do
360
- before { api2.debug = !api.debug }
360
+ context "differs #logger" do
361
+ before { api2.logger = !api.logger }
361
362
  it { api.should_not == api2 }
362
363
  end
363
364
 
@@ -559,17 +560,19 @@ describe BigBlueButton::BigBlueButtonApi do
559
560
  describe "#send_request" do
560
561
  let(:url) { "http://test-server:8080/res?param1=value1&checksum=12345" }
561
562
  let(:url_parsed) { URI.parse(url) }
563
+ let(:res) { Net::HTTPResponse.new(1.0, '200', 'OK') }
562
564
 
563
565
  before do
564
566
  @http_mock = mock(Net::HTTP)
565
567
  @http_mock.should_receive(:"open_timeout=").with(api.timeout)
566
568
  @http_mock.should_receive(:"read_timeout=").with(api.timeout)
567
569
  Net::HTTP.should_receive(:new).with("test-server", 8080).and_return(@http_mock)
570
+ res.stub(:body) { "ok" }
568
571
  end
569
572
 
570
573
  context "standard case" do
571
- before { @http_mock.should_receive(:get).with("/res?param1=value1&checksum=12345", {}).and_return("ok") }
572
- it { api.send(:send_request, url).should == "ok" }
574
+ before { @http_mock.should_receive(:get).with("/res?param1=value1&checksum=12345", {}).and_return(res) }
575
+ it { api.send(:send_request, url).should == res }
573
576
  end
574
577
 
575
578
  context "handles a TimeoutError" do
@@ -586,20 +589,20 @@ describe BigBlueButton::BigBlueButtonApi do
586
589
  let(:data) { "any data" }
587
590
  before {
588
591
  path = "/res?param1=value1&checksum=12345"
589
- opts = { 'Content-Type' => 'application/x-www-form-urlencoded' }
590
- @http_mock.should_receive(:post).with(path, data, opts).and_return("ok")
592
+ opts = { 'Content-Type' => 'application/xml' }
593
+ @http_mock.should_receive(:post).with(path, data, opts).and_return(res)
591
594
  }
592
595
  it {
593
- api.send(:send_request, url, data).should == "ok"
596
+ api.send(:send_request, url, data).should == res
594
597
  }
595
598
  end
596
599
 
597
600
  context "get with headers" do
598
601
  let(:headers_hash) { { :anything => "anything" } }
599
- before { @http_mock.should_receive(:get).with("/res?param1=value1&checksum=12345", headers_hash).and_return("ok") }
602
+ before { @http_mock.should_receive(:get).with("/res?param1=value1&checksum=12345", headers_hash).and_return(res) }
600
603
  it {
601
604
  api.request_headers = headers_hash
602
- api.send(:send_request, url).should == "ok"
605
+ api.send(:send_request, url).should == res
603
606
  }
604
607
  end
605
608
 
@@ -608,12 +611,12 @@ describe BigBlueButton::BigBlueButtonApi do
608
611
  let(:data) { "any data" }
609
612
  before {
610
613
  path = "/res?param1=value1&checksum=12345"
611
- opts = { 'Content-Type' => 'application/x-www-form-urlencoded', :anything => "anything" }
612
- @http_mock.should_receive(:post).with(path, data, opts).and_return("ok")
614
+ opts = { 'Content-Type' => 'application/xml', :anything => "anything" }
615
+ @http_mock.should_receive(:post).with(path, data, opts).and_return(res)
613
616
  }
614
617
  it {
615
618
  api.request_headers = headers_hash
616
- api.send(:send_request, url, data).should == "ok"
619
+ api.send(:send_request, url, data).should == res
617
620
  }
618
621
  end
619
622
  end
@@ -100,14 +100,43 @@ describe BigBlueButton::BigBlueButtonFormatter do
100
100
  it { hash[:param7].should == nil }
101
101
  it { hash[:param8].should == nil }
102
102
 
103
- context "returns nil if the param doesn't exists" do
104
- subject { BigBlueButton::BigBlueButtonFormatter.new({ :param => 1}) }
105
- it { subject.to_datetime(:inexistent).should == nil }
106
- end
103
+ context "returns nil if" do
104
+ context "the param doesn't exists" do
105
+ subject { BigBlueButton::BigBlueButtonFormatter.new({ :param => 1}) }
106
+ it { subject.to_datetime(:inexistent).should == nil }
107
+ end
107
108
 
108
- context "returns nil if the hash is nil" do
109
- subject { BigBlueButton::BigBlueButtonFormatter.new(nil) }
110
- it { subject.to_datetime(:inexistent).should == nil }
109
+ context "the hash is nil" do
110
+ subject { BigBlueButton::BigBlueButtonFormatter.new(nil) }
111
+ it { subject.to_datetime(:inexistent).should == nil }
112
+ end
113
+
114
+ context "the value is an empty string" do
115
+ subject { BigBlueButton::BigBlueButtonFormatter.new({ param1: '' }) }
116
+ it { subject.to_datetime(:param1).should == nil }
117
+ end
118
+
119
+ context "the value is nil" do
120
+ subject { BigBlueButton::BigBlueButtonFormatter.new({ param1: nil }) }
121
+ it { subject.to_datetime(:param1).should == nil }
122
+ end
123
+
124
+ context "the value is an empty hash" do
125
+ subject { BigBlueButton::BigBlueButtonFormatter.new({ param1: {} }) }
126
+ it { subject.to_datetime(:param1).should == nil }
127
+ end
128
+
129
+ context "the value is an empty array" do
130
+ subject { BigBlueButton::BigBlueButtonFormatter.new({ param1: [] }) }
131
+ it { subject.to_datetime(:param1).should == nil }
132
+ end
133
+
134
+ ['null', 'NULL'].each do |v|
135
+ context "the value is '#{v}'" do
136
+ subject { BigBlueButton::BigBlueButtonFormatter.new({ param1: v }) }
137
+ it { subject.to_datetime(:param1).should == nil }
138
+ end
139
+ end
111
140
  end
112
141
  end
113
142
 
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.7.0
4
+ version: 1.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mconf
@@ -9,8 +9,92 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-08-17 00:00:00.000000000 Z
12
+ date: 2021-12-06 00:00:00.000000000 Z
13
13
  dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: childprocess
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ">="
19
+ - !ruby/object:Gem::Version
20
+ version: 1.0.1
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ version: 1.0.1
28
+ - !ruby/object:Gem::Dependency
29
+ name: ffi
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: 1.9.24
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: 1.9.24
42
+ - !ruby/object:Gem::Dependency
43
+ name: json
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: 1.8.6
49
+ type: :runtime
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: 1.8.6
56
+ - !ruby/object:Gem::Dependency
57
+ name: nokogiri
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: 1.10.4
63
+ type: :runtime
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: 1.10.4
70
+ - !ruby/object:Gem::Dependency
71
+ name: rack
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: 1.6.11
77
+ type: :runtime
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: 1.6.11
84
+ - !ruby/object:Gem::Dependency
85
+ name: rubyzip
86
+ requirement: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: 1.3.0
91
+ type: :runtime
92
+ prerelease: false
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: 1.3.0
14
98
  - !ruby/object:Gem::Dependency
15
99
  name: xml-simple
16
100
  requirement: !ruby/object:Gem::Requirement
@@ -43,6 +127,7 @@ files:
43
127
  - ".ruby-version"
44
128
  - ".travis.yml"
45
129
  - CHANGELOG.md
130
+ - Dockerfile
46
131
  - Gemfile
47
132
  - Gemfile.lock
48
133
  - LICENSE
@@ -50,6 +135,7 @@ files:
50
135
  - README.md
51
136
  - Rakefile
52
137
  - bigbluebutton-api-ruby.gemspec
138
+ - docker-compose.yml
53
139
  - examples/config_xml.rb
54
140
  - examples/create.rb
55
141
  - examples/get_version_example.rb
@@ -113,8 +199,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
113
199
  - !ruby/object:Gem::Version
114
200
  version: '0'
115
201
  requirements: []
116
- rubyforge_project:
117
- rubygems_version: 2.4.5
202
+ rubygems_version: 3.0.3
118
203
  signing_key:
119
204
  specification_version: 4
120
205
  summary: BigBlueButton integration for ruby