NAME
API::Google::GCal - Google Calendar API client
VERSION
version 0.09
SYNOPSIS
use API::Google::GCal;
my $gapi = API::Google::GCal->new({ tokensfile => 'config.json' });
my $user = 'someuser@gmail.com';
my $calendar_id = 'ooqfhagr1a91u1510ffdf7vfpk@group.calendar.google.com';
my $timeZone = 'Europe/Moscow';
my $event_start = DateTime->now->set_time_zone($timeZone);
my $event_end = DateTime->now->add_duration( DateTime::Duration->new( hours => 2) );
$gapi->refresh_access_token_silent($user); # inherits from API::Google
$gapi->get_calendars($user);
$gapi->get_calendars($user, ['id', 'summary']); # return only specified fields
$gapi->get_calendar_id_by_name($user, 'Contacts');
my $event_data = {};
$event_data->{summary} = 'Exibition';
$event_data->{description} = 'Amazing cats exibition';
$event_data->{location} = 'Angels av. 13';
$event_data->{start}{dateTime} = DateTime::Format::RFC3339->format_datetime($event_start); # '2016-11-11T09:00:00+03:00' format
$event_data->{end}{dateTime} = DateTime::Format::RFC3339->format_datetime($event_end);
$event_data->{start}{timeZone} = $event_data->{end}{timeZone} = $timeZone; # not obligatory
$gapi->add_event($user, $calendar_id, $event_data);
my $freebusy_data = {
user => $user,
calendarId => $calendar_id,
dt_start => DateTime::Format::RFC3339->format_datetime($event_start),
dt_end => DateTime::Format::RFC3339->format_datetime($event_end),
timeZone => 'Europe/Moscow'
};
$gapi->busy_time_ranges($freebusy_data);
$gapi->events_list($freebusy_data);
get_calendars
Get all calendars of particular Google account
get_calendar_id_by_name
Get calendar id by its name. Name = "summary" parameter
add_event
# https://developers.google.com/google-apps/calendar/v3/reference/events/insert
busy_time_ranges
Return List of time ranges during which this calendar should be regarded as busy.
events_list
Return list of events in particular calendar
https://developers.google.com/google-apps/calendar/v3/reference/events/list
Usage:
$gapi->events_list({ calendarID => 'ooqfhagr1a91u1510ffdf7vfpk@group.calendar.google.com', user => 'someuser@gmail.com' });
AUTHOR
Pavel Serikov <pavelsr@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2017 by Pavel Serikov.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.