bigbluebutton-api-ruby 1.4.0 → 1.6.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e8411f3d08298b647a2fa645f80aa7aa5c06ae60
4
- data.tar.gz: 52acdabcf29a08606ff12125d7069210d05eaa72
3
+ metadata.gz: 473e9baacfe50dd02c2de2799d1f9ef36d7fa086
4
+ data.tar.gz: f8a35a9a314631bb3386382322fa2d5bee8c3a17
5
5
  SHA512:
6
- metadata.gz: a3f47f27947d7ae7e248bae4d5046bfcb6f1fb6e61302c595422574ca7f2b7a31fefc7950aaee8c3e5ff580172fb7dc8c7309a3c0c14e893b91d0ff429278a21
7
- data.tar.gz: 2069dc248ece7867760884d34e2d703258c91897527a9f317edb0c0b57adf1a9b201bde4a186302c1ad42453011a1aba27b28e3298ac45c906de04655886f6ef
6
+ metadata.gz: af669d4c0ea78a687001e1b0d1449da3a820f76c846ca3535942f2c56c86c1854cc3cd2d4d2614408b3cd1a3c233f2ef42683bd9bc9c7345cbeefd80dc4fbc99
7
+ data.tar.gz: 283b0c7fd0d864f7b674372c3f85887fd6b4d67eab6e7ba686abb1b4c017740b94289b2f84e1e20fe35d82efe2396f9b9c19704a751dab7c7130b9e7ed662f1b
data/.travis.yml CHANGED
@@ -1,5 +1,7 @@
1
+ sudo: false
1
2
  language: ruby
2
3
  script: "bundle exec rake spec"
4
+ cache: bundler
3
5
  rvm:
4
6
  - 2.2.0
5
7
  - 2.1.2
