Mojo/SAML/Document/ContactPerson.pm untested

filter: Statementstmt 0.0% 0 / 12 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 1 Podpod n/a totaltotal 0.0% 0 / 13 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
CRAP 2.0
1 package Mojo::SAML::Document::ContactPerson;
2  
3 use Mojo::Base 'Mojo::SAML::Document';
4  
5 has template => sub { shift->build_template(<<'XML') };
6 % my @attrs = (xmlns => 'urn:oasis:names:tc:SAML:2.0:metadata', contactType => $self->type);
7 %= tag ContactPerson => @attrs => begin
8 % if (my $name = $self->given_name) {
9 <GivenName><%= $name %></GivenName>
10 % }
11 % if (my $surname = $self->surname) {
12 <SurName><%= $surname %></SurName>
13 % }
14 % if (my $company = $self->company) {
15 <Company><%= $company %></Company>
16 % }
17 % for my $email (@{ $self->emails }) {
18 <EmailAddress>mailto:<%= $email %></EmailAddress>
19 % }
20 % for my $phone (@{ $self->telephone_numbers }) {
21 <TelephoneNumber><%= $phone %></TelephoneNumber>
22 % }
23 % end
24 XML
25  
26 has type => sub { Carp::croak 'type is required' };
27 has [qw/given_name surname company/];
28 has [qw/emails telephone_numbers/] => sub { [] };
29  
30 1;
31  
32 =head1 NAME
33  
34 Mojo::SAML::Document::ContactPerson
35  
36 =head1 DESCRIPTION
37  
38 Represents an ContactPerson SAML metadata tag
39  
40 =head1 ATTRIBUTES
41  
42 L<Mojo::SAML::Document::ContactPerson> inherits all attributes from L<Mojo::SAML::Document> and implements the following new ones.
43  
44 =head2 company
45  
46 Optional.
47 The company name of the contact.
48  
49 =head2 emails
50  
51 Optional.
52 An array reference containing contact email addresses.
53  
54 =head2 given_name
55  
56 Optional.
57 The given or first name of the contact.
58  
59 =head2 surname
60  
61 Optional.
62 The surname or last name of the contact.
63  
64 =head2 telephone_numbers
65  
66 Optional.
67 An array reference containing contact telephone numbers.
68  
69 =head2 template
70  
71 A template specific to the document type.
72  
73 =head2 type
74  
75 Required.
76 The type of contact this represents.
77 Should be one of C<technical>, C<support>, C<administrative>, C<billing>, and C<other>.
78