NAME

WWW::Contact::GoogleContactsAPI - Get contacts via Google Contacts Data API

SYNOPSIS

use WWW::Contact;
use Data::Dumper;

my $wc = WWW::Contact->new();
my @contacts = $wc->get_contacts('itsa@gmail.com', 'password');
my $errstr   = $wc->errstr;
die $errstr if ($errstr);
print Dumper(\@contacts);

DESCRIPTION

WWW::Contact::GoogleContactsAPI uses the Google Contacts Data API (http://code.google.com/apis/contacts/docs/3.0/reference.html) to retrieve all a user's contacts.

METHODS

$wc->get_contacts($email, $password)

Login to Google using email and password. Fetch all the given user's contacts. Return them as a list or, in a scalar context, as a reference to a list. Each element of the result represents one contact as a reference to a hash with one or more of the following keys (all fields are optional):

name

The contact's main name as a single string. This may be a person's full name or the name of an organisation.

family_name

A person's family name (surname or last name), usually shared with one or both parents.

given_name

A person's given name (christian name or first name).

nickname

An alternative name or alias for the contact.

emails

An ordered list of references to pairs, [$address, $type], where $type is "home", "work", "other" or some custom label and $address is the corresponding e-mail address.

email

The first address in emails, if any. Deprecated: use $contact->{emails}->[0][0].

addresses

As for emails but $address is a postal addresses, given as a single string.

birthday

The date of birth in the form YYYY-MM-DD or --MM-DD.

age

The age in years today, calculated from the date of birth.

events

An ordered list of references to pairs, [$date, $type], where $date is the date of the event in the form YYYY-MM-DD and $type is the type of event, e.g. "anniversary".

instant_messengers

An ordered list of references to pairs, [$protocol, $address], where $protocol is one of gtalk, jabber, msn, skype, yahoo and possibly others.

phones

An ordered list of references to pairs, [$number, $type], where $type is one of home, work, mobile and possibly other values. $number may include punctuation and comments.

updated

The time when this contact was last modified in the form YYYY-MM-DDTHH:MM:SS.SSSZ where T is a literal "T", SS.SSS is seconds and milliseconds as a decimal and Z indicates the UTC time-zone.

notes

Arbitrary text.

child, spouse, etc.

Relations are returned as references to lists of names (even mother and father).

organisations

An ordered list of reference to pairs, [$organisation, $type], where $organisation is a body this contact is associated with and $type is the type of relationship.

groups

A reference to a list of group names

Custom fields

Any custom fields not recognised by the module are returned in the output hash with a simple string value.

SEE ALSO

WWW::Contact, WWW::Mechanize, Net::Google::AuthSub

AUTHORS

Fayland Lam, <fayland at gmail.com> Denis Howe, denis.howe=gc@gmail.com

COPYRIGHT & LICENSE

Copyright 2008 Fayland Lam, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.