blib/lib/WWW/eNom/Types.pm

filter: Statementstmt 82.9% 73 / 88 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 50.0% 13 / 26 Podpod n/a totaltotal 75.4% 86 / 114 CC 1 SCAR 1.2
CC
1
Cov
83%
__ANON__
2.0
__ANON__
2.0
__ANON__
1.1
CRAP 1.1
« blib/lib/WWW/eNom/PhoneNumber.pm ↑ Summary blib/lib/Net/eNom.pm »
1 package WWW::eNom::Types;
2  
3 85 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 85 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 85 ▶use Data::Validate::IP qw( is_ipv4 is_ipv6 );
Subroutine BEGIN: called CC=1 SCAR=0.0
7 85 ▶use Data::Validate::Domain qw( is_domain );
Subroutine BEGIN: called CC=1 SCAR=0.0
8 85 ▶use Data::Validate::Email qw( is_email );
Subroutine BEGIN: called CC=1 SCAR=0.0
9 85 ▶use URI;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 85 our $VERSION = 'v2.6.0'; # VERSION
12 # ABSTRACT: WWW::eNom Moose Type Library
13  
14 85 use MooseX::Types -declare => [qw(
15 ArrayRef
16 Bool
17 HashRef
18 Int
19 PositiveInt
20 Str
21 Strs
22  
23 IP
24 IPs
25 IPv4
26 IPv4s
27 IPv6
28 IPv6s
29  
30 ContactType
31 DateTime
32 DomainName
33 DomainNames
34 EmailAddress
35 HTTPTiny
36 NexusPurpose
37 NexusCategory
38 NumberPhone
39 ResponseType
40 TransferVerificationMethod
41 URI
42  
43 Contact
44 Domain
45 DomainAvailability
46 DomainAvailabilities
47 DomainRegistration
48 DomainTransfer
49 IRTPDetail
50 PhoneNumber
51 PrivateNameServer
52 PrivateNameServers
53 85 ▶)];
Subroutine BEGIN: called CC=1 SCAR=0.0
54  
55 use MooseX::Types::Moose
56 85 ArrayRef => { -as => 'MooseArrayRef' },
57 Bool => { -as => 'MooseBool' },
58 HashRef => { -as => 'MooseHashRef' },
59 Int => { -as => 'MooseInt' },
60 85 ▶ Str => { -as => 'MooseStr' };
Subroutine BEGIN: called CC=1 SCAR=0.0
61  
62 85 subtype ArrayRef, as MooseArrayRef;
63 85 subtype Bool, as MooseBool;
64 85 subtype HashRef, as MooseHashRef;
65 85 subtype Int, as MooseInt;
66 85 subtype Str, as MooseStr;
67 85 subtype Strs, as ArrayRef[Str];
68  
69 85 enum ContactType, [qw( Registrant Tech Admin AuxBilling )];
70 85 enum NexusCategory, [qw( C11 C12 C21 C31 C32 )];
71 85 enum NexusPurpose, [qw( P1 P2 P3 P4 P5 )];
72  
73 subtype DomainName, as Str,
74 203 ▶ where { is_domain( $_ ) },
Subroutine __ANON__: called CC=1 SCAR=0.0
75 0 ▶ message { "$_ is not a valid domain" };
Subroutine __ANON__: not called CC=1 SCAR=1.2
76 85 subtype DomainNames, as ArrayRef[DomainName];
77  
78 subtype EmailAddress, as Str,
79 47 ▶ where { is_email( $_ ) },
Subroutine __ANON__: called CC=1 SCAR=0.0
80 0 ▶ message { "$_ is not a valid email address" };
Subroutine __ANON__: not called CC=1 SCAR=1.2
81  
82 subtype PositiveInt, as Int,
83 62 ▶ where { $_ > 0 },
Subroutine __ANON__: called CC=1 SCAR=0.0
84 0 ▶ message { "$_ is not a positive integer" };
Subroutine __ANON__: not called CC=1 SCAR=1.2
85  
86 85 my @response_types = qw( xml xml_simple html text );
87 subtype ResponseType, as Str,
88 where {
89 0 ▶ my $response_type = $_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
90 0 grep { $response_type eq $_ } @response_types;
91 },
92 0 ▶ message { 'response_type must be one of: ' . join ', ', @response_types };
Subroutine __ANON__: not called CC=1 SCAR=1.2
93  
94 85 class_type DateTime, { class => 'DateTime' };
95 85 class_type HTTPTiny, { class => 'HTTP::Tiny' };
96 85 class_type NumberPhone, { class => 'Number::Phone' };
97 85 class_type URI, { class => 'URI' };
98 0 ▶coerce URI, from Str, via { URI->new( $_ ) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
99  
100 85 enum TransferVerificationMethod, [qw( Fax Autoverification )];
101  
102 85 class_type Contact, { class => 'WWW::eNom::Contact' };
103 85 class_type Domain, { class => 'WWW::eNom::Domain' };
104 85 class_type DomainAvailability, { class => 'WWW::eNom::DomainAvailability' };
105 85 subtype DomainAvailabilities, as ArrayRef[DomainAvailability];
106  
107 85 class_type DomainRegistration, { class => 'WWW::eNom::DomainRequest::Registration' };
108 0 ▶coerce DomainRegistration, from HashRef, via { WWW::eNom::DomainRequest::Registration->new( $_ ) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
109  
110 85 class_type DomainTransfer, { class => 'WWW::eNom::DomainRequest::Transfer' };
111 0 ▶coerce DomainTransfer, from HashRef, via { WWW::eNom::DomainRequest::Transfer->new( $_ ) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
112  
113 85 class_type PhoneNumber, { class => 'WWW::eNom::PhoneNumber' };
114 coerce PhoneNumber, from Str,
115 50 ▶ via { WWW::eNom::PhoneNumber->new( $_ ) };
Subroutine __ANON__: called CC=1 SCAR=0.0
116 coerce PhoneNumber, from NumberPhone,
117 0 ▶ via { WWW::eNom::PhoneNumber->new( $_->format ) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
118  
119 85 class_type PrivateNameServer, { class => 'WWW::eNom::PrivateNameServer' };
120 coerce PrivateNameServer, from HashRef,
121 0 ▶ via { WWW::eNom::PrivateNameServer->new( $_ ) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
122 85 subtype PrivateNameServers, as ArrayRef[PrivateNameServer];
123  
124 subtype IPv4, as Str,
125 4 ▶ where { is_ipv4( $_ ) },
Subroutine __ANON__: called CC=1 SCAR=0.0
126 0 ▶ message { "$_ is not a valid ipv4 IP Address" };
Subroutine __ANON__: not called CC=1 SCAR=1.2
127 85 subtype IPv4s, as ArrayRef[IPv4];
128  
129 subtype IPv6, as Str,
130 0 ▶ where { is_ipv6( $_ ) },
Subroutine __ANON__: not called CC=1 SCAR=6.9
131 0 ▶ message { "$_ is not a valid ipv6 IP Address" };
Subroutine __ANON__: not called CC=1 SCAR=1.2
132 85 subtype IPv6s, as ArrayRef[IPv6];
133  
134 85 subtype IP, as IPv4 | IPv6;
135 85 subtype IPs, as ArrayRef[IP];
136  
137 85 class_type IRTPDetail, { class => 'WWW::eNom::IRTPDetail' };
138  
139 85 1;
140  
141 __END__
« blib/lib/WWW/eNom/PhoneNumber.pm ↑ Summary blib/lib/Net/eNom.pm »