Bb-Collaborate-V3
view release on metacpan or search on metacpan
lib/Bb/Collaborate/V3.pm view on Meta::CPAN
the SOAP connection or authentication failed.
See also Bb::Collaborate::V3::Connection.
=cut
sub connect {
my ($class, $url, $login_name, $pass, %opts) = @_;
die "usage: ${class}->connect(url, [login_name], [pass])"
unless ($class && $url);
require Bb::Collaborate::V3::Connection;
my $connection = Bb::Collaborate::V3::Connection->connect(
$url,
$login_name,
$pass,
debug => $class->debug,
%opts,
);
$class->connection($connection);
return $connection;
}
=head2 connection
$e1 = Bb::Collaborate::V3->connection
or warn 'no elive connection active';
Returns the default Elive connection handle.
=cut
=head2 update
Abstract method to commit outstanding object updates to the server.
$obj->{foo} = 'Foo'; # change foo attribute directly
$foo->update; # save
$obj->bar('Bar'); # change bar via its accessor
$obj->update; # save
Updates may also be passed as parameters.
# change and save foo and bar. All in one go.
$obj->update({foo => 'Foo', bar => 'Bar'});
C<update> can also be called as a class-level method. The primary key and all other
required fields must be specified.
my $obj = Bb::Collaborate::V3::Session->update({sessionId => 123456,
startTime => '1448922188000',
... });
=cut
sub update {
my ($class, $data, %opt) = @_;
$opt{command} ||= 'Set'.$class->entity_name;
return $class->SUPER::update($data, %opt);
}
sub _fetch {
my ($class, $key, %opt) = @_;
#
# Let the connection resolve which command to use
#
$opt{command} ||=
['Get'.$class->entity_name,
'List'.$class->entity_name];
return $class->SUPER::_fetch($key, %opt);
}
=head2 insert
Abstract method to create new entity instances on the server:
my $multimedia = Bb::Collaborate::V3::Multimedia->insert(
{
filename => 'demo.wav',
creatorId => 'bob',
content => $content,
},
);
=cut
sub insert {
my ($class, $data, @params) = @_;
#
# allow for recurring sessions
#
my @sessions = $class->SUPER::insert($data, command => 'Set'.$class->entity_name, @params);
return wantarray? @sessions : $sessions[0];
}
=head2 list
Abstract selection method. Most commands allow a ranging expression to narrow
the selection. This is passed in using the C<filter> option. For example:
my $bobs_sessions = Bb::Collaborate::V3::Session->list( filter => {userId => 'bob'});
=cut
sub list {
my $self = shift;
my %opt = @_;
if (my $filter = delete $opt{filter} ) {
( run in 0.928 second using v1.01-cache-2.11-cpan-9581c071862 )