| 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.7.0'; # VERSION | |
| 12 | # ABSTRACT: WWW::eNom Moose Type Library | ||
| 13 | |||
| 14 | 85 | ▶ | use MooseX::Types -declare => [qw( |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 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 | RawContactType | ||
| 32 | DateTime | ||
| 33 | DomainName | ||
| 34 | DomainNames | ||
| 35 | EmailAddress | ||
| 36 | HTTPTiny | ||
| 37 | NexusPurpose | ||
| 38 | NexusCategory | ||
| 39 | NumberPhone | ||
| 40 | ResponseType | ||
| 41 | TransferVerificationMethod | ||
| 42 | URI | ||
| 43 | |||
| 44 | Contact | ||
| 45 | Domain | ||
| 46 | DomainAvailability | ||
| 47 | DomainAvailabilities | ||
| 48 | DomainRegistration | ||
| 49 | DomainTransfer | ||
| 50 | IRTPDetail | ||
| 51 | PhoneNumber | ||
| 52 | PrivateNameServer | ||
| 53 | PrivateNameServers | ||
| 54 | 85 | )]; | |
| 55 | |||
| 56 | use MooseX::Types::Moose | ||
| 57 | 85 | ▶ | ArrayRef => { -as => 'MooseArrayRef' }, |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 58 | Bool => { -as => 'MooseBool' }, | ||
| 59 | HashRef => { -as => 'MooseHashRef' }, | ||
| 60 | Int => { -as => 'MooseInt' }, | ||
| 61 | 85 | Str => { -as => 'MooseStr' }; | |
| 62 | |||
| 63 | 85 | subtype ArrayRef, as MooseArrayRef; | |
| 64 | 85 | subtype Bool, as MooseBool; | |
| 65 | 85 | subtype HashRef, as MooseHashRef; | |
| 66 | 85 | subtype Int, as MooseInt; | |
| 67 | 85 | subtype Str, as MooseStr; | |
| 68 | 85 | subtype Strs, as ArrayRef[Str]; | |
| 69 | |||
| 70 | 85 | enum ContactType, [qw( Billing Registrant Tech Admin AuxBilling )]; | |
| 71 | 85 | enum RawContactType, [qw( Billing Registrant Tech Admin Technical Administrative AuxBilling )]; | |
| 72 | 85 | enum NexusCategory, [qw( C11 C12 C21 C31 C32 )]; | |
| 73 | 85 | enum NexusPurpose, [qw( P1 P2 P3 P4 P5 )]; | |
| 74 | |||
| 75 | subtype DomainName, as Str, | ||
| 76 | 203 | ▶ | where { is_domain( $_ ) }, |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 77 | 0 | ▶ | message { "$_ is not a valid domain" }; |
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||
| 78 | 85 | subtype DomainNames, as ArrayRef[DomainName]; | |
| 79 | |||
| 80 | subtype EmailAddress, as Str, | ||
| 81 | 47 | ▶ | where { is_email( $_ ) }, |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 82 | 0 | ▶ | message { "$_ is not a valid email address" }; |
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||
| 83 | |||
| 84 | subtype PositiveInt, as Int, | ||
| 85 | 62 | ▶ | where { $_ > 0 }, |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 86 | 0 | ▶ | message { "$_ is not a positive integer" }; |
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||
| 87 | |||
| 88 | 85 | my @response_types = qw( xml xml_simple html text ); | |
| 89 | subtype ResponseType, as Str, | ||
| 90 | 0 | ▶ | where { |
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||
| 91 | 0 | my $response_type = $_; | |
| 92 | 0 | grep { $response_type eq $_ } @response_types; | |
| 93 | }, | ||
| 94 | 0 | ▶ | message { 'response_type must be one of: ' . join ', ', @response_types }; |
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||
| 95 | |||
| 96 | 85 | class_type DateTime, { class => 'DateTime' }; | |
| 97 | 85 | class_type HTTPTiny, { class => 'HTTP::Tiny' }; | |
| 98 | 85 | class_type NumberPhone, { class => 'Number::Phone' }; | |
| 99 | 85 | class_type URI, { class => 'URI' }; | |
| 100 | 0 | ▶ | coerce URI, from Str, via { URI->new( $_ ) }; |
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||
| 101 | |||
| 102 | 85 | enum TransferVerificationMethod, [qw( Fax Autoverification )]; | |
| 103 | |||
| 104 | 85 | class_type Contact, { class => 'WWW::eNom::Contact' }; | |
| 105 | 85 | class_type Domain, { class => 'WWW::eNom::Domain' }; | |
| 106 | 85 | class_type DomainAvailability, { class => 'WWW::eNom::DomainAvailability' }; | |
| 107 | 85 | subtype DomainAvailabilities, as ArrayRef[DomainAvailability]; | |
| 108 | |||
| 109 | 85 | class_type DomainRegistration, { class => 'WWW::eNom::DomainRequest::Registration' }; | |
| 110 | 0 | ▶ | coerce DomainRegistration, from HashRef, via { WWW::eNom::DomainRequest::Registration->new( $_ ) }; |
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||
| 111 | |||
| 112 | 85 | class_type DomainTransfer, { class => 'WWW::eNom::DomainRequest::Transfer' }; | |
| 113 | 0 | ▶ | coerce DomainTransfer, from HashRef, via { WWW::eNom::DomainRequest::Transfer->new( $_ ) }; |
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||
| 114 | |||
| 115 | 85 | class_type PhoneNumber, { class => 'WWW::eNom::PhoneNumber' }; | |
| 116 | coerce PhoneNumber, from Str, | ||
| 117 | 50 | ▶ | via { WWW::eNom::PhoneNumber->new( $_ ) }; |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 118 | coerce PhoneNumber, from NumberPhone, | ||
| 119 | 0 | ▶ | via { WWW::eNom::PhoneNumber->new( $_->format ) }; |
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||
| 120 | |||
| 121 | 85 | class_type PrivateNameServer, { class => 'WWW::eNom::PrivateNameServer' }; | |
| 122 | coerce PrivateNameServer, from HashRef, | ||
| 123 | 0 | ▶ | via { WWW::eNom::PrivateNameServer->new( $_ ) }; |
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||
| 124 | 85 | subtype PrivateNameServers, as ArrayRef[PrivateNameServer]; | |
| 125 | |||
| 126 | subtype IPv4, as Str, | ||
| 127 | 4 | ▶ | where { is_ipv4( $_ ) }, |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 128 | 0 | ▶ | message { "$_ is not a valid ipv4 IP Address" }; |
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||
| 129 | 85 | subtype IPv4s, as ArrayRef[IPv4]; | |
| 130 | |||
| 131 | subtype IPv6, as Str, | ||
| 132 | 0 | ▶ | where { is_ipv6( $_ ) }, |
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||
| 133 | 0 | ▶ | message { "$_ is not a valid ipv6 IP Address" }; |
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||
| 134 | 85 | subtype IPv6s, as ArrayRef[IPv6]; | |
| 135 | |||
| 136 | 85 | subtype IP, as IPv4 | IPv6; | |
| 137 | 85 | subtype IPs, as ArrayRef[IP]; | |
| 138 | |||
| 139 | 85 | class_type IRTPDetail, { class => 'WWW::eNom::IRTPDetail' }; | |
| 140 | |||
| 141 | 85 | 1; | |
| 142 | |||
| 143 | __END__ | ||