| 1 | package WWW::Google::Contacts::Type::Country; | ||
| 2 | { | ||
| 3 | $WWW::Google::Contacts::Type::Country::VERSION = '0.39'; | ||
| 4 | } | ||
| 5 | |||
| 6 | use Moose; | ||
| 7 | use MooseX::Types::Moose qw( Str ); | ||
| 8 | use WWW::Google::Contacts::Meta::Attribute::Trait::XmlField; | ||
| 9 | |||
| 10 | extends 'WWW::Google::Contacts::Type::Base'; | ||
| 11 | |||
| 12 | use constant SCHEME => 'http://schemas.google.com/g/2005'; | ||
| 13 | |||
| 14 | has code => ( | ||
| 15 | isa => Str, | ||
| 16 | is => 'ro', | ||
| 17 | traits => ['XmlField'], | ||
| 18 | xml_key => 'code', | ||
| 19 | predicate => 'has_code', | ||
| 20 | ); | ||
| 21 | |||
| 22 | has name => ( | ||
| 23 | isa => Str, | ||
| 24 | is => 'ro', | ||
| 25 | traits => ['XmlField'], | ||
| 26 | xml_key => 'content', | ||
| 27 | ); | ||
| 28 | |||
| 29 | sub to_xml_hashref { | ||
| 30 | my $self = shift; | ||
| 31 | return { $self->has_code ? ( code => $self->code ) : (), | ||
| 32 | content => $self->name }; | ||
| 33 | } | ||
| 34 | |||
| 35 | no Moose; | ||
| 36 | __PACKAGE__->meta->make_immutable; | ||
| 37 | 1; | ||
| 38 | __END__ |