-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from retupmoca/freebusy
Add the ability to fetch free/busy information for a user
- Loading branch information
Showing
7 changed files
with
199 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
package EWS::Calendar::Role::RetrieveAvailability; | ||
BEGIN { | ||
$EWS::Calendar::Role::RetrieveWithinWindow::VERSION = '1.141040'; | ||
} | ||
use Moose::Role; | ||
|
||
sub retrieve_availability { | ||
my ($self, $opts) = @_; | ||
|
||
# GetUserAvailability docs: | ||
# http://msdn.microsoft.com/en-us/library/office/aa564001%28v=exchg.140%29.aspx | ||
my ($response, $trace) = $self->client->GetUserAvailability->( | ||
TimeZone => { | ||
Bias => 0, | ||
StandardTime => { | ||
Bias => 0, | ||
Time => '00:00:00', | ||
DayOrder => 0, | ||
Month => 0, | ||
DayOfWeek => 'Sunday', | ||
}, | ||
DaylightTime => { | ||
Bias => 0, | ||
Time => '00:00:00', | ||
DayOrder => 0, | ||
Month => 0, | ||
DayOfWeek => 'Sunday', | ||
}, | ||
}, | ||
MailboxDataArray => { | ||
MailboxData => { | ||
Email => { | ||
Address => $opts->{email}, | ||
}, | ||
AttendeeType => 'Required', | ||
ExcludeConflicts => 'false', | ||
}, | ||
}, | ||
FreeBusyViewOptions => { | ||
TimeWindow => { | ||
StartTime => $opts->{window}->start->iso8601, | ||
EndTime => $opts->{window}->end->iso8601, | ||
}, | ||
RequestedView => 'MergedOnly', | ||
MergedFreeBusyIntervalInMinutes => 15, | ||
}, | ||
); | ||
|
||
use Data::Dumper; | ||
print Dumper($trace); | ||
print Dumper($response); | ||
|
||
if($response->{GetUserAvailabilityResult} | ||
->{FreeBusyResponseArray} | ||
->{FreeBusyResponse}->[0] | ||
->{ResponseMessage} | ||
->{ResponseClass} ne 'Success'){ | ||
return $response->{GetUserAvailabilityResult} | ||
->{FreeBusyResponseArray} | ||
->{FreeBusyResponse}->[0] | ||
->{ResponseMessage} | ||
->{MessageText}; | ||
} | ||
# MergedFreeBusy: http://msdn.microsoft.com/en-us/library/office/aa566048%28v=exchg.140%29.aspx | ||
my $merged = $response->{GetUserAvailabilityResult} | ||
->{FreeBusyResponseArray} | ||
->{FreeBusyResponse}->[0] | ||
->{FreeBusyView} | ||
->{MergedFreeBusy}; | ||
|
||
# actual interface? | ||
return split('', $merged); | ||
} | ||
|
||
no Moose::Role; | ||
1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package EWS::Client::Role::GetUserAvailability; | ||
BEGIN { | ||
$EWS::Client::Role::GetFolder::VERSION = '1.141040'; | ||
} | ||
|
||
use Moose::Role; | ||
|
||
has GetUserAvailability => ( | ||
is => 'ro', | ||
isa => 'CodeRef', | ||
lazy_build => 1, | ||
); | ||
|
||
sub _build_GetUserAvailability { | ||
my $self = shift; | ||
return $self->wsdl->compileClient( | ||
operation => 'GetUserAvailability', | ||
transport => $self->transporter->compileClient( | ||
action => 'http://schemas.microsoft.com/exchange/services/2006/messages/GetUserAvailability' ), | ||
); | ||
} | ||
|
||
no Moose::Role; | ||
1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package EWS::Client::Role::ResolveNames; | ||
BEGIN { | ||
$EWS::Client::Role::FindItem::VERSION = '1.141040'; | ||
} | ||
use Moose::Role; | ||
|
||
has ResolveNames => ( | ||
is => 'ro', | ||
isa => 'CodeRef', | ||
lazy_build => 1, | ||
); | ||
|
||
sub _build_ResolveNames { | ||
my $self = shift; | ||
return $self->wsdl->compileClient( | ||
operation => 'ResolveNames', | ||
transport => $self->transporter->compileClient( | ||
action => 'http://schemas.microsoft.com/exchange/services/2006/messages/ResolveNames' ), | ||
); | ||
} | ||
|
||
no Moose::Role; | ||
1; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters