File Coverage

blib/lib/WWW/Google/Contacts/Type/Relation.pm
Criterion Covered Total %
statement 15 15 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod n/a
total 20 20 100.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.39';
4             }
5              
6 20     20   34861 use Moose;
  20         487019  
  20         164  
7 20     20   134801 use MooseX::Types::Moose qw( Str );
  20         69746  
  20         239  
8 20     20   106257 use WWW::Google::Contacts::InternalTypes qw( Rel );
  20         2829  
  20         176  
9 20     20   49337 use WWW::Google::Contacts::Meta::Attribute::Trait::XmlField;
  20         75  
  20         4080  
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 20     20   122 no Moose;
  20         48  
  20         130  
41             __PACKAGE__->meta->make_immutable;
42             1;
43             __END__