File Coverage

blib/lib/WWW/Google/Contacts/Type/Relation.pm
Criterion Covered Total %
statement 1 3 33.3
branch n/a
condition n/a
subroutine 1 1 100.0
pod n/a
total 2 4 50.0


line stmt bran cond sub pod time code
1             package WWW::Google::Contacts::Type::Relation;
2             {
3             $WWW::Google::Contacts::Type::Relation::VERSION = '0.38';
4             }
5              
6 1     1   40053 use Moose;
  0            
  0            
7             use MooseX::Types::Moose qw( Str );
8             use WWW::Google::Contacts::InternalTypes qw( Rel );
9             use WWW::Google::Contacts::Meta::Attribute::Trait::XmlField;
10              
11             extends 'WWW::Google::Contacts::Type::Base';
12              
13             with 'WWW::Google::Contacts::Roles::HasTypeAndLabel' => {
14             valid_types => [
15             qw(
16             assistant brother child domestic-partner father friend manager
17             mother parent partner referred-by relative sister spouse
18             )
19             ],
20             default_type => '',
21             };
22              
23             has value => (
24             isa => Str,
25             is => 'rw',
26             traits => ['XmlField'],
27             xml_key => 'content',
28             predicate => 'has_value',
29             required => 1,
30             );
31              
32             # 'rel' XML key must not have contain a full url, only the value
33             before to_xml_hashref => sub {
34             my $self = shift;
35             my $type = $self->type->uri;
36             $type =~ s{^.*\#}{};
37             $self->type->uri($type);
38             };
39              
40             no Moose;
41             __PACKAGE__->meta->make_immutable;
42             1;
43             __END__