File: | lib/WWW/Google/Contacts/Type/Website.pm |
Coverage: | 100.0% |
line | stmt | bran | cond | sub | pod | time | code |
---|---|---|---|---|---|---|---|
1 | package WWW::Google::Contacts::Type::Website; | ||||||
2 | |||||||
3 | 12 12 12 | 90 40 98 | use Moose; | ||||
4 | 12 12 12 | 130 37 105 | use MooseX::Types::Moose qw( Str ); | ||||
5 | 12 12 12 | 125 39 98 | use WWW::Google::Contacts::InternalTypes qw( Rel XmlBool ); | ||||
6 | 12 12 12 | 116 37 96 | use WWW::Google::Contacts::Meta::Attribute::Trait::XmlField; | ||||
7 | |||||||
8 | extends 'WWW::Google::Contacts::Type::Base'; | ||||||
9 | |||||||
10 | has type => ( | ||||||
11 | isa => Str, # not a full url rel :-/ | ||||||
12 | is => 'rw', | ||||||
13 | traits => [ 'XmlField' ], | ||||||
14 | xml_key => 'rel', | ||||||
15 | predicate => 'has_type', | ||||||
16 | ); | ||||||
17 | |||||||
18 | has value => ( | ||||||
19 | isa => Str, | ||||||
20 | is => 'rw', | ||||||
21 | traits => [ 'XmlField' ], | ||||||
22 | xml_key => 'href', | ||||||
23 | predicate => 'has_value', | ||||||
24 | required => 1, | ||||||
25 | ); | ||||||
26 | |||||||
27 | has label => ( | ||||||
28 | isa => Str, | ||||||
29 | is => 'rw', | ||||||
30 | traits => [ 'XmlField' ], | ||||||
31 | xml_key => 'label', | ||||||
32 | predicate => 'has_label', | ||||||
33 | ); | ||||||
34 | |||||||
35 | has primary => ( | ||||||
36 | isa => XmlBool, | ||||||
37 | is => 'rw', | ||||||
38 | traits => [ 'XmlField' ], | ||||||
39 | predicate => 'has_primary', | ||||||
40 | xml_key => 'primary', | ||||||
41 | to_xml => sub { my $val = shift; return "true" if $val == 1; return "false" }, | ||||||
42 | default => sub { 0 }, | ||||||
43 | coerce => 1, | ||||||
44 | ); | ||||||
45 | |||||||
46 | 12 12 12 | 116 36 97 | no Moose; | ||||
47 | __PACKAGE__->meta->make_immutable; | ||||||
48 | 1; |