NAME
Net::Google::Calendar - programmatic access to Google's Calendar API
SYNOPSIS
my $cal = Net::Google::Calendar->new( url => $url );
$cal->login($u, $p);
for ($cal->get_events()) {
print $_->title."\n";
print $_->content->body."\n*****\n\n";
}
my $entry = Net::Google::Calendar::Entry->new();
$entry->title($title);
$entry->content("My content");
$entry->location('London, England');
$entry->transparency('transparent');
$entry->status('confirmed');
$entry->when(DateTime->now, DateTime->now() + DateTime::Duration->new( hours => 6 ) );
my $author = Net::Google::Calendar::Person->new();
$author->name('Foo Bar');
$author->email('foo@bar.com');
$entry->author($author);
my $tmp = $cal->add_entry($entry);
die "Couldn't add event: $@\n" unless defined $tmp;
print "Events=".scalar($cal->get_events())."\n";
$tmp->content('Updated');
$cal->update_entry($tmp) || die "Couldn't update ".$tmp->id.": $@\n";
$cal->delete_entry($tmp) || die "Couldn't delete ".$tmp->id.": $@\n";
DESCRIPTION
Interact with Google's new calendar.
METHODS
new <opts>
Create a new instance. opts is a hash which must contain your private Google url.
See
http://code.google.com/apis/gdata/calendar.html#find_feed_url
for how to get that.
login <username> <password>
Login to google.
get_events [ %opts ]
Return a list of Net::Google::Calendar::Entry objects;
You can pass in a hash of options which map to the Google Data API's generic searching mechanisms plus the specific calendar ones.
See
http://code.google.com/apis/gdata/protocol.html#query-requests
for more details.
- q
-
Full-text query string
When creating a query, list search terms separated by spaces, in the form q=term1 term2 term3. (As with all of the query parameter values, the spaces must be URL encoded.) The GData service returns all entries that match all of the search terms (like using AND between terms). Like Google's web search, a GData service searches on complete words (and related words with the same stem), not substrings.
To search for an exact phrase, enclose the phrase in quotation marks:
q => '"exact phrase'
To exclude entries that match a given term, use the form
q => '-term'
The search is case-insensitive.
Example: to search for all entries that contain the exact phrase 'Elizabeth Bennet' and the word 'Darcy' but don't contain the word 'Austen', use the following query:
q => '"Elizabeth Bennet" Darcy -Austen'
- category
-
Category filter
To search in just one category do
category => 'Fritz'
You can query on multiple categories by listing multiple category parameters. For example
category => [ 'Fritz', 'Laurie' ]
returns entries that match both categories.
To do an OR between terms, use a pipe character (|). For example
category => 'Fritz|Laurie'
returns entries that match either category.
To exclude entries that match a given category, use the form
category => '-categoryname'
You can, of course, mix and match
[ 'Jo', 'Fritz|Laurie', '-Simon' ]
means in category
(Jo AND ( Fritz OR Laurie ) AND (NOT Simon))
-
Entry author
The service returns entries where the author name and/or email address match your query string.
- updated-min
- updated-max
-
Bounds on the entry publication date.
Use DateTime objects or the RFC 3339 timestamp format. For example: 2005-08-09T10:57:00-08:00.
The lower bound is inclusive, whereas the upper bound is exclusive.
- start-min
- start-max
-
Respectively, the earliest event start time to match (If not specified, default is 1970-01-01) and the latest event start time to match (If not specified, default is 2031-01-01).
Use DateTime objects or the RFC 3339 timestamp format. For example: 2005-08-09T10:57:00-08:00.
The lower bound is inclusive, whereas the upper bound is exclusive.
- start-index
-
1-based index of the first result to be retrieved
Note that this isn't a general cursoring mechanism. If you first send a query with
start-index => 1, max-results => 10
and then send another query with
start-index => 11, max-results => 10
the service cannot guarantee that the results are equivalent to
start-index => 1 max-results => 20
because insertions and deletions could have taken place in between the two queries.
- max-results
-
Maximum number of results to be retrieved.
For any service that has a default max-results value (to limit default feed size), you can specify a very large number if you want to receive the entire feed.
- entryID
-
ID of a specific entry to be retrieved.
If you specify an entry ID, you can't specify any other parameters.
get_calendars
Get a list of user's Calendars as Net::Google::Calendar::Entry objects.
set_calendar <Net::Google::Calendar::Entry>
Set the current calendar to use.
add_entry <Net::Google::Calendar::Entry>
Create a new entry.
delete_entry <Net::Google::Calendar::Entry>
Delete a given entry.
update_entry <Net::Google::Calendar::Entry>
Update a given entry.
WARNING
This is ALPHA level software.
Don't use it. Ever. Or something.
TODO
Abstract this out to Net::Google::Data
LATEST VERSION
The latest version can always be obtained from my Subversion repository.
http://unixbeard.net/svn/simon/Net-Google-Calendar
AUTHOR
Simon Wistow <simon@thegestalt.org>
COPYRIGHT
Copyright Simon Wistow, 2006
Distributed under the same terms as Perl itself.
SEE ALSO
http://code.google.com/apis/gdata/calendar.html