| 1 | package Bb::Collaborate::Ultra::Context; | ||||||||||||||||||||||||||||
| 2 | 2 | ▶ | use warnings; use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | 2 | ▶ | use Mouse; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 2 | extends 'Bb::Collaborate::Ultra::DAO'; | |||||||||||||||||||||||||||
| 5 | 2 | __PACKAGE__->resource('contexts'); | |||||||||||||||||||||||||||
| 6 | 2 | __PACKAGE__->load_schema(<DATA>); | |||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 2 | __PACKAGE__->query_params( | |||||||||||||||||||||||||||
| 9 | name => 'Str', | ||||||||||||||||||||||||||||
| 10 | extId => 'Str', | ||||||||||||||||||||||||||||
| 11 | ); | ||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | =head1 NAME | ||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | Bb::Collaborate::Ultra::Context - Session/recording context | ||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | A Context entity allows for grouping or classification of sessions and associated recordings. | ||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | =head1 METHODS | ||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | This class supports the `get` and `post` methods as described in L<https://xx-csa.bbcollab.com/documentation#Context>. | ||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | =head1 BUGS AND LIMITATIONS | ||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | =cut | ||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | =head2 associate_session | ||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | my $now = time(); | ||||||||||||||||||||||||||||
| 34 | my $session = Bb::Collaborate::Ultra::Session->post($connection, { | ||||||||||||||||||||||||||||
| 35 | name => 'My Session', | ||||||||||||||||||||||||||||
| 36 | startTime => $now, | ||||||||||||||||||||||||||||
| 37 | endTime => $now + 1800, | ||||||||||||||||||||||||||||
| 38 | }, | ||||||||||||||||||||||||||||
| 39 | ); | ||||||||||||||||||||||||||||
| 40 | my $context = Bb::Collaborate::Ultra::Context->find_or_create( | ||||||||||||||||||||||||||||
| 41 | $connection, { | ||||||||||||||||||||||||||||
| 42 | extId => 'demo-sessions', | ||||||||||||||||||||||||||||
| 43 | name => 'Demo Sessions', | ||||||||||||||||||||||||||||
| 44 | }); | ||||||||||||||||||||||||||||
| 45 | $context->associate_session($session); | ||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | # retrieve all sessions that have been associated with this context | ||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | my @sessions = Bb::Collaborate::Ultra::Session->get($connection, {contextId => $context->id, limit => 5}, ) | ||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | =cut | ||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | 0 | ▶ | sub associate_session { | ||||||||||||||||||||||||||
|
Subroutine
associate_session: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 54 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 55 | 0 | my $session = shift; | |||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | 0 | ▶ | die 'usage: $context->associate_session($session)' | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
ref $self and $session
MC/DC0%0/2
ref $self and $session
ref $self
$session
Truth table0%0/3
A and B
A= ref $selfB= $session
| |||||||||||||||||||||||||||||
| 58 | unless ref($self) && $session; | ||||||||||||||||||||||||||||
| 59 | 0 | my $session_id = $session->id; | |||||||||||||||||||||||||||
| 60 | 0 | my $path = $self->path . '/sessions'; | |||||||||||||||||||||||||||
| 61 | 0 | my $json = $session->_freeze( { id => $session_id } ); | |||||||||||||||||||||||||||
| 62 | 0 | $self->connection->POST($path, $json ); | |||||||||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | # downloaded from https://xx-csa.bbcollab.com/documentation | ||||||||||||||||||||||||||||
| 66 | 2 | 1; | |||||||||||||||||||||||||||
| 67 | __DATA__ | ||||||||||||||||||||||||||||