bigbluebutton-api-ruby 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -5,4 +5,3 @@ features/config.yml
5
5
  logs/bbb.log
6
6
  rdoc/
7
7
  logs/*
8
- extras/bbb-bot.jar
data/.rvmrc CHANGED
@@ -2,5 +2,5 @@
2
2
  if [ -e '.rvmrc_custom' ]; then
3
3
  source .rvmrc_custom;
4
4
  else
5
- rvm --create use 1.9.2-p290@bigbluebutton-api-ruby;
5
+ rvm --create use 1.9.3-p194@bigbluebutton-api-ruby;
6
6
  fi
data/CHANGELOG.rdoc CHANGED
@@ -1,3 +1,8 @@
1
+ === 1.1.0
2
+
3
+ * Updated ruby to 1.9.3-194.
4
+ * Support to BigBlueButton 0.4 rc1.
5
+
1
6
  === 1.0.0
2
7
 
3
8
  * Version 0.1.0 renamed to 1.0.0.
data/Gemfile CHANGED
@@ -8,8 +8,9 @@ group :developement do
8
8
  end
9
9
 
10
10
  group :development, :test do
11
- gem 'rspec', '~> 2.6'
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
15
  # gem 'rails_best_practices'
15
16
  end
data/Gemfile.lock CHANGED
@@ -1,12 +1,19 @@
1
+ GIT
2
+ remote: git://github.com/mconf/bbbot-ruby.git
3
+ revision: 83f3ccf88aa355260a791eb450a8d73f94049053
4
+ specs:
5
+ bbbot-ruby (0.0.1)
6
+
1
7
  PATH
2
8
  remote: .
3
9
  specs:
4
- bigbluebutton-api-ruby (1.0.0)
10
+ bigbluebutton-api-ruby (1.1.0)
5
11
  xml-simple (>= 1.1.1)
6
12
 
7
13
  GEM
8
14
  remote: http://rubygems.org/
9
15
  specs:
16
+ addressable (2.2.8)
10
17
  builder (3.0.0)
11
18
  capybara (1.1.2)
12
19
  mime-types (>= 1.16)
@@ -15,46 +22,49 @@ GEM
15
22
  rack-test (>= 0.5.4)
16
23
  selenium-webdriver (~> 2.0)
17
24
  xpath (~> 0.1.4)
18
- childprocess (0.2.2)
25
+ childprocess (0.3.2)
19
26
  ffi (~> 1.0.6)
20
- cucumber (1.1.2)
27
+ cucumber (1.1.9)
21
28
  builder (>= 2.1.2)
22
29
  diff-lcs (>= 1.1.2)
23
- gherkin (~> 2.6.2)
30
+ gherkin (~> 2.9.0)
24
31
  json (>= 1.4.6)
25
32
  term-ansicolor (>= 1.0.6)
26
- cucumber-rails (1.2.0)
27
- capybara (>= 1.1.1)
28
- cucumber (>= 1.1.1)
33
+ cucumber-rails (1.3.0)
34
+ capybara (>= 1.1.2)
35
+ cucumber (>= 1.1.8)
29
36
  nokogiri (>= 1.5.0)
30
37
  diff-lcs (1.1.3)
31
38
  ffi (1.0.11)
32
39
  forgery (0.5.0)
33
- gherkin (2.6.6)
40
+ gherkin (2.9.3)
34
41
  json (>= 1.4.6)
35
- json (1.6.1)
36
- json_pure (1.6.1)
37
- mime-types (1.17.2)
38
- nokogiri (1.5.0)
39
- rack (1.3.5)
42
+ json (1.7.0)
43
+ libwebsocket (0.1.3)
44
+ addressable
45
+ mime-types (1.18)
46
+ multi_json (1.3.4)
47
+ nokogiri (1.5.2)
48
+ rack (1.4.1)
40
49
  rack-test (0.6.1)
41
50
  rack (>= 1.0)
42
51
  rake (0.9.2.2)
43
- rdoc (3.11)
52
+ rdoc (3.12)
44
53
  json (~> 1.4)
45
- rspec (2.7.0)
46
- rspec-core (~> 2.7.0)
47
- rspec-expectations (~> 2.7.0)
48
- rspec-mocks (~> 2.7.0)
49
- rspec-core (2.7.1)
50
- rspec-expectations (2.7.0)
51
- diff-lcs (~> 1.1.2)
52
- rspec-mocks (2.7.0)
53
- rubyzip (0.9.4)
54
- selenium-webdriver (2.13.0)
55
- childprocess (>= 0.2.1)
56
- ffi (~> 1.0.9)
57
- json_pure
54
+ rspec (2.10.0)
55
+ rspec-core (~> 2.10.0)
56
+ rspec-expectations (~> 2.10.0)
57
+ rspec-mocks (~> 2.10.0)
58
+ rspec-core (2.10.0)
59
+ rspec-expectations (2.10.0)
60
+ diff-lcs (~> 1.1.3)
61
+ rspec-mocks (2.10.0)
62
+ rubyzip (0.9.8)
63
+ selenium-webdriver (2.21.2)
64
+ childprocess (>= 0.2.5)
65
+ ffi (~> 1.0)
66
+ libwebsocket (~> 0.1.3)
67
+ multi_json (~> 1.0)
58
68
  rubyzip
59
69
  term-ansicolor (1.0.7)
60
70
  xml-simple (1.1.1)
@@ -65,9 +75,10 @@ PLATFORMS
65
75
  ruby
66
76
 
67
77
  DEPENDENCIES
78
+ bbbot-ruby!
68
79
  bigbluebutton-api-ruby!
69
80
  cucumber-rails
70
81
  forgery
71
82
  rake (>= 0.9)
72
83
  rdoc
73
- rspec (~> 2.6)
84
+ rspec (~> 2.10)
data/Rakefile CHANGED
@@ -17,11 +17,11 @@ Cucumber::Rake::Task.new do |t|
17
17
  prepend = "--tags ~@need-bot"
18
18
  end
19
19
 
20
- # defaults to BBB 0.7
21
- if ENV["V"] == "0.8"
22
- t.cucumber_opts = "--format pretty --tags ~@wip --tags @version-all,@version-08 #{prepend}"
23
- else
20
+ # defaults to BBB 0.8
21
+ if ENV["V"] == "0.7" or ENV["VERSION"] == "0.7"
24
22
  t.cucumber_opts = "--format pretty --tags ~@wip --tags @version-all,@version-07 #{prepend}"
23
+ else
24
+ t.cucumber_opts = "--format pretty --tags ~@wip --tags @version-all,@version-08 #{prepend}"
25
25
  end
26
26
  end
27
27
 
@@ -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.0.0'
5
+ s.version = '1.1.0'
6
6
  s.extra_rdoc_files = ['README.rdoc', 'LICENSE', 'LICENSE_003', 'CHANGELOG.rdoc']
7
7
  s.summary = 'Provides an interface to the BigBlueButton web meeting API (https://github.com/mconf/bigbluebutton-api-ruby)'
8
8
  s.description = s.summary
@@ -19,7 +19,7 @@ Feature: Create rooms
19
19
  When the create method is called with a duplicated meeting id
20
20
  Then the response is an error with the key "idNotUnique"
21
21
 
22
- @version-all @need-bot
22
+ @version-07 @need-bot
23
23
  Scenario: Try to recreate a previously ended meeting
24
24
  Given the create method is called
25
25
  # note: meeting needs to be running to be ended in 0.7
@@ -27,3 +27,12 @@ Feature: Create rooms
27
27
  And the meeting is forcibly ended
28
28
  When the create method is called again with the same meeting id
29
29
  Then the response is an error with the key "idNotUnique"
30
+
31
+ @version-08 @need-bot
32
+ Scenario: Try to recreate a previously ended meeting
33
+ Given the create method is called
34
+ And the meeting is running
35
+ And the meeting is forcibly ended
36
+ When the create method is called again with the same meeting id
37
+ Then the response is successful and well formatted
38
+ And the meeting exists in the server
@@ -2,7 +2,7 @@ Feature: End rooms
2
2
  To stop a meeting using the API
3
3
  One needs to be able to call 'end' to this meeting
4
4
 
5
- @version-all @need-bot
5
+ @version-07 @need-bot
6
6
  Scenario: End a meeting
7
7
  Given that a meeting was created
8
8
  And the meeting is running
@@ -11,6 +11,15 @@ Feature: End rooms
11
11
  And the meeting should be ended
12
12
  And the information returned by get_meeting_info is correct
13
13
 
14
+ @version-08 @need-bot
15
+ Scenario: End a meeting
16
+ Given that a meeting was created
17
+ And the meeting is running
18
+ When the method to end the meeting is called
19
+ Then the response is successful and well formatted
20
+ And the meeting should be ended
21
+ # the meeting may not exist anymore in 0.8
22
+
14
23
  # in 0.7 ending a meeting that is not running generates an error
15
24
  @version-07
16
25
  Scenario: Try to end a meeting that is not running in 0.7
@@ -105,15 +105,17 @@ Then /^it shows the (\d+) attendees in the list$/ do |count|
105
105
  @req.response[:attendees].size.should == 2
106
106
 
107
107
  # check the start time that should be within 2 hours from now
108
+ # we check with this 2-hour time window to prevent errors if the
109
+ # server clock is different
108
110
  @req.response[:startTime].should be_a(DateTime)
109
- @req.response[:startTime].should < DateTime.now
110
- @req.response[:startTime].should >= DateTime.now - (2/24.0)
111
+ @req.response[:startTime].should < DateTime.now + (1/24.0)
112
+ @req.response[:startTime].should >= DateTime.now - (1/24.0)
111
113
  @req.response[:endTime].should be_nil
112
114
 
113
115
  # in the bot being used, bots are always moderators with these names
114
116
  @req.response[:attendees].sort! { |h1,h2| h1[:fullName] <=> h2[:fullName] }
115
- @req.response[:attendees][0][:fullName].should == "BOT0"
117
+ @req.response[:attendees][0][:fullName].should == "Bot 1"
116
118
  @req.response[:attendees][0][:role].should == :moderator
117
- @req.response[:attendees][1][:fullName].should == "BOT1"
119
+ @req.response[:attendees][1][:fullName].should == "Bot 2"
118
120
  @req.response[:attendees][1][:role].should == :moderator
119
121
  end
@@ -90,6 +90,7 @@ When /^the response to the create method is successful and well formatted$/ do
90
90
  @req.response[:messageKey].should == ""
91
91
  @req.response[:message].should == ""
92
92
 
93
+ @req.opts = {} if @req.opts.nil?
93
94
  if @req.opts.has_key?(:attendeePW)
94
95
  @req.response[:attendeePW].should == @req.opts[:attendeePW]
95
96
  else # auto generated password
@@ -17,7 +17,7 @@ When /^the meeting should be ended$/ do
17
17
  sleep 1
18
18
  response = @api.get_meetings
19
19
  selected = response[:meetings].reject!{ |m| m[:meetingID] != @req.id }
20
- running = selected[0][:running] unless selected.nil?
20
+ running = selected[0].nil? ? false : selected[0][:running]
21
21
  end
22
22
  end
23
23
 
@@ -38,12 +38,12 @@ When /^the information returned by get_meeting_info is correct$/ do
38
38
  @req.response[:moderatorCount].should == 0
39
39
  @req.response[:attendees].should == []
40
40
 
41
- # start and end times that should be within 2 hours from now
41
+ # start and end times should be within half an hour from now
42
42
  @req.response[:startTime].should be_a(DateTime)
43
- @req.response[:startTime].should < DateTime.now
44
- @req.response[:startTime].should >= DateTime.now - (2/24.0)
43
+ @req.response[:startTime].should < DateTime.now + (0.5/24.0)
44
+ @req.response[:startTime].should >= DateTime.now - (0.5/24.0)
45
45
  @req.response[:endTime].should be_a(DateTime)
46
- @req.response[:endTime].should < DateTime.now
47
- @req.response[:endTime].should >= DateTime.now - (2/24.0)
46
+ @req.response[:endTime].should < DateTime.now + (0.5/24.0)
47
+ @req.response[:endTime].should >= DateTime.now - (0.5/24.0)
48
48
  @req.response[:endTime].should > @req.response[:startTime]
49
49
  end
@@ -1,7 +1,6 @@
1
1
  $:.unshift File.join(File.expand_path(File.dirname(__FILE__)), '..', '..', 'lib')
2
2
 
3
3
  require 'bigbluebutton_api'
4
+ require 'bigbluebutton_bot'
4
5
  require 'forgery'
5
6
  Dir["#{File.dirname(__FILE__)}/../../spec/support/forgery/**/*.rb"].each { |f| require f }
