| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package WWW::Google::Contacts::Group; |
|
2
|
|
|
|
|
|
|
{ |
|
3
|
|
|
|
|
|
|
$WWW::Google::Contacts::Group::VERSION = '0.39'; |
|
4
|
|
|
|
|
|
|
} |
|
5
|
|
|
|
|
|
|
|
|
6
|
17
|
|
|
17
|
|
112
|
use Moose; |
|
|
17
|
|
|
|
|
42
|
|
|
|
17
|
|
|
|
|
196
|
|
|
7
|
17
|
|
|
17
|
|
122833
|
use MooseX::Types::Moose qw( Str ); |
|
|
17
|
|
|
|
|
41
|
|
|
|
17
|
|
|
|
|
234
|
|
|
8
|
17
|
|
|
|
|
160
|
use WWW::Google::Contacts::Types qw( |
|
9
|
|
|
|
|
|
|
Category |
|
10
|
17
|
|
|
17
|
|
95186
|
); |
|
|
17
|
|
|
|
|
48
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
17
|
|
|
17
|
|
189825
|
use WWW::Google::Contacts::Meta::Attribute::Trait::XmlField; |
|
|
17
|
|
|
|
|
47
|
|
|
|
17
|
|
|
|
|
9373
|
|
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub create_url { |
|
15
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
16
|
0
|
|
|
|
|
|
return sprintf( "%s://www.google.com/m8/feeds/groups/default/full", |
|
17
|
|
|
|
|
|
|
$self->server->protocol ); |
|
18
|
|
|
|
|
|
|
} |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
extends 'WWW::Google::Contacts::Base'; |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
with 'WWW::Google::Contacts::Roles::CRUD'; |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
has id => ( |
|
25
|
|
|
|
|
|
|
isa => Str, |
|
26
|
|
|
|
|
|
|
is => 'ro', |
|
27
|
|
|
|
|
|
|
writer => '_set_id', |
|
28
|
|
|
|
|
|
|
predicate => 'has_id', |
|
29
|
|
|
|
|
|
|
traits => ['XmlField'], |
|
30
|
|
|
|
|
|
|
xml_key => 'id', |
|
31
|
|
|
|
|
|
|
); |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
has etag => ( |
|
34
|
|
|
|
|
|
|
isa => Str, |
|
35
|
|
|
|
|
|
|
is => 'ro', |
|
36
|
|
|
|
|
|
|
writer => '_set_etag', |
|
37
|
|
|
|
|
|
|
predicate => 'has_etag', |
|
38
|
|
|
|
|
|
|
traits => ['XmlField'], |
|
39
|
|
|
|
|
|
|
xml_key => 'gd:etag', |
|
40
|
|
|
|
|
|
|
include_in_xml => sub { 0 }, # This is set in HTTP headers |
|
41
|
|
|
|
|
|
|
); |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
has category => ( |
|
44
|
|
|
|
|
|
|
isa => Category, |
|
45
|
|
|
|
|
|
|
is => 'rw', |
|
46
|
|
|
|
|
|
|
predicate => 'has_category', |
|
47
|
|
|
|
|
|
|
traits => ['XmlField'], |
|
48
|
|
|
|
|
|
|
xml_key => 'category', |
|
49
|
|
|
|
|
|
|
default => sub { undef }, |
|
50
|
|
|
|
|
|
|
coerce => 1, |
|
51
|
|
|
|
|
|
|
); |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
has title => ( |
|
54
|
|
|
|
|
|
|
isa => Str, |
|
55
|
|
|
|
|
|
|
is => 'rw', |
|
56
|
|
|
|
|
|
|
predicate => 'has_title', |
|
57
|
|
|
|
|
|
|
traits => ['XmlField'], |
|
58
|
|
|
|
|
|
|
xml_key => 'title', |
|
59
|
|
|
|
|
|
|
is_element => 1, |
|
60
|
|
|
|
|
|
|
); |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
has member => ( |
|
63
|
|
|
|
|
|
|
is => 'ro', |
|
64
|
|
|
|
|
|
|
lazy_build => 1, |
|
65
|
|
|
|
|
|
|
); |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
has link => ( |
|
68
|
|
|
|
|
|
|
is => 'rw', |
|
69
|
|
|
|
|
|
|
trigger => \&_set_link, |
|
70
|
|
|
|
|
|
|
traits => ['XmlField'], |
|
71
|
|
|
|
|
|
|
xml_key => 'link', |
|
72
|
|
|
|
|
|
|
include_in_xml => sub { 0 }, |
|
73
|
|
|
|
|
|
|
); |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
# What to do with different link types |
|
76
|
|
|
|
|
|
|
my $link_map = |
|
77
|
|
|
|
|
|
|
{ 'self' => sub { my ( $self, $link ) = @_; $self->_set_id( $link->{href} ) }, |
|
78
|
|
|
|
|
|
|
}; |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub _set_link { |
|
81
|
0
|
|
|
0
|
|
|
my ( $self, $links ) = @_; |
|
82
|
0
|
0
|
|
|
|
|
$links = ref($links) eq 'ARRAY' ? $links : [$links]; |
|
83
|
0
|
|
|
|
|
|
foreach my $link ( @{$links} ) { |
|
|
0
|
|
|
|
|
|
|
|
84
|
0
|
0
|
|
|
|
|
next unless ( defined $link_map->{ $link->{rel} } ); |
|
85
|
0
|
|
|
|
|
|
my $code = $link_map->{ $link->{rel} }; |
|
86
|
0
|
|
|
|
|
|
$link->{href} =~ s{/full/}{/base/}; |
|
87
|
0
|
|
|
|
|
|
$self->$code($link); |
|
88
|
|
|
|
|
|
|
} |
|
89
|
|
|
|
|
|
|
} |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
sub _build_member { |
|
92
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
93
|
0
|
|
|
|
|
|
my $list = |
|
94
|
|
|
|
|
|
|
WWW::Google::Contacts::ContactList->new( server => $self->server ); |
|
95
|
0
|
|
|
|
|
|
return $list->search( { group_membership => $self->id } ); |
|
96
|
|
|
|
|
|
|
} |
|
97
|
|
|
|
|
|
|
|
|
98
|
17
|
|
|
17
|
|
114
|
no Moose; |
|
|
17
|
|
|
|
|
42
|
|
|
|
17
|
|
|
|
|
140
|
|
|
99
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
|
100
|
|
|
|
|
|
|
1; |
|
101
|
|
|
|
|
|
|
__END__ |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
use WWW::Google::Contacts; |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
my $google = WWW::Google::Contacts->new( username => "your.username", password => "your.password" ); |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
my $group = $google->new_group; |
|
110
|
|
|
|
|
|
|
$group->title("Lovers"); |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head1 METHODS |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=head2 $group->create |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
Writes the group to your Google account. |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=head2 $group->retrieve |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
Fetches group details from Google account. |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=head2 $group->update |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
Updates existing group in your Google account. |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=head2 $group->delete |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
Deletes group from your Google account. |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=head2 $group->create_or_update |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
Creates or updates group, depending on if it already exists |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
All these attributes are gettable and settable on Group objects. |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=over 4 |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=item title |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
The title of the group |
|
143
|
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
$group->title("People I'm only 'friends' with because of the damn Facebook"); |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=item member |
|
147
|
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
An array of members of the group |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
foreach my $member (@{ $group->member }) { |
|
151
|
|
|
|
|
|
|
print $member->full_name . " is a member of the group.\n"; |
|
152
|
|
|
|
|
|
|
} |
|
153
|
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=back |
|
155
|
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=head1 AUTHOR |
|
157
|
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
Magnus Erixzon <magnus@erixzon.com> |
|
159
|
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
161
|
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
This software is copyright (c) 2010 by Magnus Erixzon / Fayland Lam. |
|
163
|
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
165
|
|
|
|
|
|
|
the same terms as perl itself. |
|
166
|
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
=cut |