bigbluebutton-api-ruby 0.0.4
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.
- data/LICENSE +22 -0
- data/README +41 -0
- data/Rakefile +48 -0
- data/doc/classes/BigBlueButton.html +112 -0
- data/doc/classes/BigBlueButton/BigBlueButtonApi.html +657 -0
- data/doc/classes/BigBlueButton/BigBlueButtonException.html +111 -0
- data/doc/classes/Hash.html +269 -0
- data/doc/created.rid +1 -0
- data/doc/files/LICENSE.html +133 -0
- data/doc/files/README.html +182 -0
- data/doc/files/lib/bigbluebutton-api_rb.html +114 -0
- data/doc/files/lib/hash_to_xml_rb.html +111 -0
- data/doc/fr_class_index.html +30 -0
- data/doc/fr_file_index.html +30 -0
- data/doc/fr_method_index.html +41 -0
- data/doc/index.html +24 -0
- data/doc/rdoc-style.css +208 -0
- data/lib/bigbluebutton-api.rb +203 -0
- data/lib/hash_to_xml.rb +62 -0
- data/lib/hash_to_xml.rb~ +62 -0
- data/test/config.yml +11 -0
- data/test/config.yml.example +9 -0
- data/test/config.yml.example~ +9 -0
- data/test/config.yml~ +9 -0
- data/test/test.rb +129 -0
- metadata +92 -0
data/lib/hash_to_xml.rb
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Code from: https://gist.github.com/335286
|
|
2
|
+
# USAGE: Hash.from_xml:(YOUR_XML_STRING)
|
|
3
|
+
# modified from http://stackoverflow.com/questions/1230741/convert-a-nokogiri-document-to-a-ruby-hash/1231297#1231297
|
|
4
|
+
|
|
5
|
+
class Hash
|
|
6
|
+
class << self
|
|
7
|
+
def from_xml(xml_io)
|
|
8
|
+
begin
|
|
9
|
+
result = Nokogiri::XML(xml_io)
|
|
10
|
+
return { result.root.name.to_sym => xml_node_to_hash(result.root)}
|
|
11
|
+
rescue Exception => e
|
|
12
|
+
raise BigBlueButton::BigBlueButtonException.new("BigBlueButton error: Impossible to convert XML to hash. Error: #{e.message}")
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def xml_node_to_hash(node)
|
|
17
|
+
# If we are at the root of the document, start the hash
|
|
18
|
+
if node.element?
|
|
19
|
+
result_hash = {}
|
|
20
|
+
if node.attributes != {}
|
|
21
|
+
result_hash[:attributes] = {}
|
|
22
|
+
node.attributes.keys.each do |key|
|
|
23
|
+
result_hash[:attributes][node.attributes[key].name.to_sym] = prepare(node.attributes[key].value)
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
if node.children.size > 0
|
|
27
|
+
node.children.each do |child|
|
|
28
|
+
result = xml_node_to_hash(child)
|
|
29
|
+
|
|
30
|
+
if child.name == "text"
|
|
31
|
+
unless child.next_sibling || child.previous_sibling
|
|
32
|
+
return prepare(result)
|
|
33
|
+
end
|
|
34
|
+
elsif result_hash[child.name.to_sym]
|
|
35
|
+
if result_hash[child.name.to_sym].is_a?(Object::Array)
|
|
36
|
+
result_hash[child.name.to_sym] << prepare(result)
|
|
37
|
+
else
|
|
38
|
+
result_hash[child.name.to_sym] = [result_hash[child.name.to_sym]] << prepare(result)
|
|
39
|
+
end
|
|
40
|
+
else
|
|
41
|
+
result_hash[child.name.to_sym] = prepare(result)
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
return result_hash
|
|
46
|
+
else
|
|
47
|
+
return result_hash
|
|
48
|
+
end
|
|
49
|
+
else
|
|
50
|
+
return prepare(node.content.to_s)
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def prepare(data)
|
|
55
|
+
(data.class == String && data.to_i.to_s == data) ? data.to_i : data
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def to_struct(struct_name)
|
|
60
|
+
Struct.new(struct_name,*keys).new(*values)
|
|
61
|
+
end
|
|
62
|
+
end
|
data/lib/hash_to_xml.rb~
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Code from: https://gist.github.com/335286
|
|
2
|
+
# USAGE: Hash.from_xml:(YOUR_XML_STRING)
|
|
3
|
+
# modified from http://stackoverflow.com/questions/1230741/convert-a-nokogiri-document-to-a-ruby-hash/1231297#1231297
|
|
4
|
+
|
|
5
|
+
class Hash
|
|
6
|
+
class << self
|
|
7
|
+
def from_xml(xml_io)
|
|
8
|
+
begin
|
|
9
|
+
result = Nokogiri::XML(xml_io)
|
|
10
|
+
return { result.root.name.to_sym => xml_node_to_hash(result.root)}
|
|
11
|
+
rescue Exception => e
|
|
12
|
+
# raise your custom exception here
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def xml_node_to_hash(node)
|
|
17
|
+
# If we are at the root of the document, start the hash
|
|
18
|
+
if node.element?
|
|
19
|
+
result_hash = {}
|
|
20
|
+
if node.attributes != {}
|
|
21
|
+
result_hash[:attributes] = {}
|
|
22
|
+
node.attributes.keys.each do |key|
|
|
23
|
+
result_hash[:attributes][node.attributes[key].name.to_sym] = prepare(node.attributes[key].value)
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
if node.children.size > 0
|
|
27
|
+
node.children.each do |child|
|
|
28
|
+
result = xml_node_to_hash(child)
|
|
29
|
+
|
|
30
|
+
if child.name == "text"
|
|
31
|
+
unless child.next_sibling || child.previous_sibling
|
|
32
|
+
return prepare(result)
|
|
33
|
+
end
|
|
34
|
+
elsif result_hash[child.name.to_sym]
|
|
35
|
+
if result_hash[child.name.to_sym].is_a?(Object::Array)
|
|
36
|
+
result_hash[child.name.to_sym] << prepare(result)
|
|
37
|
+
else
|
|
38
|
+
result_hash[child.name.to_sym] = [result_hash[child.name.to_sym]] << prepare(result)
|
|
39
|
+
end
|
|
40
|
+
else
|
|
41
|
+
result_hash[child.name.to_sym] = prepare(result)
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
return result_hash
|
|
46
|
+
else
|
|
47
|
+
return result_hash
|
|
48
|
+
end
|
|
49
|
+
else
|
|
50
|
+
return prepare(node.content.to_s)
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def prepare(data)
|
|
55
|
+
(data.class == String && data.to_i.to_s == data) ? data.to_i : data
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def to_struct(struct_name)
|
|
60
|
+
Struct.new(struct_name,*keys).new(*values)
|
|
61
|
+
end
|
|
62
|
+
end
|
data/test/config.yml
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
bbb_salt: '9465875d2c443fa2988e2293fb535eaf'
|
|
2
|
+
bbb_url: 'http://devbbb-mconf.no-ip.org/bigbluebutton/api'
|
|
3
|
+
#bbb_salt: '426c6d5d2c443fa2558e218dfb535e66'
|
|
4
|
+
#bbb_url: 'http://bbb-mconf.no-ip.org/bigbluebutton/api'
|
|
5
|
+
bbb_version: '0.7'
|
|
6
|
+
meeting_id: 'bigbluebutton-api-ruby-test'
|
|
7
|
+
meeting_name: 'Test Meeting For Ruby Gem'
|
|
8
|
+
moderator_name: 'House'
|
|
9
|
+
moderator_password: '4321'
|
|
10
|
+
attendee_name: 'Cameron'
|
|
11
|
+
attendee_password: '1234'
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
bbb_salt: 'insert-a-valid-salt-here'
|
|
2
|
+
bbb_url: 'http://devbuild.bigbluebutton.org/bigbluebutton/api'
|
|
3
|
+
bbb_version: '0.7'
|
|
4
|
+
meeting_id: 'bigbluebutton-api-ruby-test'
|
|
5
|
+
meeting_name: 'Test Meeting For Ruby Gem'
|
|
6
|
+
moderator_name: 'House'
|
|
7
|
+
moderator_password: '4321'
|
|
8
|
+
attendee_name: 'Cameron'
|
|
9
|
+
attendee_password: '1234'
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
bbb_salt: '639259d4-9dd8-4b25-bf01-95f9567eaf4b'
|
|
2
|
+
bbb_url: 'http://devbuild.bigbluebutton.org/bigbluebutton/api'
|
|
3
|
+
bbb_version: '0.7'
|
|
4
|
+
meeting_id: 'bigbluebutton-api-ruby-test4'
|
|
5
|
+
meeting_name: 'Test Meeting For Ruby Gem'
|
|
6
|
+
moderator_name: 'Jake'
|
|
7
|
+
moderator_password: '4321'
|
|
8
|
+
attendee_name: 'Eben'
|
|
9
|
+
attendee_password: '1234'
|
data/test/config.yml~
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
bbb_salt: 'insert-a-valid-salt-here'
|
|
2
|
+
bbb_url: 'http://devbuild.bigbluebutton.org/bigbluebutton/api'
|
|
3
|
+
bbb_version: '0.7'
|
|
4
|
+
meeting_id: 'bigbluebutton-api-ruby-test'
|
|
5
|
+
meeting_name: 'Test Meeting For Ruby Gem'
|
|
6
|
+
moderator_name: 'House'
|
|
7
|
+
moderator_password: '4321'
|
|
8
|
+
attendee_name: 'Cameron'
|
|
9
|
+
attendee_password: '1234'
|
data/test/test.rb
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
require 'bigbluebutton-api'
|
|
2
|
+
require 'thread'
|
|
3
|
+
require 'yaml'
|
|
4
|
+
|
|
5
|
+
def prepare
|
|
6
|
+
|
|
7
|
+
config_file = 'test/config.yml'
|
|
8
|
+
unless File.exist? config_file
|
|
9
|
+
puts config_file + " does not exists. Copy the example and configure your server."
|
|
10
|
+
puts "cp test/config.yml.example test/config.yml"
|
|
11
|
+
puts
|
|
12
|
+
Kernel.exit!
|
|
13
|
+
end
|
|
14
|
+
@config = YAML.load_file(config_file)
|
|
15
|
+
|
|
16
|
+
puts "config:"
|
|
17
|
+
@config.each do |k,v|
|
|
18
|
+
puts k + ": " + v
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
@api = BigBlueButton::BigBlueButtonApi.new(@config['bbb_url'], @config['bbb_salt'], @config['bbb_version'].to_s, true)
|
|
22
|
+
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def general_test
|
|
26
|
+
|
|
27
|
+
puts
|
|
28
|
+
puts "---------------------------------------------------"
|
|
29
|
+
response = @api.get_meetings
|
|
30
|
+
puts "Existent meetings in your server:"
|
|
31
|
+
if response[:meetings].empty?
|
|
32
|
+
puts "No meetings found"
|
|
33
|
+
else
|
|
34
|
+
node = response[:meetings][:meeting]
|
|
35
|
+
if node.kind_of?(Array)
|
|
36
|
+
node.each do |m|
|
|
37
|
+
puts " " + m[:meetingID] + ": " + m.inspect
|
|
38
|
+
end
|
|
39
|
+
else
|
|
40
|
+
puts " " + node[:meetingID] + ": " + node.inspect
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
puts
|
|
45
|
+
puts "---------------------------------------------------"
|
|
46
|
+
@api.create_meeting(@config['meeting_name'], @config['meeting_id'], @config['moderator_password'], @config['attendee_password'],
|
|
47
|
+
'Welcome to my meeting', '1-800-000-0000x00000#', 'https://github.com/mconf/bigbluebutton-api-ruby', 10)
|
|
48
|
+
puts "The meeting has been created. Please open a web browser and enter the meeting using either of the below URLs."
|
|
49
|
+
|
|
50
|
+
puts
|
|
51
|
+
puts "---------------------------------------------------"
|
|
52
|
+
url = @api.moderator_url(@config['meeting_id'], @config['moderator_name'], @config['moderator_password'])
|
|
53
|
+
puts "1) Moderator URL = #{url}"
|
|
54
|
+
puts ""
|
|
55
|
+
url = @api.attendee_url(@config['meeting_id'], @config['attendee_name'], @config['attendee_password'])
|
|
56
|
+
puts "2) Attendee URL = #{url}"
|
|
57
|
+
|
|
58
|
+
puts
|
|
59
|
+
puts "---------------------------------------------------"
|
|
60
|
+
puts "Waiting 30 seconds for you to enter via browser"
|
|
61
|
+
sleep(30)
|
|
62
|
+
|
|
63
|
+
unless @api.is_meeting_running?(@config['meeting_id'])
|
|
64
|
+
puts "You have NOT entered the meeting"
|
|
65
|
+
Kernel.exit!
|
|
66
|
+
end
|
|
67
|
+
puts "You have successfully entered the meeting"
|
|
68
|
+
|
|
69
|
+
puts
|
|
70
|
+
puts "---------------------------------------------------"
|
|
71
|
+
response = @api.get_meeting_info(@config['meeting_id'], @config['moderator_password'])
|
|
72
|
+
puts "Meeting info:"
|
|
73
|
+
puts response.inspect
|
|
74
|
+
|
|
75
|
+
puts
|
|
76
|
+
puts "---------------------------------------------------"
|
|
77
|
+
@api.end_meeting(@config['meeting_id'], @config['moderator_password'])
|
|
78
|
+
puts "The meeting has been ended"
|
|
79
|
+
|
|
80
|
+
rescue Exception => ex
|
|
81
|
+
puts "Failed with error #{ex.message}"
|
|
82
|
+
puts ex.backtrace
|
|
83
|
+
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def join_test
|
|
87
|
+
unless @api.is_meeting_running?(@config['meeting_id'])
|
|
88
|
+
@api.create_meeting(@config['meeting_name'], @config['meeting_id'], @config['moderator_password'], @config['attendee_password'],
|
|
89
|
+
'Welcome to my meeting', '1-800-000-0000x00000#', 'https://github.com/mconf/bigbluebutton-api-ruby', 10)
|
|
90
|
+
puts "The meeting has been created. Please open a web browser and enter the meeting as moderator."
|
|
91
|
+
|
|
92
|
+
puts
|
|
93
|
+
puts "---------------------------------------------------"
|
|
94
|
+
url = @api.moderator_url(@config['meeting_id'], @config['moderator_name'], @config['moderator_password'])
|
|
95
|
+
puts "1) Moderator URL = #{url}"
|
|
96
|
+
|
|
97
|
+
puts
|
|
98
|
+
puts "---------------------------------------------------"
|
|
99
|
+
puts "Waiting 30 seconds for you to enter via browser"
|
|
100
|
+
sleep(30)
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
unless @api.is_meeting_running?(@config['meeting_id'])
|
|
104
|
+
puts "You have NOT entered the meeting"
|
|
105
|
+
Kernel.exit!
|
|
106
|
+
end
|
|
107
|
+
puts "You have successfully entered the meeting"
|
|
108
|
+
|
|
109
|
+
puts
|
|
110
|
+
puts "---------------------------------------------------"
|
|
111
|
+
response = @api.get_meeting_info(@config['meeting_id'], @config['moderator_password'])
|
|
112
|
+
puts "Meeting info:"
|
|
113
|
+
puts response.inspect
|
|
114
|
+
|
|
115
|
+
puts
|
|
116
|
+
puts
|
|
117
|
+
puts
|
|
118
|
+
puts "---------------------------------------------------"
|
|
119
|
+
response = @api.join_meeting(@config['meeting_id'], @config['attendee_name'], @config['attendee_password'])
|
|
120
|
+
puts "Join meeting response:"
|
|
121
|
+
puts response.inspect
|
|
122
|
+
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
begin
|
|
126
|
+
prepare
|
|
127
|
+
general_test
|
|
128
|
+
#join_test
|
|
129
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: bigbluebutton-api-ruby
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
hash: 23
|
|
5
|
+
prerelease:
|
|
6
|
+
segments:
|
|
7
|
+
- 0
|
|
8
|
+
- 0
|
|
9
|
+
- 4
|
|
10
|
+
version: 0.0.4
|
|
11
|
+
platform: ruby
|
|
12
|
+
authors:
|
|
13
|
+
- Leonardo Crauss Daronco
|
|
14
|
+
autorequire:
|
|
15
|
+
bindir: bin
|
|
16
|
+
cert_chain: []
|
|
17
|
+
|
|
18
|
+
date: 2011-02-08 00:00:00 -02:00
|
|
19
|
+
default_executable:
|
|
20
|
+
dependencies: []
|
|
21
|
+
|
|
22
|
+
description: Provides an interface to the BigBlueButton web meeting API (https://github.com/mconf/bigbluebutton-api-ruby)
|
|
23
|
+
email: leonardodaronco@gmail.com
|
|
24
|
+
executables: []
|
|
25
|
+
|
|
26
|
+
extensions: []
|
|
27
|
+
|
|
28
|
+
extra_rdoc_files:
|
|
29
|
+
- README
|
|
30
|
+
- LICENSE
|
|
31
|
+
files:
|
|
32
|
+
- LICENSE
|
|
33
|
+
- README
|
|
34
|
+
- Rakefile
|
|
35
|
+
- lib/hash_to_xml.rb
|
|
36
|
+
- lib/hash_to_xml.rb~
|
|
37
|
+
- lib/bigbluebutton-api.rb
|
|
38
|
+
- doc/files/lib/hash_to_xml_rb.html
|
|
39
|
+
- doc/files/lib/bigbluebutton-api_rb.html
|
|
40
|
+
- doc/files/README.html
|
|
41
|
+
- doc/files/LICENSE.html
|
|
42
|
+
- doc/index.html
|
|
43
|
+
- doc/fr_file_index.html
|
|
44
|
+
- doc/fr_class_index.html
|
|
45
|
+
- doc/classes/Hash.html
|
|
46
|
+
- doc/classes/BigBlueButton.html
|
|
47
|
+
- doc/classes/BigBlueButton/BigBlueButtonException.html
|
|
48
|
+
- doc/classes/BigBlueButton/BigBlueButtonApi.html
|
|
49
|
+
- doc/rdoc-style.css
|
|
50
|
+
- doc/created.rid
|
|
51
|
+
- doc/fr_method_index.html
|
|
52
|
+
- test/config.yml~
|
|
53
|
+
- test/test.rb
|
|
54
|
+
- test/config.yml.example~
|
|
55
|
+
- test/config.yml.example
|
|
56
|
+
- test/config.yml
|
|
57
|
+
has_rdoc: true
|
|
58
|
+
homepage: https://github.com/mconf/bigbluebutton-api-ruby/
|
|
59
|
+
licenses: []
|
|
60
|
+
|
|
61
|
+
post_install_message:
|
|
62
|
+
rdoc_options: []
|
|
63
|
+
|
|
64
|
+
require_paths:
|
|
65
|
+
- lib
|
|
66
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
67
|
+
none: false
|
|
68
|
+
requirements:
|
|
69
|
+
- - ">="
|
|
70
|
+
- !ruby/object:Gem::Version
|
|
71
|
+
hash: 3
|
|
72
|
+
segments:
|
|
73
|
+
- 0
|
|
74
|
+
version: "0"
|
|
75
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
76
|
+
none: false
|
|
77
|
+
requirements:
|
|
78
|
+
- - ">="
|
|
79
|
+
- !ruby/object:Gem::Version
|
|
80
|
+
hash: 3
|
|
81
|
+
segments:
|
|
82
|
+
- 0
|
|
83
|
+
version: "0"
|
|
84
|
+
requirements: []
|
|
85
|
+
|
|
86
|
+
rubyforge_project:
|
|
87
|
+
rubygems_version: 1.4.2
|
|
88
|
+
signing_key:
|
|
89
|
+
specification_version: 3
|
|
90
|
+
summary: Provides an interface to the BigBlueButton web meeting API (https://github.com/mconf/bigbluebutton-api-ruby)
|
|
91
|
+
test_files: []
|
|
92
|
+
|