data/CHANGELOG.md ADDED
@@ -0,0 +1,157 @@
1
+ # Change Log
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
+
11
+
12
+ ## [1.5.0] - 2016-04-07
13
+
14
+ * Add 1.0 as a supported version of BigBlueButton.
15
+ * [#1686] Automatically set the version number of a server by fetching it from
16
+ its API.
17
+ * [#1686] Fix comparison of config.xml strings that would sometimes thing XMLs
18
+ were different in cases when they were not.
19
+ * [#1695] Add support for servers that use HTTPS.
20
+
21
+ ## [1.4.0] - 2015-07-20
22
+
23
+ * Updated default ruby version to 2.2.0.
24
+ * Add support for BigBlueButton 0.9 (includes all 0.9.x). Consists only in
25
+ accepting the version "0.9", since this new API version doesn't break
26
+ compatibility with the previous version and also doesn't add new API
27
+ calls.
28
+
29
+ ## [1.3.0] - 2014-05-11
30
+
31
+ * Drop support to BigBlueButton 0.7 and add BigBlueButton to 0.81. Includes
32
+ support to the new API calls `getDefaultConfigXML` and `setConfigXML`.
33
+ * Reviewed all methods responses (some changed a bit) and documentation.
34
+ * Allow non standard options to be passed to **all** API calls.
35
+ * Removed method `join_meeting` that was usually not used. Should always use
36
+ `join_meeting_url`.
37
+ * Moved the hash extension method `from_xml` to its own class to prevent
38
+ conflicts with Rails. See
39
+ https://github.com/mconf/bigbluebutton-api-ruby/pull/6.
40
+
41
+ ## [1.2.0] - 2013-03-13
42
+
43
+ * Allow non standard options to be passed to some API calls. These API calls are: create_meeting, join_meeting_url, join_meeting, get_recordings.
44
+ Useful for development of for custom versions of BigBlueButton.
45
+ * Accept :record as boolean in create_meeting
46
+ * Better formatting of data returned by get_recordings
47
+
48
+ ## [1.1.1] - 2013-01-30
49
+
50
+ * BigBlueButtonApi can now receive http headers to be sent in all get/post
51
+ requests
52
+
53
+ ## [1.1.0] - 2012-05-04
54
+
55
+ * Updated ruby to 1.9.3-194.
56
+ * Support to BigBlueButton 0.4 rc1.
57
+
58
+ ## [1.0.0] - 2012-05-04
59
+
60
+ * Version 0.1.0 renamed to 1.0.0.
61
+
62
+ ## [0.1.0] - 2011-11-25
63
+
64
+ * Support to BigBlueButton 0.8:
65
+ * New methods for recordings: get_recordings, publish_recordings,
66
+ delete_recordings
67
+ * Pre-upload of slides in create_meeting
68
+ * New parameters added in the already existent methods
69
+ * For more information see BigBlueButton docs at
70
+ http://code.google.com/p/bigbluebutton/wiki/API#Version_0.8
71
+ * Method signature changes: create_meeting, join_meeting_url and
72
+ join_meeting. Optional parameters are now passed using a hash.
73
+ * Integration tests for the entire library using cucumber.
74
+ * Changed the XML parser to xml-simple (especially to solve issues with
75
+ CDATA values).
76
+
77
+ ## [0.0.11] - 2011-09-01
78
+
79
+ * The file "bigbluebutton-api" was renamed to "bigbluebutton_api". All
80
+ "require" calls must be updated.
81
+ * Splitted the library in more files (more modular) and created rspec tests
82
+ for it.
83
+ * Added a BigBlueButtonApi.timeout attribute to timeout get requests and
84
+ avoid blocks when the server is down. Defaults to 2 secs.
85
+ * New method last_http_response to access the last HTTP response object.
86
+ * Automatically detects the BBB server version if not informed by the user.
87
+
88
+ ## [0.0.10] - 2011-04-28
89
+
90
+ * Returning hash now will **always** have these 3 values: :returncode
91
+ (boolean), :messageKey (string) and :message (string).
92
+ * Some values in the hash are now converted to a fixed variable type to
93
+ avoid inconsistencies:
94
+ * :meetingID (string)
95
+ * :attendeePW (string)
96
+ * :moderatorPW (string)
97
+ * :running (boolean)
98
+ * :hasBeenForciblyEnded (boolean)
99
+ * :endTime and :startTime (DateTime or nil)
100
+
101
+ ## [0.0.9] - 2011-04-08
102
+
103
+ * Simplied "attendees" part of the hash returned in get_meeting_info. Same
104
+ thing done for get_meetings.
105
+
106
+ ## [0.0.8] - 2011-04-06
107
+
108
+ * New method get_api_version that returns the version of the server API (>= 0.7).
109
+ * New simplified hash syntax for get_meetings. See docs for details.
110
+
111
+ ## [0.0.7] - 2011-04-06
112
+
113
+ ## [0.0.6] - 2011-04-05
114
+
115
+ * New method test_connection.
116
+ * Added comparison method for APIs.
117
+ * Methods attendee_url and moderator_url deprecated. Use join_meeting_url.
118
+ * Better exception throwing when the user is unreachable or the response is incorrect.
119
+ * BigBlueButtonException has now a "key" attribute to store the
120
+ "messageKey" returned by BBB in failures.
121
+
122
+ ## 0.0.4
123
+
124
+ * Added support for BigBlueButton 0.7.
125
+ * Gem renamed from 'bigbluebutton' to 'bigbluebutton-api-ruby'.
126
+ * API functions now return a hash and instead of the XML returned by BBB.
127
+ The XML is converted to a hash that uses symbols as keys and groups keys
128
+ with the same name.
129
+
130
+ ## 0.0.3
131
+
132
+ * Fixes module issue preventing proper throwing of exceptions.
133
+
134
+ ## 0.0.1
135
+
136
+ * This is the first version of this gem. It provides an implementation of
137
+ the 0.64 bbb API, with the following exceptions:
138
+ * Does not implement meeting token, and instead relies on meeting id as
139
+ the unique identifier for a meeting.
140
+ * Documentation suggests there is way to call join_meeting as API call
141
+ (instead of browser URL). This call currently does not work as
142
+ documented.
143
+
144
+ [1.5.0]: https://github.com/mconf/bigbluebutton-api-ruby/compare/v1.4.0...v1.5.0
145
+ [1.4.0]: https://github.com/mconf/bigbluebutton-api-ruby/compare/v1.3.0...v1.4.0
146
+ [1.3.0]: https://github.com/mconf/bigbluebutton-api-ruby/compare/v1.2.0...v1.3.0
147
+ [1.2.0]: https://github.com/mconf/bigbluebutton-api-ruby/compare/v1.1.1...v1.2.0
148
+ [1.1.1]: https://github.com/mconf/bigbluebutton-api-ruby/compare/v1.1.0...v1.1.1
149
+ [1.1.0]: https://github.com/mconf/bigbluebutton-api-ruby/compare/v1.0.0...v1.1.0
150
+ [1.0.0]: https://github.com/mconf/bigbluebutton-api-ruby/compare/v0.1.0...v1.0.0
151
+ [0.1.0]: https://github.com/mconf/bigbluebutton-api-ruby/compare/v0.0.11...v0.1.0
152
+ [0.0.11]: https://github.com/mconf/bigbluebutton-api-ruby/compare/v0.0.10...v0.0.11
153
+ [0.0.10]: https://github.com/mconf/bigbluebutton-api-ruby/compare/v0.0.9...v0.0.10
154
+ [0.0.9]: https://github.com/mconf/bigbluebutton-api-ruby/compare/v0.0.8...v0.0.9
155
+ [0.0.8]: https://github.com/mconf/bigbluebutton-api-ruby/compare/v0.0.7...v0.0.8
156
+ [0.0.7]: https://github.com/mconf/bigbluebutton-api-ruby/compare/v0.0.6...v0.0.7
157
+ [0.0.6]: https://github.com/mconf/bigbluebutton-api-ruby/compare/b586c4726d32e9c30139357bcbe2067f868ff36c...v0.0.6
data/Gemfile CHANGED
@@ -11,6 +11,6 @@ group :development, :test do
11
11
  gem 'rspec', '~> 2.10'
12
12
  gem 'cucumber-rails'
13
13
  gem 'forgery'
14
- gem 'bbbot-ruby', :git => 'git://github.com/mconf/bbbot-ruby.git'
14
+ gem 'bbbot-ruby', :git => 'https://github.com/mconf/bbbot-ruby.git'
15
15
  # gem 'rails_best_practices'
16
16
  end
data/Gemfile.lock CHANGED
@@ -1,5 +1,5 @@
1
1
  GIT
2
- remote: git://github.com/mconf/bbbot-ruby.git
2
+ remote: https://github.com/mconf/bbbot-ruby.git
3
3
  revision: fcfd8c4c71371653335a46d7462ee14a9301f546
4
4
  specs:
5
5
  bbbot-ruby (0.0.1)
@@ -7,8 +7,8 @@ GIT
7
7
  PATH
8
8
  remote: .
9
9
  specs:
10
- bigbluebutton-api-ruby (1.4.0)
11
- xml-simple (>= 1.1.1)
10
+ bigbluebutton-api-ruby (1.6.0)
11
+ xml-simple (~> 1.1)
12
12
 
13
13
  GEM
14
14
  remote: http://rubygems.org/
@@ -69,7 +69,7 @@ GEM
69
69
  multi_json (~> 1.0)
70
70
  rubyzip
71
71
  term-ansicolor (1.0.7)
72
- xml-simple (1.1.3)
72
+ xml-simple (1.1.5)
73
73
  xpath (0.1.4)
74
74
  nokogiri (~> 1.3)
75
75
 
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2011-2015 Mconf (http://mconf.org)
1
+ Copyright (c) 2011-2016 Mconf (http://mconf.org)
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy of
4
4
  this software and associated documentation files (the "Software"), to deal in
data/README.md ADDED
@@ -0,0 +1,96 @@
1
+ # bigbluebutton-api-ruby [<img src="http://travis-ci.org/mconf/bigbluebutton-api-ruby.png"/>](http://travis-ci.org/mconf/bigbluebutton-api-ruby)
2
+
3
+ This is a ruby gem that provides access to the API of
4
+ [BigBlueButton](http://bigbluebutton.org). See the documentation of the API
5
+ [here](http://code.google.com/p/bigbluebutton/wiki/API).
6
+
7
+ It enables a ruby application to interact with BigBlueButton by calling ruby
8
+ methods instead of HTTP requests, making it a lot easier to interact with
9
+ BigBlueButton. It also formats the responses to a ruby-friendly format and
10
+ includes helper classes to deal with more complicated API calls, such as the
11
+ pre-upload of slides.
12
+
13
+ A few features it has:
14
+
15
+ * Provides methods to perform all API calls and get the responses;
16
+ * Converts the XML responses to ruby hashes, that are easier to work with;
17
+ * Converts the string values returned to native ruby types. For instance:
18
+ * Dates are converted DateTime objects (e.g. "Thu Sep 01 17:51:42 UTC 2011");
19
+ * Response codes are converted to boolean (e.g. "SUCCESS" becomes `true`);
20
+ * Deals with errors (e.g. timeouts) throwing `BigBlueButtonException` exceptions;
21
+ * Support to multiple BigBlueButton API versions (see below).
22
+
23
+ ## Supported versions
24
+
25
+ This gem is mainly used with [Mconf-Web](https://github.com/mconf/mconf-web) through
26
+ [BigbluebuttonRails](https://github.com/mconf/bigbluebutton_rails).
27
+ You can always use it as a reference for verions of dependencies and examples of how
28
+ to use the gem.
29
+
30
+ ### BigBlueButton
31
+
32
+ The current version of this gem supports *all* the following versions of
33
+ BigBlueButton:
34
+
35
+ * 1.0
36
+ * 0.9 (includes all 0.9.x)
37
+ * 0.81
38
+ * 0.8
39
+
40
+ Older versions:
41
+
42
+ * 0.7 (including 0.7, 0.71 and 0.71a): The last version with support to 0.7*
43
+ is [version
44
+ 1.2.0](https://github.com/mconf/bigbluebutton-api-ruby/tree/v1.2.0). It
45
+ supports versions 0.7 and 0.8.
46
+ * 0.64: see the branch `api-0.64`. The last version with support to 0.64 is
47
+ [version
48
+ 0.0.10](https://github.com/mconf/bigbluebutton-api-ruby/tree/v0.0.10). It
49
+ supports versions 0.64 and 0.7.
50
+
51
+ ### Ruby
52
+
53
+ Tested in rubies:
54
+
55
+ * ruby-2.2 **recommended**
56
+ * ruby-2.1
57
+ * ruby-2.0 (p353)
58
+ * ruby-1.9.3 (p484)
59
+ * ruby-1.9.2 (p290)
60
+
61
+ Use these versions to be sure it will work. Other patches and patch versions of these
62
+ rubies (e.g. ruby 1.9.3-p194 or 2.1.2) should work as well.
63
+
64
+ ## Releases
65
+
66
+ For a list of releases and release notes see
67
+ [CHANGELOG.md](https://github.com/mconf/bigbluebutton-api-ruby/blob/master/CHANGELOG.md).
68
+
69
+ ## Development
70
+
71
+ Information for developers of `bigbluebutton-api-ruby` can be found in [our
72
+ wiki](https://github.com/mconf/bigbluebutton-api-ruby/wiki).
73
+
74
+ The development of this gem is guided by the requirements of the project
75
+ Mconf. To know more about it visit the [project's
76
+ wiki](https://github.com/mconf/wiki/wiki).
77
+
78
+ ## License
79
+
80
+ Distributed under The MIT License (MIT). See
81
+ [LICENSE](https://github.com/mconf/bigbluebutton-api-ruby/blob/master/LICENSE)
82
+ for the latest license, valid for all versions after 0.0.4 (including it), and
83
+ [LICENSE_003](https://github.com/mconf/bigbluebutton-api-ruby/blob/master/LICENSE_003)
84
+ for version 0.0.3 and all the previous versions.
85
+
86
+ ## Contact
87
+
88
+ This project is developed as part of Mconf (http://mconf.org).
89
+
90
+ Mailing list:
91
+ * mconf-dev@googlegroups.com
92
+
93
+ Contact:
94
+ * Mconf: A scalable opensource multiconference system for web and mobile devices
95
+ * PRAV Labs - UFRGS - Porto Alegre - Brazil
96
+ * http://www.inf.ufrgs.br/prav/gtmconf
data/Rakefile CHANGED
@@ -30,8 +30,8 @@ Cucumber::Rake::Task.new do |t|
30
30
  end
31
31
 
32
32
  RDoc::Task.new do |rdoc|
33
- rdoc.rdoc_files.include('README.rdoc', 'LICENSE', 'LICENSE_003', 'CHANGELOG.rdoc', 'lib/**/*.rb')
34
- rdoc.main = "README.rdoc"
33
+ rdoc.rdoc_files.include('README.md', 'LICENSE', 'LICENSE_003', 'CHANGELOG.md', 'lib/**/*.rb')
34
+ rdoc.main = "README.md"
35
35
  rdoc.title = "bigbluebutton-api-ruby Docs"
36
36
  rdoc.rdoc_dir = 'rdoc'
37
37
  end
@@ -1,18 +1,18 @@
1
1
  $:.push File.expand_path("../lib", __FILE__)
2
2
 
3
3
  Gem::Specification.new do |s|
4
- s.name = 'bigbluebutton-api-ruby'
5
- s.version = '1.4.0'
6
- s.licenses = ['MIT']
7
- s.extra_rdoc_files = ['README.rdoc', 'LICENSE', 'LICENSE_003', 'CHANGELOG.rdoc']
8
- s.summary = 'Provides an interface to the BigBlueButton web meeting API (https://github.com/mconf/bigbluebutton-api-ruby)'
9
- s.description = s.summary
10
- s.authors = ['Leonardo Crauss Daronco', 'Joe Kinsella']
11
- s.email = ['leonardodaronco@gmail.com', 'joe.kinsella@gmail.com']
4
+ s.name = "bigbluebutton-api-ruby"
5
+ s.version = "1.6.0"
6
+ s.licenses = ["MIT"]
7
+ s.extra_rdoc_files = ["README.md", "LICENSE", "LICENSE_003", "CHANGELOG.md"]
8
+ s.summary = "BigBlueButton integration for ruby"
9
+ s.description = "Provides methods to access BigBlueButton in a ruby application through its API"
10
+ s.authors = ["Mconf", "Leonardo Crauss Daronco"]
11
+ s.email = ["contact@mconf.org", "leonardodaronco@gmail.com"]
12
12
  s.homepage = "https://github.com/mconf/bigbluebutton-api-ruby/"
13
13
  s.bindir = "bin"
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.1')
17
+ s.add_runtime_dependency("xml-simple", "~> 1.1")
18
18
  end
@@ -7,11 +7,9 @@ require 'prepare'
7
7
  begin
8
8
  prepare
9
9
 
10
- @api = BigBlueButton::BigBlueButtonApi.new(@config['bbb_url'], @config['bbb_salt'], nil, true)
11
-
12
10
  puts
13
11
  puts "---------------------------------------------------"
14
- puts "The version of your BBB server is: #{@api.version}"
12
+ puts "The version of your BBB server is: #{@api.get_api_version}"
15
13
  rescue Exception => ex
16
14
  puts "Failed with error #{ex.message}"
17
15
  puts ex.backtrace
data/examples/prepare.rb CHANGED
@@ -34,5 +34,5 @@ def prepare
34
34
  puts server.inspect
35
35
  puts
36
36
 
37
- @api = BigBlueButton::BigBlueButtonApi.new(server['url'], server['salt'], server['version'].to_s, true)
37
+ @api = BigBlueButton::BigBlueButtonApi.new(server['url'], server['secret'], server['version'].to_s, true)
38
38
  end
@@ -10,11 +10,9 @@ timeout_ending: 30
10
10
  timeout_bot_start: 60
11
11
 
12
12
  servers:
13
- test-install-091:
14
- salt: '8cd8ef52e8e101574e400365b55e11a6'
13
+ test-install:
15
14
  url: 'http://test-install.blindsidenetworks.com/bigbluebutton/api'
16
- version: '0.9'
17
- bbb-08:
18
- salt: 'lka98f52e8akdlsoie400365b55e98s7'
15
+ secret: '8cd8ef52e8e101574e400365b55e11a6'
16
+ bbb-other:
19
17
  url: 'http://yourserver.com/bigbluebutton/api'
20
- version: '0.8'
18
+ secret: 'lka98f52e8akdlsoie400365b55e98s7'
@@ -2,7 +2,7 @@
2
2
 
3
3
  When /^the default BigBlueButton server$/ do
4
4
  @api = BigBlueButton::BigBlueButtonApi.new(@config_server['url'],
5
- @config_server['salt'],
5
+ @config_server['secret'],
6
6
  @config_server['version'].to_s,
7
7
  @config['debug'])
8
8
  @api.timeout = @config['timeout_req']
@@ -48,8 +48,7 @@ When /^the meeting is running$/ do
48
48
  end
49
49
 
50
50
  When /^the meeting is running with (\d+) attendees$/ do |count|
51
- mobile_salt = @config_server.has_key?('mobile_salt') ? @config_server['mobile_salt'] : ""
52
- BigBlueButtonBot.new(@api, @req.id, mobile_salt, count.to_i, @config['timeout_bot_start'])
51
+ BigBlueButtonBot.new(@api, @req.id, nil, count.to_i, @config['timeout_bot_start'])
53
52
  end
54
53
 
55
54
  When /^the response is an error with the key "(.*)"$/ do |key|
@@ -12,7 +12,7 @@ require 'bigbluebutton_config_layout'
12
12
 
13
13
  module BigBlueButton
14
14
 
15
- # This class provides access to the BigBlueButton API. For more details see README.rdoc.
15
+ # This class provides access to the BigBlueButton API. For more details see README.
16
16
  #
17
17
  # Sample usage of the API is as follows:
18
18
  # 1. Create a meeting with create_meeting;
@@ -44,8 +44,8 @@ module BigBlueButton
44
44
  # URL to a BigBlueButton server (e.g. http://demo.bigbluebutton.org/bigbluebutton/api)
45
45
  attr_accessor :url
46
46
 
47
- # Secret salt for this server
48
- attr_accessor :salt
47
+ # Shared secret for this server
48
+ attr_accessor :secret
49
49
 
50
50
  # API version e.g. 0.81
51
51
  attr_accessor :version
@@ -65,19 +65,20 @@ module BigBlueButton
65
65
 
66
66
  # Initializes an instance
67
67
  # url:: URL to a BigBlueButton server (e.g. http://demo.bigbluebutton.org/bigbluebutton/api)
68
- # salt:: Secret salt for this server
68
+ # secret:: Shared secret for this server
69
69
  # version:: API version e.g. 0.81
70
- def initialize(url, salt, version='0.9', debug=false)
71
- @supported_versions = ['0.8', '0.81', '0.9']
70
+ def initialize(url, secret, version=nil, debug=false)
71
+ @supported_versions = ['0.8', '0.81', '0.9', '1.0']
72
72
  @url = url
73
- @salt = salt
73
+ @secret = secret
74
74
  @debug = debug
75
75
  @timeout = 10 # default timeout for api requests
76
76
  @request_headers = {} # http headers sent in all requests
77
77
 
78
- @version = version || get_api_version
78
+ version = nil if version && version.strip.empty?
79
+ @version = nearest_version(version || get_api_version)
79
80
  unless @supported_versions.include?(@version)
80
- raise BigBlueButtonException.new("BigBlueButton error: Invalid API version #{version}. Supported versions: #{@supported_versions.join(', ')}")
81
+ puts "BigBlueButtonAPI: detected unsupported version, using the closest one that is supported (#{@version})"
81
82
  end
82
83
 
83
84
  puts "BigBlueButtonAPI: Using version #{@version}" if @debug
@@ -601,7 +602,7 @@ module BigBlueButton
601
602
  # API's are equal if all the following attributes are equal.
602
603
  def ==(other)
603
604
  r = true
604
- [:url, :supported_versions, :salt, :version, :debug].each do |param|
605
+ [:url, :supported_versions, :secret, :version, :debug].each do |param|
605
606
  r = r && self.send(param) == other.send(param)
606
607
  end
607
608
  r
@@ -637,7 +638,7 @@ module BigBlueButton
637
638
  params_string = params.map{ |k,v| "#{k}=" + CGI::escape(v.to_s) unless k.nil? || v.nil? }.join("&")
638
639
 
639
640
  # checksum calc
640
- checksum_param = params_string + @salt
641
+ checksum_param = params_string + @secret
641
642
  checksum_param = method.to_s + checksum_param
642
643
  checksum = Digest::SHA1.hexdigest(checksum_param)
643
644
 
@@ -704,6 +705,8 @@ module BigBlueButton
704
705
  http = Net::HTTP.new(url_parsed.host, url_parsed.port)
705
706
  http.open_timeout = @timeout
706
707
  http.read_timeout = @timeout
708
+ http.use_ssl = true if url_parsed.scheme.downcase == 'https'
709
+
707
710
  if data.nil?
708
711
  response = http.get(url_parsed.request_uri, @request_headers)
709
712
  else
@@ -723,5 +726,26 @@ module BigBlueButton
723
726
  response
724
727
  end
725
728
 
729
+ def nearest_version(target)
730
+ version = target
731
+
732
+ # 0.81 in BBB is actually < than 0.9, but not when comparing here
733
+ # so normalize x.xx versions to x.x.x
734
+ match = version.match(/(\d)\.(\d)(\d)/)
735
+ version = "#{match[1]}.#{match[2]}.#{match[3]}" if match
736
+
737
+ # we don't allow older versions than the one supported, use an old version of the gem for that
738
+ if Gem::Version.new(version) < Gem::Version.new(@supported_versions[0])
739
+ raise BigBlueButtonException.new("BigBlueButton error: Invalid API version #{version}. Supported versions: #{@supported_versions.join(', ')}")
740
+
741
+ # allow newer versions by using the newest one we support
742
+ elsif Gem::Version.new(version) > Gem::Version.new(@supported_versions.last)
743
+ @supported_versions.last
744
+
745
+ else
746
+ target
747
+ end
748
+ end
749
+
726
750
  end
727
751
  end
@@ -25,13 +25,13 @@ module BigBlueButton
25
25
  attr_accessor :xml
26
26
 
27
27
  def initialize(xml)
28
- @original_xml = nil
28
+ @original_string = nil
29
29
  @xml = nil
30
30
  unless xml.nil?
31
31
  opts = { 'ForceArray' => false, 'KeepRoot' => true }
32
32
  begin
33
33
  @xml = XmlSimple.xml_in(xml, opts)
34
- @original_xml = Marshal.load(Marshal.dump(@xml))
34
+ @original_string = self.as_string.clone
35
35
  rescue Exception => e
36
36
  raise BigBlueButton::BigBlueButtonException.new("Error parsing the config XML. Error: #{e.message}")
37
37
  end
@@ -60,7 +60,8 @@ module BigBlueButton
60
60
  if tag
61
61
  attr = find_attribute(tag, attr_name)
62
62
  if attr
63
- tag[attr_name] = value
63
+ # saves always as string
64
+ tag[attr_name] = value.is_a?(String) ? value : value.to_s
64
65
  else
65
66
  nil
66
67
  end
@@ -75,7 +76,7 @@ module BigBlueButton
75
76
 
76
77
  def is_modified?
77
78
  @xml and
78
- @xml != @original_xml
79
+ self.as_string != @original_string
79
80
  end
80
81
 
81
82
  protected
@@ -5,10 +5,10 @@ describe BigBlueButton::BigBlueButtonApi do
5
5
 
6
6
  # default variables and API object for all tests
7
7
  let(:url) { "http://server.com" }
8
- let(:salt) { "1234567890abcdefghijkl" }
8
+ let(:secret) { "1234567890abcdefghijkl" }
9
9
  let(:version) { "0.81" }
10
10
  let(:debug) { false }
11
- let(:api) { BigBlueButton::BigBlueButtonApi.new(url, salt, version, debug) }
11
+ let(:api) { BigBlueButton::BigBlueButtonApi.new(url, secret, version, debug) }
12
12
 
13
13
  describe "#get_default_config_xml" do
14
14
  let(:response) { "<response><returncode>1</returncode></response>" }
@@ -5,10 +5,10 @@ describe BigBlueButton::BigBlueButtonApi do
5
5
 
6
6
  # default variables and API object for all tests
7
7
  let(:url) { "http://server.com" }
8
- let(:salt) { "1234567890abcdefghijkl" }
8
+ let(:secret) { "1234567890abcdefghijkl" }
9
9
  let(:version) { "0.9" }
10
10
  let(:debug) { false }
11
- let(:api) { BigBlueButton::BigBlueButtonApi.new(url, salt, version, debug) }
11
+ let(:api) { BigBlueButton::BigBlueButtonApi.new(url, secret, version, debug) }
12
12
 
13
13
  describe "#create_meeting" do
14
14
  context "accepts the new parameters" do
@@ -8,15 +8,15 @@ describe BigBlueButton::BigBlueButtonApi do
8
8
 
9
9
  # default variables and API object for all tests
10
10
  let(:url) { "http://server.com" }
11
- let(:salt) { "1234567890abcdefghijkl" }
11
+ let(:secret) { "1234567890abcdefghijkl" }
12
12
  let(:debug) { false }
13
- let(:api) { BigBlueButton::BigBlueButtonApi.new(url, salt, version, debug) }
13
+ let(:api) { BigBlueButton::BigBlueButtonApi.new(url, secret, version, debug) }
14
14
 
15
15
  describe "#initialize" do
16
16
  context "standard initialization" do
17
- subject { BigBlueButton::BigBlueButtonApi.new(url, salt, version, debug) }
17
+ subject { BigBlueButton::BigBlueButtonApi.new(url, secret, version, debug) }
18
18
  it { subject.url.should == url }
19
- it { subject.salt.should == salt }
19
+ it { subject.secret.should == secret }
20
20
  it { subject.version.should == version }
21
21
  it { subject.debug.should == debug }
22
22
  it { subject.timeout.should == 10 }
@@ -28,19 +28,40 @@ describe BigBlueButton::BigBlueButtonApi do
28
28
 
29
29
  context "when the version is not informed, get it from the BBB server" do
30
30
  before { BigBlueButton::BigBlueButtonApi.any_instance.should_receive(:get_api_version).and_return("0.8") }
31
- subject { BigBlueButton::BigBlueButtonApi.new(url, salt, nil) }
31
+ subject { BigBlueButton::BigBlueButtonApi.new(url, secret, nil) }
32
32
  it { subject.version.should == "0.8" }
33
33
  end
34
34
 
35
- it "when the version is not supported raise an error" do
35
+ context "when the version informed is empty, get it from the BBB server" do
36
+ before { BigBlueButton::BigBlueButtonApi.any_instance.should_receive(:get_api_version).and_return("0.8") }
37
+ subject { BigBlueButton::BigBlueButtonApi.new(url, secret, " ") }
38
+ it { subject.version.should == "0.8" }
39
+ end
40
+
41
+ it "when the version is lower than the lowest supported, raise exception" do
42
+ expect {
43
+ BigBlueButton::BigBlueButtonApi.new(url, secret, "0.1", nil)
44
+ }.to raise_error(BigBlueButton::BigBlueButtonException)
45
+ end
46
+
47
+ it "when the version is higher than thew highest supported, use the highest supported" do
48
+ BigBlueButton::BigBlueButtonApi.new(url, secret, "5.0", nil).version.should eql('1.0')
49
+ end
50
+
51
+ it "compares versions in the format 'x.xx' properly" do
36
52
  expect {
37
- BigBlueButton::BigBlueButtonApi.new(url, salt, "0.not-supported", nil)
53
+ # if not comparing properly, 0.61 would be bigger than 0.9, for example
54
+ # comparing the way BBB does, it is lower, so will raise an exception
55
+ BigBlueButton::BigBlueButtonApi.new(url, secret, "0.61", nil)
38
56
  }.to raise_error(BigBlueButton::BigBlueButtonException)
39
57
  end
40
58
 
41
59
  context "current supported versions" do
42
- subject { BigBlueButton::BigBlueButtonApi.new(url, salt) }
43
- it { subject.supported_versions.should == ["0.8", "0.81", "0.9"] }
60
+ before {
61
+ BigBlueButton::BigBlueButtonApi.any_instance.should_receive(:get_api_version).and_return("0.9")
62
+ }
63
+ subject { BigBlueButton::BigBlueButtonApi.new(url, secret) }
64
+ it { subject.supported_versions.should == ["0.8", "0.81", "0.9", "1.0"] }
44
65
  end
45
66
  end
46
67
 
@@ -320,7 +341,7 @@ describe BigBlueButton::BigBlueButtonApi do
320
341
  end
321
342
 
322
343
  describe "#==" do
323
- let(:api2) { BigBlueButton::BigBlueButtonApi.new(url, salt, version, debug) }
344
+ let(:api2) { BigBlueButton::BigBlueButtonApi.new(url, secret, version, debug) }
324
345
 
325
346
  context "compares attributes" do
326
347
  it { api.should == api2 }
@@ -331,8 +352,8 @@ describe BigBlueButton::BigBlueButtonApi do
331
352
  it { api.should_not == api2 }
332
353
  end
333
354
 
334
- context "differs #salt" do
335
- before { api2.salt = api.salt + "x" }
355
+ context "differs #secret" do
356
+ before { api2.secret = api.secret + "x" }
336
357
  it { api.should_not == api2 }
337
358
  end
338
359
 
@@ -168,10 +168,28 @@ describe BigBlueButton::BigBlueButtonConfigXml do
168
168
  end
169
169
 
170
170
  context "if the module and attribute are found" do
171
- before(:each) {
172
- target.set_attribute("LayoutModule", "layoutConfig", "value").should eql("value")
173
- }
174
- it { target.get_attribute("LayoutModule", "layoutConfig").should eql("value") }
171
+ context "setting an attribute as string" do
172
+ before(:each) {
173
+ target.set_attribute("LayoutModule", "layoutConfig", "value").should eql("value")
174
+ }
175
+ it { target.get_attribute("LayoutModule", "layoutConfig").should eql("value") }
176
+ end
177
+
178
+ context "sets values always as string" do
179
+ context "boolean" do
180
+ before(:each) {
181
+ target.set_attribute("LayoutModule", "layoutConfig", true).should eql("true")
182
+ }
183
+ it { target.get_attribute("LayoutModule", "layoutConfig").should eql("true") }
184
+ end
185
+
186
+ context "Hash" do
187
+ before(:each) {
188
+ target.set_attribute("LayoutModule", "layoutConfig", {}).should eql("{}")
189
+ }
190
+ it { target.get_attribute("LayoutModule", "layoutConfig").should eql("{}") }
191
+ end
192
+ end
175
193
  end
176
194
 
177
195
  context "if the module is not found" do
@@ -271,6 +289,14 @@ describe BigBlueButton::BigBlueButtonConfigXml do
271
289
  }
272
290
  it { target.is_modified?.should be_false }
273
291
  end
292
+
293
+ context "if an attribute is set to the same value it already had, but with a different type" do
294
+ before(:each) {
295
+ # it's already false in the original XML, but as a string, not boolean
296
+ target.set_attribute("LayoutModule", "enableEdit", false)
297
+ }
298
+ it { target.is_modified?.should be_false }
299
+ end
274
300
  end
275
301
 
276
302
  end
metadata CHANGED
@@ -1,52 +1,53 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bigbluebutton-api-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
+ - Mconf
7
8
  - Leonardo Crauss Daronco
8
- - Joe Kinsella
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-07-20 00:00:00.000000000 Z
12
+ date: 2016-06-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: xml-simple
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - ">="
18
+ - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: 1.1.1
20
+ version: '1.1'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - ">="
25
+ - - "~>"
26
26
  - !ruby/object:Gem::Version
27
- version: 1.1.1
28
- description: Provides an interface to the BigBlueButton web meeting API (https://github.com/mconf/bigbluebutton-api-ruby)
27
+ version: '1.1'
28
+ description: Provides methods to access BigBlueButton in a ruby application through
29
+ its API
29
30
  email:
31
+ - contact@mconf.org
30
32
  - leonardodaronco@gmail.com
31
- - joe.kinsella@gmail.com
32
33
  executables: []
33
34
  extensions: []
34
35
  extra_rdoc_files:
35
- - README.rdoc
36
+ - README.md
36
37
  - LICENSE
37
38
  - LICENSE_003
38
- - CHANGELOG.rdoc
39
+ - CHANGELOG.md
39
40
  files:
40
41
  - ".gitignore"
41
42
  - ".rspec"
42
43
  - ".ruby-version"
43
44
  - ".travis.yml"
44
- - CHANGELOG.rdoc
45
+ - CHANGELOG.md
45
46
  - Gemfile
46
47
  - Gemfile.lock
47
48
  - LICENSE
48
49
  - LICENSE_003
49
- - README.rdoc
50
+ - README.md
50
51
  - Rakefile
51
52
  - bigbluebutton-api-ruby.gemspec
52
53
  - examples/config_xml.rb
@@ -116,5 +117,5 @@ rubyforge_project:
116
117
  rubygems_version: 2.4.5
117
118
  signing_key:
118
119
  specification_version: 4
119
- summary: Provides an interface to the BigBlueButton web meeting API (https://github.com/mconf/bigbluebutton-api-ruby)
120
+ summary: BigBlueButton integration for ruby
120
121
  test_files: []
data/CHANGELOG.rdoc DELETED
@@ -1,97 +0,0 @@
1
- === 1.4.0
2
-
3
- * Updated default ruby version to 2.2.0.
4
- * Add support for BigBlueButton 0.9 (includes all 0.9.x). Consists only in accepting the version
5
- "0.9", since this new API version doesn't break compatibility with the previous version and
6
- also doesn't add new API calls.
7
-
8
- === 1.3.0
9
-
10
- * Drop support to BigBlueButton 0.7 and add BigBlueButton to 0.81. Includes support to the new API calls <tt>getDefaultConfigXML</tt> and <tt>setConfigXML</tt>.
11
- * Reviewed all methods responses (some changed a bit) and documentation.
12
- * Allow non standard options to be passed to *all* API calls.
13
- * Removed method <tt>join_meeting</tt> that was usually not used. Should always use <tt>join_meeting_url</tt>.
14
- * Moved the hash extension method <tt>from_xml</tt> to its own class to prevent conflicts with Rails. See https://github.com/mconf/bigbluebutton-api-ruby/pull/6.
15
-
16
- === 1.2.0
17
-
18
- * Allow non standard options to be passed to some API calls. These API calls are: create_meeting, join_meeting_url,
19
- join_meeting, get_recordings. Useful for development of for custom versions of BigBlueButton.
20
- * Accept :record as boolean in create_meeting
21
- * Better formatting of data returned by get_recordings
22
-
23
- === 1.1.1
24
-
25
- * BigBlueButtonApi can now receive http headers to be sent in all get/post requests
26
-
27
- === 1.1.0
28
-
29
- * Updated ruby to 1.9.3-194.
30
- * Support to BigBlueButton 0.4 rc1.
31
-
32
- === 1.0.0
33
-
34
- * Version 0.1.0 renamed to 1.0.0.
35
-
36
- === 0.1.0
37
-
38
- * Support to BigBlueButton 0.8:
39
- * New methods for recordings: get_recordings, publish_recordings, delete_recordings
40
- * Pre-upload of slides in create_meeting
41
- * New parameters added in the already existent methods
42
- * For more information see BigBlueButton docs at http://code.google.com/p/bigbluebutton/wiki/API#Version_0.8
43
- * Method signature changes: create_meeting, join_meeting_url and join_meeting. Optional parameters are now passed using a hash.
44
- * Integration tests for the entire library using cucumber.
45
- * Changed the XML parser to xml-simple (especially to solve issues with CDATA values).
46
-
47
- === 0.0.11
48
-
49
- * The file "bigbluebutton-api" was renamed to "bigbluebutton_api". All "require" calls must be updated.
50
- * Splitted the library in more files (more modular) and created rspec tests for it.
51
- * Added a BigBlueButtonApi.timeout attribute to timeout get requests and avoid blocks when the server is down. Defaults to 2 secs.
52
- * New method last_http_response to access the last HTTP response object.
53
- * Automatically detects the BBB server version if not informed by the user.
54
-
55
- === 0.0.10
56
-
57
- * Returning hash now will *always* have these 3 values: :returncode (boolean), :messageKey (string) and :message (string).
58
- * Some values in the hash are now converted to a fixed variable type to avoid inconsistencies:
59
- * :meetingID (string)
60
- * :attendeePW (string)
61
- * :moderatorPW (string)
62
- * :running (boolean)
63
- * :hasBeenForciblyEnded (boolean)
64
- * :endTime and :startTime (DateTime or nil)
65
-
66
- === 0.0.9
67
-
68
- * Simplied "attendees" part of the hash returned in get_meeting_info. Same thing done for get_meetings.
69
-
70
- === 0.0.8
71
-
72
- * New method get_api_version that returns the version of the server API (>= 0.7).
73
- * New simplified hash syntax for get_meetings. See docs for details.
74
-
75
- === 0.0.6
76
-
77
- * New method test_connection.
78
- * Added comparison method for APIs.
79
- * Methods attendee_url and moderator_url deprecated. Use join_meeting_url.
80
- * Better exception throwing when the user is unreachable or the response is incorrect.
81
- * BigBlueButtonException has now a "key" attribute to store the "messageKey" returned by BBB in failures.
82
-
83
- === 0.0.4
84
-
85
- * Added support for BigBlueButton 0.7.
86
- * Gem renamed from 'bigbluebutton' to 'bigbluebutton-api-ruby'.
87
- * API functions now return a hash and instead of the XML returned by BBB. The XML is converted to a hash that uses symbols as keys and groups keys with the same name.
88
-
89
- === 0.0.3
90
-
91
- * Fixes module issue preventing proper throwing of exceptions.
92
-
93
- === 0.0.1
94
-
95
- * This is the first version of this gem. It provides an implementation of the 0.64 bbb API, with the following exceptions:
96
- * Does not implement meeting token, and instead relies on meeting id as the unique identifier for a meeting.
97
- * Documentation suggests there is way to call join_meeting as API call (instead of browser URL). This call currently does not work as documented.
data/README.rdoc DELETED
@@ -1,65 +0,0 @@
1
- = bigbluebutton-api-ruby {<img src="http://travis-ci.org/mconf/bigbluebutton-api-ruby.png"/>}[http://travis-ci.org/mconf/bigbluebutton-api-ruby]
2
-
3
- This is a ruby gem that provides access to the API of {BigBlueButton}[http://bigbluebutton.org].
4
- See the documentation of the API {here}[http://code.google.com/p/bigbluebutton/wiki/API].
5
-
6
- It enables a ruby application to interact with BigBlueButton by calling ruby methods instead of
7
- HTTP requests, making it a lot easier to interact with BigBlueButton. It also formats the responses
8
- to a ruby-friendly format and includes helper classes to deal with more complicated API calls, such
9
- as the pre-upload of slides.
10
-
11
- A few features it has:
12
-
13
- * Provides methods to perform all API calls and get the responses;
14
- * Converts the XML responses to ruby hashes, that are easier to work with;
15
- * Converts the string values returned to native ruby types. For instance:
16
- * Dates are converted DateTime objects (e.g. "Thu Sep 01 17:51:42 UTC 2011");
17
- * Response codes are converted to boolean (e.g. "SUCCESS" becomes <tt>true</tt>);
18
- * Deals with errors (e.g. timeouts) throwing <tt>BigBlueButtonException</tt> exceptions;
19
- * Support to multiple BigBlueButton API versions (see below).
20
-
21
- == Supported BigBlueButton versions
22
-
23
- The current version of this gem supports <em>all</em> the following versions of BigBlueButton:
24
-
25
- * 0.9 (includes all 0.9.x)
26
- * 0.81
27
- * 0.8
28
-
29
- Older versions:
30
-
31
- * 0.7 (including 0.7, 0.71 and 0.71a): The last version with support to 0.7* is {version 1.2.0}[https://github.com/mconf/bigbluebutton-api-ruby/tree/v1.2.0]. It supports versions 0.7 and 0.8.
32
- * 0.64: see the branch <tt>api-0.64</tt>. The last version with support to 0.64 is {version 0.0.10}[https://github.com/mconf/bigbluebutton-api-ruby/tree/v0.0.10]. It supports versions 0.64 and 0.7.
33
-
34
- == Supported ruby versions
35
-
36
- Tested in rubies:
37
-
38
- * ruby-2.2.0 *recommended*
39
- * ruby-2.1.2
40
- * ruby-2.0.0 (p353)
41
- * ruby-1.9.3 (p484)
42
- * ruby-1.9.2 (p290)
43
-
44
- Use these versions to be sure it will work. Other patches of these rubies (e.g. ruby 1.9.3-p194) should work as well.
45
-
46
- == Releases
47
-
48
- For a list of releases and release notes see {CHANGELOG.rdoc}[https://github.com/mconf/bigbluebutton-api-ruby/blob/master/CHANGELOG.rdoc].
49
-
50
- == Development
51
-
52
- Information for developers of <tt>bigbluebutton-api-ruby</tt> can be found in {our wiki}[https://github.com/mconf/bigbluebutton-api-ruby/wiki].
53
-
54
- The development of this gem is guided by the requirements of the project Mconf. To know more about it visit the {project's wiki}[https://github.com/mconf/wiki/wiki].
55
-
56
- == License
57
-
58
- Distributed under The MIT License (MIT).
59
- See {LICENSE}[https://github.com/mconf/bigbluebutton-api-ruby/blob/master/LICENSE] for the latest license, valid for all versions after 0.0.4 (including it), and {LICENSE_003}[https://github.com/mconf/bigbluebutton-api-ruby/blob/master/LICENSE_003] for version 0.0.3 and all the previous versions.
60
-
61
- == Contact
62
-
63
- <b>Version 0.0.4+</b>: This project is developed as part of Mconf (http://mconf.org). Contact: Leonardo Crauss Daronco (leonardodaronco@gmail.com), Mconf: A scalable opensource multiconference system for web and mobile devices @ PRAV Labs - UFRGS. Home page: http://www.inf.ufrgs.br/prav/gtmconf
64
-
65
- <b>Version 0.0.3 and below</b>: Joe Kinsella (joe.kinsella@gmail.com), Home page: http://www.brownbaglunch.com/bigbluebutton