6
-
7
- Dir["#{File.dirname(__FILE__)}/../../extras/**/*.rb"].each { |f| require f }
@@ -0,0 +1,54 @@
1
+ module BigBlueButton
2
+ module Features
3
+
4
+ # Test object that stores information about an API request
5
+ class APIRequest
6
+ attr_accessor :opts # options hash
7
+ attr_accessor :id # meetind id
8
+ attr_accessor :mod_pass # moderator password
9
+ attr_accessor :name # meeting name
10
+ attr_accessor :method # last api method called
11
+ attr_accessor :response # last api response
12
+ attr_accessor :exception # last exception
13
+ end
14
+
15
+ # Global configurations
16
+ module Configs
17
+ class << self
18
+ attr_accessor :cfg # configuration file
19
+ attr_accessor :cfg_server # shortcut to the choosen server configs
20
+ attr_accessor :req # api request
21
+
22
+ def initialize_cfg
23
+ config_file = File.join(File.dirname(__FILE__), '..', 'config.yml')
24
+ unless File.exist? config_file
25
+ throw Exception.new(config_file + " does not exists. Copy the example and configure your server.")
26
+ end
27
+ config = YAML.load_file(config_file)
28
+ config
29
+ end
30
+
31
+ def initialize_cfg_server
32
+ if ENV['SERVER']
33
+ unless self.cfg['servers'].has_key?(ENV['SERVER'])
34
+ throw Exception.new("Server #{ENV['SERVER']} does not exists in your configuration file.")
35
+ end
36
+ server = self.cfg['servers'][ENV['SERVER']]
37
+ else
38
+ server = self.cfg['servers'].first[1]
39
+ end
40
+ server['version'] = '0.7' unless server.has_key?('version')
41
+ server
42
+ end
43
+
44
+ def load
45
+ self.cfg = initialize_cfg
46
+ self.cfg_server = initialize_cfg_server
47
+ self.req = BigBlueButton::Features::APIRequest.new
48
+ end
49
+
50
+ end
51
+ end
52
+
53
+ end
54
+ end
@@ -1,9 +1,9 @@
1
1
  Before do
