1WWW::Google::Contacts(3U)ser Contributed Perl DocumentatiWoWnW::Google::Contacts(3)
2
3
4

NAME

6       WWW::Google::Contacts - Google Contacts Data API
7

CURRENTLY NOT WORKING

9       This module is currently not working. Some time back, Google obsoleted
10       the authentication method used by this module.
11
12       Patches for updating how authentication is handled are more than
13       welcome!
14

SYNOPSIS

16           use WWW::Google::Contacts;
17
18           my $google = WWW::Google::Contacts->new(
19               username => "your.username",
20               password => "your.password",
21               protocol => "https",
22           );
23
24           # Create a new contact
25           my $contact = $google->new_contact;
26           $contact->full_name("Emmett Brown");
27           $contact->name_prefix("Dr");
28           $contact->email('doctor@timetravel.org');
29           $contact->hobby("Time travel");
30           $contact->jot([ "Went back in time", "Went forward in time", "Became blacksmith" ]),
31           $contact->create;  # save it to the server
32
33           # Now search for the given name, and read the jots
34           my @contacts = $google->contacts->search({ given_name => "Emmett" });
35           foreach my $c ( @contacts ) {
36               print "Got the following jots about the good doctor\n";
37               foreach my $jot ( @{ $c->jot } ) {
38                   print "Jot: " . $jot->value . "\n";
39               }
40               print "And now he goes back to the future\n";
41               $c->delete;
42           }
43
44           # Print the names of all groups
45           my $groups = $google->groups;
46           while ( my $group = $groups->next ) {
47               print "Title = " . $group->title . "\n";
48           }
49
50           # Add the contact to existing group 'Movie stars' and to a new group 'Back to the future'
51           my $new_group = $google->new_group({ title => "Back to the future" });
52           $new_group->create;  # create on server
53
54           my @groups = $google->groups->search({ title => "Movie stars" });
55           my $movie_stars_group = shift @groups;
56
57           $contact->add_group_membership( $new_group );
58           $contact->add_group_membership( $movie_stars_group );
59           $contact->update;
60

DESCRIPTION

62       This module implements 'Google Contacts Data API' according
63       <http://code.google.com/apis/contacts/docs/3.0/developers_guide_protocol.html>
64
65       NOTE This new interface is still quite untested. Please report any
66       bugs.
67

CONSTRUCTOR

69   new( username => .., password => .. , protocol => ..)
70       username and password are required arguments and must be valid Google
71       credentials. If you do not have a Google account you can create one at
72       <https://www.google.com/accounts/NewAccount>.
73
74       protocol defaults to http, but can optionally be set to https.
75

METHODS

77   $google->new_contact
78       Returns a new empty WWW::Google::Contacts::Contact object.
79
80   $google->contact( $id )
81       Given a valid contact ID, returns a WWW::Google::Contacts::Contact
82       object populated with contact data from Google.
83
84   $google->contacts
85       Returns a WWW::Google::Contacts::ContactList object which can be used
86       to iterate over all your contacts.
87
88   $google->new_group
89       Returns a new WWW::Google::Contacts::Group object.
90
91   $google->group( $id )
92       Given a valid group ID, returns a WWW::Google::Contacts::Group object
93       populated with group data from Google.
94
95   $google->groups
96       Returns a WWW::Google::Contacts::GroupList object which can be used to
97       iterate over all your groups.
98

DEPRECATED METHODS

