File Coverage

blib/lib/Bb/Collaborate/Ultra/Context.pm
Criterion Covered Total %
statement 9 16 56.2
branch 0 2 0.0
condition 0 3 0.0
subroutine 3 4 75.0
pod 1 1 100.0
total 13 26 50.0


line stmt bran cond sub pod time code
1             package Bb::Collaborate::Ultra::Context;
2 1     1   42848 use warnings; use strict;
  1     1   2  
  1         52  
  1         6  
  1         1  
  1         32  
3 1     1   622 use Mouse;
  1         32635  
  1         5  
4             extends 'Bb::Collaborate::Ultra::DAO';
5             __PACKAGE__->resource('contexts');
6             __PACKAGE__->load_schema();
7              
8             __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.
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             sub associate_session {
54 0     0 1   my $self = shift;
55 0           my $session = shift;
56              
57 0 0 0       die 'usage: $context->associate_session($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             1;
67             __DATA__