2
2
  # stores the global configurations in variables that are easier to access
3
- BigBlueButtonAPITests::Configs.load
4
- @config = BigBlueButtonAPITests::Configs.cfg
5
- @config_server = BigBlueButtonAPITests::Configs.cfg_server
6
- @req = BigBlueButtonAPITests::Configs.req
3
+ BigBlueButton::Features::Configs.load
4
+ @config = BigBlueButton::Features::Configs.cfg
5
+ @config_server = BigBlueButton::Features::Configs.cfg_server
6
+ @req = BigBlueButton::Features::Configs.req
7
7
  end
8
8
 
9
9
  After do |scenario|
@@ -52,6 +52,7 @@ module BigBlueButton
52
52
  if value.downcase == "null"
53
53
  result = nil
54
54
  else
55
+ # note: BBB 0.7 uses strings in the format: "Thu Sep 01 17:51:42 UTC 2011"
55
56
  result = DateTime.parse(value)
56
57
  end
57
58
  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.0.0
4
+ version: 1.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,11 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-05-05 00:00:00.000000000Z
13
+ date: 2012-05-05 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: xml-simple
17
- requirement: &74945770 !ruby/object:Gem::Requirement
17
+ requirement: !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,7 +22,12 @@ dependencies:
22
22
  version: 1.1.1
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *74945770
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ! '>='
29
+ - !ruby/object:Gem::Version
30
+ version: 1.1.1
26
31
  description: Provides an interface to the BigBlueButton web meeting API (https://github.com/mconf/bigbluebutton-api-ruby)
27
32
  email:
28
33
  - leonardodaronco@gmail.com
@@ -51,8 +56,6 @@ files:
51
56
  - examples/join_example.rb
52
57
  - examples/overall_0.7_example.rb
53
58
  - examples/prepare.rb
54
- - extras/bigbluebutton_bot.rb
55
- - extras/download_bot_from.txt
56
59
  - extras/test-presentation.pdf
57
60
  - features/check_status.feature
58
61
  - features/config.yml.example
@@ -68,8 +71,8 @@ files:
68
71
  - features/step_definitions/join_meetings_steps.rb
69
72
  - features/step_definitions/pre_upload_slides_steps.rb
70
73
  - features/step_definitions/recordings_steps.rb
71
- - features/support/api_tests/configs.rb
72
74
  - features/support/env.rb
75
+ - features/support/features_helpers.rb
73
76
  - features/support/hooks.rb
74
77
  - lib/bigbluebutton_api.rb
75
78
  - lib/bigbluebutton_exception.rb
@@ -100,7 +103,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
100
103
  version: '0'
101
104
  segments:
102
105
  - 0
103
- hash: -707052209
106
+ hash: -937799181
104
107
  required_rubygems_version: !ruby/object:Gem::Requirement
105
108
  none: false
106
109
  requirements:
@@ -109,10 +112,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
109
112
  version: '0'
110
113
  segments:
111
114
  - 0
112
- hash: -707052209
115
+ hash: -937799181
113
116
  requirements: []
114
117
  rubyforge_project:
115
- rubygems_version: 1.8.10
118
+ rubygems_version: 1.8.24
116
119
  signing_key:
117
120
  specification_version: 3
118
121
  summary: Provides an interface to the BigBlueButton web meeting API (https://github.com/mconf/bigbluebutton-api-ruby)
@@ -1,64 +0,0 @@
1
- class BigBlueButtonBot
2
- BOT_FILENAME = "bbb-bot.jar"
3
- @@pids = []
4
-
5
- def initialize(api, meeting, salt="", count=1, timeout=20)
6
- bot_file = File.join(File.dirname(__FILE__), BOT_FILENAME)
7
- unless File.exist?(bot_file)
8
- throw Exception.new(bot_file + " does not exists. See download_bot_from.txt and download the bot file.")
9
- end
10
-
11
- server = parse_server_url(api.url)
12
-
13
- # note: fork + exec with these parameters was the only solution found to run the command in background
14
- # and be able to wait for it (kill it) later on (see BigBlueButtonBot.finalize)
15
- pid = Process.fork do
16
- exec("java", "-jar", "#{bot_file}", "-s", "#{server}", "-p", "#{salt}", "-m", "#{meeting}", "-n", "#{count}")
17
-
18
- # other options that didn't work:
19
- # IO::popen("java -jar #{bot_file} -s \"#{server}\" -m \"#{meeting}\" -n #{count} >/dev/null")
20
- # exec(["java", "-jar #{bot_file} -s \"#{server}\" -m \"#{meeting}\" -n #{count} >/dev/null"])
21
- # exec("java -jar #{bot_file} -s \"#{server}\" -m \"#{meeting}\" -n #{count} >/dev/null")
22
- # Process.exit!
23
- end
24
- @@pids << pid
25
-
26
- wait_bot_startup(api, meeting, count, timeout)
27
- end
28
-
29
- def self.finalize
30
- @@pids.each do |pid|
31
- p = Process.kill("TERM", pid)
32
- Process.detach(pid)
33
- end
34
- @@pids.clear
35
- end
36
-
37
- def parse_server_url(full_url)
38
- uri = URI.parse(full_url)
39
- uri_s = uri.scheme + "://" + uri.host
40
- uri_s = uri_s + ":" + uri.port.to_s if uri.port != uri.default_port
41
- uri_s
42
- end
43
-
44
- # wait until the meeting is running with a certain number of participants
45
- def wait_bot_startup(api, meeting, participants, timeout=20)
46
- Timeout::timeout(timeout) do
47
- stop_wait = false
48
- while !stop_wait
49
- sleep 1
50
-
51
- # find the meeting and hope it is running
52
- response = api.get_meetings
53
- selected = response[:meetings].reject!{ |m| m[:meetingID] != meeting }
54
- if selected and selected.size > 0 and selected[0][:running]
55
-
56
- # check how many participants are in the meeting
57
- pass = selected[0][:moderatorPW]
58
- response = api.get_meeting_info(meeting, pass)
59
- stop_wait = response[:participantCount] >= participants
60
- end
61
- end
62
- end
63
- end
64
- end
@@ -1 +0,0 @@
1
- https://github.com/daronco/mconf-mobile/blob/879f38e1be127f46b379c57a1933d3867b6bf14b/bbb-bot/bbb-bot.jar?raw=true
@@ -1,51 +0,0 @@
1
- module BigBlueButtonAPITests
2
-
3
- # Test object that stores information about an API request
4
- class APIRequest
5
- attr_accessor :opts # options hash
6
- attr_accessor :id # meetind id
7
- attr_accessor :mod_pass # moderator password
8
- attr_accessor :name # meeting name
9
- attr_accessor :method # last api method called
10
- attr_accessor :response # last api response
11
- attr_accessor :exception # last exception
12
- end
13
-
14
- # Global configurations
15
- module Configs
16
- class << self
17
- attr_accessor :cfg # configuration file
18
- attr_accessor :cfg_server # shortcut to the choosen server configs
19
- attr_accessor :req # api request
20
-
21
- def initialize_cfg
22
- config_file = File.join(File.dirname(__FILE__), '..', '..', 'config.yml')
23
- unless File.exist?(config_file)
24
- throw Exception.new(config_file + " does not exists. Copy the example and configure your server.")
25
- end
26
- config = YAML.load_file(config_file)
27
- config
28
- end
29
-
30
- def initialize_cfg_server
31
- if ENV['SERVER']
32
- unless self.cfg['servers'].has_key?(ENV['SERVER'])
33
- throw Exception.new("Server #{ENV['SERVER']} does not exists in your configuration file.")
34
- end
35
- server = self.cfg['servers'][ENV['SERVER']]
36
- else
37
- server = self.cfg['servers'][self.cfg['servers'].keys.first]
38
- end
39
- server['version'] = '0.7' unless server.has_key?('version')
40
- server
41
- end
42
-
43
- def load
44
- self.cfg = initialize_cfg
45
- self.cfg_server = initialize_cfg_server
46
- self.req = BigBlueButtonAPITests::APIRequest.new
47
- end
48
-
49
- end
50
- end
51
- end