100       The old module interface is still available, but its use is
101       discouraged. It will eventually be removed from the module.
102
103       •   new/login
104
105               my $gcontacts = WWW::Google::Contacts->new();
106               $gcontacts->login('fayland@gmail.com', 'pass') or die 'login failed';
107
108       •   create_contact
109
110               $gcontacts->create_contact( {
111                   givenName => 'FayTestG',
112                   familyName => 'FayTestF',
113                   fullName   => 'Fayland Lam',
114                   Notes     => 'just a note',
115                   primaryMail => 'primary@example.com',
116                   displayName => 'FayTest Dis',
117                   secondaryMail => 'secndary@test.com', # optional
118               } );
119
120           return 1 if created
121
122       •   get_contacts
123
124               my @contacts = $gcontacts->get_contacts;
125               my @contacts = $gcontacts->get_contacts( {
126                   group => 'thin', # default to 'full'
127               } )
128               my @contacts = $gcontacts->get_contacts( {
129                   updated-min => '2007-03-16T00:00:00',
130                   start-index => 10,
131                   max-results => 99, # default as 9999
132               } );
133
134           get contacts from this account.
135
136           "group" refers
137           <http://code.google.com/apis/contacts/docs/2.0/reference.html#Projections>
138
139           "start-index", "max_results" etc refer
140           <http://code.google.com/apis/contacts/docs/2.0/reference.html#Parameters>
141
142       •   get_contact($id)
143
144               my $contact = $gcontacts->get_contact('http://www.google.com/m8/feeds/contacts/account%40gmail.com/base/1');
145
146           get a contact by id
147
148       •   update_contact
149
150               my $status = $gcontacts->update_contact('http://www.google.com/m8/feeds/contacts/account%40gmail.com/base/123623e48cb4e70a', {
151                   givenName => 'FayTestG2',
152                   familyName => 'FayTestF2',
153                   fullName   => 'Fayland Lam2',
154                   Notes     => 'just a note2',
155                   primaryMail => 'primary@example2.com',
156                   displayName => 'FayTest2 Dis',
157                   secondaryMail => 'secndary@test62.com', # optional
158               } );
159
160           update a contact
161
162       •   delete_contact($id)
163
164               my $status = $gcontacts->delete_contact('http://www.google.com/m8/feeds/contacts/account%40gmail.com/base/1');
165
166           The id is from "get_contacts".
167
168       •   create_group
169
170               my $status = $gcontacts->create_group( { title => 'Test Group' } );
171
172           Create a new group
173
174       •   get_groups
175
176               my @groups = $gcontacts->get_groups;
177               my @groups = $gcontacts->get_groups( {
178                   updated-min => '2007-03-16T00:00:00',
179                   start-index => 10,
180                   max-results => 99, # default as 9999
181               } );
182
183           Get all groups.
184
185       •   get_group($id)
186
187               my $group = $gcontacts->get_group('http://www.google.com/m8/feeds/groups/account%40gmail.com/base/6e744e7d0a4b398c');
188
189           get a group by id
190
191       •   update_group($id, { title => $title })
192
193               my $status = $gcontacts->update_group( 'http://www.google.com/m8/feeds/groups/account%40gmail.com/base/6e744e7d0a4b398c', { title => 'New Test Group 66' } );
194
195           Update a group
196
197       •   delete_group
198
199               my $status = $gcontacts->delete_contact('http://www.google.com/m8/feeds/groups/account%40gmail.com/base/6e744e7d0a4b398c');
200

SEE ALSO

202       WWW::Google::Contacts::Contact
203
204       WWW::Google::Contacts::ContactList
205
206       WWW::Google::Contacts::Group
207
208       WWW::Google::Contacts::GroupList
209
210       <http://code.google.com/apis/contacts/docs/3.0/developers_guide_protocol.html>
211

ACKNOWLEDGEMENTS

213       Fayland Lam - who wrote the first version of this module
214
215       John Clyde - who shared his code about Contacts API with Fayland
216

TODO

218       More POD
219       Unit tests. Very lame right now
220       Images
221       Fix bugs :)
222

AUTHOR

224         Magnus Erixzon <magnus@erixzon.com>
225
227       This software is copyright (c) 2010 by Magnus Erixzon.
228
229       This is free software; you can redistribute it and/or modify it under
230       the same terms as perl itself.
231
232
233
234perl v5.32.1                      2021-01-27          WWW::Google::Contacts(3)
Impressum