Bb::Collaborate::Ultra::Connection - manage a server connection
This method should be called once, with a newly created Bb::Collaborate::Ultra::Connection object to contact the server and authorize the credentials.
my %credentials = ( issuer => 'OUUK-REST-API12340ABCD', secret => 'ABCDEF0123456789AA', host => 'https://xx-csa.bbcollab.com', ); # connect to server my $connection = Bb::Collaborate::Ultra::Connection->new(\%credentials); $connection->connect;
Returns a clinent connection of type REST::Client.
if ($connection->auth->expires_in < time() + 60) { # connection is about to expire; keep it alive. $connection->renew_lease; }
A authorization token typically remains valid for several minutes. This method can be used to extend the lease, whilst keeping the current connection.
Low level method. Post JSON data formatted data.
my $response = $connection->POST('sessions', '{"startTime":"2016-09-27T05:10:04Z","endTime":"2016-09-27T05:25:04Z","name":"Test Session"}'); my $session = Bb::Collaborate::Ultra::Session->construct($response, connection => $connection);
Generally, you should be using higher level class-specific methods:
my $session = Bb::Collaborate::Ultra::Session->post({startTime => time(), endTime => time() + 900, name => 'Test Session'});
Low level method. Put JSON data formatted data.
my $session_id = $session->id; my $response = $connection->PUT('sessions/'$session_id, '{"name":"Test Session - Updated"}');
Low level method. Get by path
my $session_id = $session->id; my $response = $connection->GET('sessions/'$session_id); $session = Bb::Collaborate::Ultra::Session->construct($response, connection => $connection);
Low level method. Delete by path
my $session_id = $session->id; my $response = $connection->DEL('sessions/'$session_id);
To install Bb::Collaborate::Ultra, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Bb::Collaborate::Ultra
CPAN shell
perl -MCPAN -e shell install Bb::Collaborate::Ultra
For more information on module installation, please visit the detailed CPAN module installation guide.