Elive/Entity/ServerParameters.pm

filter: Statementstmt 71.8% 46 / 64 Branchbran 12.5% 1 / 8 Conditioncond 16.6% 1 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 60.0% 6 / 10 Podpod 100% 4 / 4 totaltotal 60.4% 58 / 96 CC 8 SCAR 27.8
CC
8
Cov
62%
update
42.0
_thaw
3.4
insert
2.0
CRAP 16.1
« Elive/DAO.pm ↑ Summary Elive/Util.pm »
1 package Elive::Entity::ServerParameters;
2 22 ▶use warnings; use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 22 ▶use Mouse;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 22 ▶use Mouse::Util::TypeConstraints;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 22 extends 'Elive::Entity';
8  
9 22 __PACKAGE__->entity_name('ServerParameters');
10 22 __PACKAGE__->_isa('Meeting');
11  
12 coerce 'Elive::Entity::ServerParameters' => from 'HashRef'
13 1 ▶ => via {Elive::Entity::ServerParameters->new($_) };
Subroutine __ANON__: called CC=1 SCAR=0.0
14  
15 22 has 'meetingId' => (is => 'rw', isa => 'Int', required => 1,
16 documentation => 'associated meeting');
17 22 __PACKAGE__->primary_key('meetingId');
18  
19 22 has 'seats' => (is => 'rw', isa => 'Int',
20 documentation => 'Number of available seats');
21 22 __PACKAGE__->_alias(requiredSeats => 'seats');
22  
23 22 has 'boundaryMinutes' => (is => 'rw', isa => 'Int',
24 documentation => 'meeting boundary time (minutes)');
25 22 __PACKAGE__->_alias(boundary => 'boundaryMinutes', freeze => 1);
26 22 __PACKAGE__->_alias(boundaryTime => 'boundaryMinutes'); # v 9.5.0 +
27  
28 22 has 'fullPermissions' => (is => 'rw', isa => 'Bool', required => 1,
29 documentation => 'whether participants can perform activities (e.g. use whiteboard) before the supervisor arrives');
30 22 __PACKAGE__->_alias(permissionsOn => 'fullPermissions', freeze => 1);
31 22 __PACKAGE__->_alias(permissions => 'fullPermissions');
32  
33 22 has 'supervised' => (is => 'rw', isa => 'Bool',
34 documentation => 'whether the moderator can see private messages');
35  
36 22 has 'enableTelephony'
37 => (is => 'rw', isa => 'Bool',
38 documentation => 'Telephony is enabled');
39  
40 22 has 'telephonyType'
41 => (is => 'rw', isa => 'Str',
42 documentation => 'Can be either SIP/PHONE.' );
43  
44 22 has 'moderatorTelephonyAddress'
45 => (is => 'rw', isa => 'Str',
46 documentation => 'Either a PHONE number or SIP address for the moderator for telephone');
47  
48 22 has 'moderatorTelephonyPIN'
49 => (is => 'rw', isa => 'Str',
50 documentation => 'PIN for moderator telephony');
51  
52 22 has 'participantTelephonyAddress'
53 => (is => 'rw', isa => 'Str',
54 documentation => 'Either a PHONE number or SIP address for the participants for telephone');
55  
56 22 has 'participantTelephonyPIN'
57 => (is => 'rw', isa => 'Str',
58 documentation => 'PIN for participants telephony');
59  
60 22 has 'serverTelephonyAddress'
61 => (is => 'rw', isa => 'Str',
62 documentation => 'Either a PHONE number or SIP address for the server');
63  
64 22 has 'serverTelephonyPIN'
65 => (is => 'rw', isa => 'Str',
66 documentation => 'PIN for the server');
67  
68 22 has 'serverTelephonyAddress'
69 => (is => 'rw', isa => 'Str',
70 documentation => 'Either a PHONE number or SIP address for the server');
71  
72 22 has 'redirectURL' => (is => 'rw', isa => 'Str',
73 documentation => 'URL to redirect users to after the online session is over.');
74  
75 ## Mispellings in toolkit - Required to support Elm 3.0 / Elive 9.5.0
76 22 __PACKAGE__->_alias(ModertatorTelephonyAddress => 'ModeratorTelephonyAddress');
77 22 __PACKAGE__->_alias(ModertatorTelephonyPIN => 'ModeratorTelephonyPIN');
78  
79 =head1 NAME
80  
81 Elive::Entity::ServerParameters - Meeting server parameters entity class
82  
83 =head1 SYNOPSIS
84  
85 Note: the C<insert()> and C<update()> methods are depreciated. For alternatives
86 please see L<Elive::Entity::Session>.
87  
88 my $meeting = Elive::Entity::Meeting->insert( \%meeting_data );
89 my $server_params $meeting->server_parameters;
90  
91 $server_params->update({
92 boundaryMinutes => 15,
93 fullPermissions => 0,
94 supervised => 1,
95 enableTelephony => 0,
96 seats => 18,
97 });
98  
99 =head1 DESCRIPTION
100  
101 The server parameters entity contains additional meeting options.
102  
103 =cut
104  
105 =head1 METHODS
106  
107 =cut
108  
109 =head2 retrieve
110  
111 my $server_paremeters = Elive::Entity::ServerParameters->retrieve($meeting_id);
112  
113 Retrieves the server parameters for a meeting.
114  
115 =cut
116  
117 =head2 insert
118  
119 The insert method is not applicable. The meeting server parameters entity
120 is automatically created when you create a meeting.
121  
122 =cut
123  
124 0 ▶sub insert {return shift->_not_available}
Subroutine insert: not called CC=1 SCAR=6.9
Pod documented
125  
126 =head2 delete
127  
128 The delete method is not applicable. meeting server parameters are deleted
129 when the meeting itself is deleted.
130  
131 =cut
132  
133 0 ▶sub delete {return shift->_not_available}
Subroutine delete: not called CC=1 SCAR=6.9
Pod documented
134  
135 =head2 list
136  
137 The list method is not available for meeting parameters.
138  
139 =cut
140  
141 0 ▶sub list {return shift->_not_available}
Subroutine list: not called CC=1 SCAR=6.9
Pod documented
142  
143 =head2 update
144  
145 my $server_parameters
146 = Elive::Entity::ServerParameters->fetch([$meeting_id]);
147  
148 $server_parameters->update({
149 boundaryMinutes => 15,
150 fullPermissions => 1,
151 supervised => 1,
152 });
153  
154 Updates the meeting boundary times, permissions and whether the meeting is
155 supervised.
156  
157 =cut
158  
159 sub update {
160 0 ▶ my ($self, $update_data, %opt) = @_;
Subroutine update: not called CC=6 SCAR=37.4
Pod documented
161  
162 0 ▶ $self->set( %$update_data)
Branch: 1 branch
BranchTrueFalseTotal
if keys %$update_data 0 0 0
163 if (keys %$update_data);
164 #
165 # Command Toolkit seems to require a setting for fullPermissions (aka
166 # permissionsOn); always pass it through.
167 #
168 0 my @required = qw/boundaryMinutes fullPermissions supervised/;
169 0 my %changed;
170 0 @changed{@required, $self->is_changed} = undef;
171  
172 0 foreach (@required) {
173 die "missing required property: $_"
174 0 ▶ unless defined $self->{$_};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{$_} 0 0 0
175 }
176  
177 #
178 # direct changes to seats are ignored. This needs to be intercepted
179 # and routed to the updateMeeting command.
180 #
181 0 ▶ if (exists $changed{seats}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $changed{"seats"}) 0 0 0
182 0 delete $changed{seats};
183  
184 0 my $meeting_params = Elive::Entity::Meeting->_freeze({
185 meetingId => $self,
186 seats => $self->seats,
187 });
188  
189 0 ▶ my $connection = $opt{connection} || $self->connection;
Condition0%0/3
$opt{'connection'} || $self->connection
l!l&&r!l&&!r
000
MC/DC0%0/2
$opt{'connection'} || $self->connection
$opt{'connection'} $self->connection
Truth table0%0/3
A || B
A= $opt{'connection'}B= $self->connection
ABresult
1X1
011
000
190  
191 0 my $som = $connection->call(updateMeeting => %$meeting_params);
192 0 $connection->_check_for_errors($som);
193 }
194 #
195 # This command barfs if we don't write values back, whether they've
196 # changed or not.
197 #
198 0 return $self->SUPER::update(undef, %opt, changed => [sort keys %changed]);
199 }
200  
201 #
202 # elm 3.x may throw back a complex type for telephonyType, something like:
203 # {Name: 'PHONE', Ordinal: 1, TelephonyType: 1}. Dereference this, when it
204 # happens, to obtain the underlying database value 'PHONE'.
205 #
206  
207 sub _thaw {
208 1 ▶ my ($class, $db_data, @args) = @_;
Subroutine _thaw: called CC=3 SCAR=12.3
209 1 my $thawed = $class->SUPER::_thaw($db_data, @args);
210  
211 1 my $telephonyType = $thawed->{telephonyType};
212 1 ▶ if (Elive::Util::_reftype($telephonyType) eq 'HASH'
Branch: 1 branch
BranchTrueFalseTotal
if (Elive::Util::_reftype($telephonyType) eq "HASH" and my $name = $telephonyType->{"Name"}) 0 1 1
Condition33%1/3
Elive::Util::_reftype($telephonyType) eq "HASH" and my $name = $telephonyType->{"Name"}
!ll&&!rl&&r
100
MC/DC0%0/2
Elive::Util::_reftype($telephonyType) eq "HASH" and my $name = $telephonyType->{"Name"}
Elive::Util::_reftype($telephonyType) eq "HASH" my $name = $telephonyType->{"Name"}
Truth table33%1/3
A and B
A= Elive::Util::_reftype($telephonyType) eq "HASH"B= my $name = $telephonyType->{"Name"}
ABresult
0X0
100
111
213 && (my $name = $telephonyType->{Name})) {
214 0 $thawed->{telephonyType} = $name;
215 }
216  
217 1 return $thawed;
218 }
219  
220 =head1 See Also
221  
222 L<Elive::Entity::Session>
223  
224 =cut
225  
226 22 1;
« Elive/DAO.pm ↑ Summary Elive/Util.pm »