Elive

 view release on metacpan or  search on metacpan

lib/Elive/Entity/ServerParameters.pm  view on Meta::CPAN

=head1 DESCRIPTION

The server parameters entity contains additional meeting options.

=cut

=head1 METHODS

=cut

=head2 retrieve

    my $server_paremeters = Elive::Entity::ServerParameters->retrieve($meeting_id);

Retrieves the server parameters for a meeting.

=cut

=head2 insert

The insert method is not applicable. The meeting server parameters entity
is automatically created when you create a meeting.

=cut

sub insert {return shift->_not_available}

=head2 delete

The delete method is not applicable. meeting server parameters are deleted
when the meeting itself is deleted.

=cut

sub delete {return shift->_not_available}

=head2 list

The list method is not available for meeting parameters.

=cut

sub list {return shift->_not_available}

=head2 update

    my $server_parameters
         = Elive::Entity::ServerParameters->fetch([$meeting_id]);

    $server_parameters->update({
	    boundaryMinutes => 15,
	    fullPermissions => 1,
	    supervised => 1,
        });

Updates the meeting boundary times, permissions and whether the meeting is
supervised.

=cut

sub update {
    my ($self, $update_data, %opt) = @_;

    $self->set( %$update_data)
	if (keys %$update_data);
    #
    # Command Toolkit seems to require a setting for fullPermissions (aka
    # permissionsOn); always pass it through.
    #
    my @required = qw/boundaryMinutes fullPermissions supervised/;
    my %changed;
    @changed{@required, $self->is_changed} = undef;

    foreach (@required) {
	die "missing required property: $_"
	    unless defined $self->{$_};
    }

    #
    # direct changes to seats are ignored. This needs to be intercepted
    # and routed to the updateMeeting command.
    #
    if (exists $changed{seats}) {
	delete $changed{seats};

	my $meeting_params = Elive::Entity::Meeting->_freeze({
	    meetingId => $self,
	    seats => $self->seats,
	});

	my $connection = $opt{connection} || $self->connection;

	my $som = $connection->call(updateMeeting => %$meeting_params);
	$connection->_check_for_errors($som);
    }
    #
    # This command barfs if we don't write values back, whether they've
    # changed or not.
    #
    return $self->SUPER::update(undef, %opt, changed => [sort keys %changed]);
}

#
# elm 3.x may throw back a complex type for telephonyType, something like:
# {Name: 'PHONE', Ordinal: 1, TelephonyType: 1}. Dereference this, when it
# happens, to obtain the underlying database value 'PHONE'.
#

sub _thaw {
    my ($class, $db_data, @args) = @_;
    my $thawed = $class->SUPER::_thaw($db_data, @args);

    my $telephonyType = $thawed->{telephonyType};
    if (Elive::Util::_reftype($telephonyType) eq 'HASH'
	&& (my $name = $telephonyType->{Name})) {
	$thawed->{telephonyType} = $name;
    }

    return $thawed;
}



( run in 0.513 second using v1.01-cache-2.11-cpan-f56aa216473 )