File Coverage

blib/lib/EWS/Calendar/Role/RetrieveAvailability.pm
Criterion Covered Total %
statement 7 13 53.8
branch 0 2 0.0
condition n/a
subroutine 3 4 75.0
pod 0 1 0.0
total 10 20 50.0


line stmt bran cond sub pod time code
1             package EWS::Calendar::Role::RetrieveAvailability;
2             BEGIN {
3 1     1   835 $EWS::Calendar::Role::RetrieveWithinWindow::VERSION = '1.141040';
4             }
5 1     1   6 use Moose::Role;
  1         2  
  1         9  
6              
7             sub retrieve_availability {
8 0     0 0   my ($self, $opts) = @_;
9              
10             # GetUserAvailability docs:
11             # http://msdn.microsoft.com/en-us/library/office/aa564001%28v=exchg.140%29.aspx
12             my ($response, $trace) = $self->client->GetUserAvailability->(
13             TimeZone => {
14             Bias => 0,
15             StandardTime => {
16             Bias => 0,
17             Time => '00:00:00',
18             DayOrder => 0,
19             Month => 0,
20             DayOfWeek => 'Sunday',
21             },
22             DaylightTime => {
23             Bias => 0,
24             Time => '00:00:00',
25             DayOrder => 0,
26             Month => 0,
27             DayOfWeek => 'Sunday',
28             },
29             },
30             MailboxDataArray => {
31             MailboxData => {
32             Email => {
33             Address => $opts->{email},
34             },
35             AttendeeType => 'Required',
36             ExcludeConflicts => 'false',
37             },
38             },
39             FreeBusyViewOptions => {
40             TimeWindow => {
41             StartTime => $opts->{window}->start->iso8601,
42             EndTime => $opts->{window}->end->iso8601,
43             },
44 0           RequestedView => 'MergedOnly',
45             MergedFreeBusyIntervalInMinutes => 15,
46             },
47             );
48              
49 0 0         if($response->{GetUserAvailabilityResult}
50             ->{FreeBusyResponseArray}
51             ->{FreeBusyResponse}->[0]
52             ->{ResponseMessage}
53             ->{ResponseClass} ne 'Success'){
54             return $response->{GetUserAvailabilityResult}
55             ->{FreeBusyResponseArray}
56             ->{FreeBusyResponse}->[0]
57             ->{ResponseMessage}
58 0           ->{MessageText};
59             }
60             # MergedFreeBusy: http://msdn.microsoft.com/en-us/library/office/aa566048%28v=exchg.140%29.aspx
61             my $merged = $response->{GetUserAvailabilityResult}
62             ->{FreeBusyResponseArray}
63             ->{FreeBusyResponse}->[0]
64             ->{FreeBusyView}
65 0           ->{MergedFreeBusy};
66              
67             # actual interface?
68 0           return split('', $merged);
69             }
70              
71 1     1   5682 no Moose::Role;
  1         3  
  1         4  
72             1;