line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package API::BigBlueButton; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=encoding utf-8 |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 NAME |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
API::BigBlueButton |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 SYNOPSIS |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
use API::BigBlueButton; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
my $bbb = API::BigBlueButton->new( server => 'bbb.myhost', secret => '1234567890' ); |
14
|
|
|
|
|
|
|
my $res = $bbb->get_version; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
if ( $res->success ) { |
17
|
|
|
|
|
|
|
my $version = $res->response->version |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
else { |
20
|
|
|
|
|
|
|
warn "Error occured: " . $res->error . ", Status: " . $res->status; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 DESCRIPTION |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
client for BigBlueButton API |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=cut |
28
|
|
|
|
|
|
|
|
29
|
3
|
|
|
3
|
|
2188
|
use 5.008008; |
|
3
|
|
|
|
|
10
|
|
30
|
3
|
|
|
3
|
|
27
|
use strict; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
58
|
|
31
|
3
|
|
|
3
|
|
12
|
use warnings; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
100
|
|
32
|
|
|
|
|
|
|
|
33
|
3
|
|
|
3
|
|
17
|
use Carp qw/ confess /; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
157
|
|
34
|
3
|
|
|
3
|
|
2552
|
use LWP::UserAgent; |
|
3
|
|
|
|
|
160175
|
|
|
3
|
|
|
|
|
119
|
|
35
|
|
|
|
|
|
|
|
36
|
3
|
|
|
3
|
|
1396
|
use API::BigBlueButton::Response; |
|
3
|
|
|
|
|
9
|
|
|
3
|
|
|
|
|
115
|
|
37
|
|
|
|
|
|
|
|
38
|
3
|
|
|
3
|
|
21
|
use base qw/ API::BigBlueButton::Requests /; |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
1550
|
|
39
|
|
|
|
|
|
|
|
40
|
3
|
|
|
3
|
|
22
|
use constant REQUIRE_PARAMS => qw/ secret server /; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
1121
|
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
our $VERSION = "0.015"; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 VERSION |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
version 0.015 |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=cut |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 METHODS |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=over |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=item B |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
Constructor |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
%param: |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
server |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
Ip-address or hostname in which the server is located. Required parameter. |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
secret |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
Shared secret. Required parameter. |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
timeout |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
Connection timeout. Optional parameter. |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
use_https |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
Use/not use https. Optional parameter. |
75
|
|
|
|
|
|
|
=cut |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub new { |
78
|
9
|
|
|
9
|
1
|
27214
|
my $class = shift; |
79
|
|
|
|
|
|
|
|
80
|
9
|
|
33
|
|
|
62
|
$class = ref $class || $class; |
81
|
|
|
|
|
|
|
|
82
|
9
|
|
|
|
|
46
|
my $self = { |
83
|
|
|
|
|
|
|
timeout => 30, |
84
|
|
|
|
|
|
|
secret => '', |
85
|
|
|
|
|
|
|
server => '', |
86
|
|
|
|
|
|
|
use_https => 0, |
87
|
|
|
|
|
|
|
(@_), |
88
|
|
|
|
|
|
|
}; |
89
|
|
|
|
|
|
|
|
90
|
9
|
|
|
|
|
25
|
for my $need_param ( REQUIRE_PARAMS ) { |
91
|
16
|
100
|
|
|
|
564
|
confess "Parameter $need_param required!" unless $self->{ $need_param }; |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
6
|
|
|
|
|
27
|
return bless $self, $class; |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
sub abstract_request { |
98
|
10
|
|
|
10
|
0
|
1279
|
my ( $self, $data ) = @_; |
99
|
|
|
|
|
|
|
|
100
|
10
|
|
|
|
|
24
|
my $request = delete $data->{request}; |
101
|
10
|
|
|
|
|
17
|
my $checksum = delete $data->{checksum}; |
102
|
10
|
100
|
|
|
|
152
|
confess "Parameter request required!" unless $request; |
103
|
|
|
|
|
|
|
|
104
|
9
|
50
|
|
|
|
27
|
my $url = $self->{use_https} ? 'https://' : 'http://'; |
105
|
9
|
|
|
|
|
28
|
$url .= $self->{server} . '/bigbluebutton/api/' . $request . '?'; |
106
|
|
|
|
|
|
|
|
107
|
9
|
100
|
|
|
|
18
|
if ( scalar keys %{ $data } > 0 ) { |
|
9
|
|
|
|
|
28
|
|
108
|
7
|
|
|
|
|
26
|
$url .= $self->generate_url_query( $data ); |
109
|
7
|
|
|
|
|
47
|
$url .= '&'; |
110
|
|
|
|
|
|
|
} |
111
|
9
|
|
|
|
|
20
|
$url .= 'checksum=' . $checksum; |
112
|
|
|
|
|
|
|
|
113
|
9
|
|
|
|
|
27
|
return $self->request( $url ); |
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
sub request { |
117
|
0
|
|
|
0
|
0
|
|
my ( $self, $url ) = @_; |
118
|
|
|
|
|
|
|
|
119
|
0
|
|
|
|
|
|
my $ua = LWP::UserAgent->new; |
120
|
|
|
|
|
|
|
|
121
|
0
|
0
|
|
|
|
|
$ua->ssl_opts(verify_hostname => 0) if $self->{use_https}; |
122
|
0
|
|
|
|
|
|
$ua->timeout( $self->{ timeout } ); |
123
|
|
|
|
|
|
|
|
124
|
0
|
|
|
|
|
|
my $res = $ua->get( $url ); |
125
|
|
|
|
|
|
|
|
126
|
0
|
|
|
|
|
|
return API::BigBlueButton::Response->new( $res ); |
127
|
|
|
|
|
|
|
} |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
1; |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
__END__ |