WWW/eNom/DomainRequest/Transfer.pm

filter: Statementstmt 89.0% 49 / 55 Branchbran 42.1% 16 / 38 Conditioncond 100% 3 / 3 MC/DCmcdc 100% 2 / 2 Subroutinesub 88.8% 8 / 9 Podpod n/a totaltotal 72.9% 78 / 107 CC 21 SCAR 35.4
CC
21
Cov
71%
construct_request
90.0
BUILD
13.7
BEGIN
1.0
CRAP 34.3
« WWW/eNom/Role/Command/Domain/PrivateNameServer.pm ↑ Summary WWW/eNom/Role/Command/Domain/Availability.pm »
1 package WWW::eNom::DomainRequest::Transfer;
2  
3 49 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 49 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 49 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 49 ▶use MooseX::StrictConstructor;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 49 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 49 ▶use WWW::eNom::Types qw( Bool Contact DomainName Str TransferVerificationMethod );
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 49 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 49 our $VERSION = 'v2.7.0'; # VERSION
15 # ABSTRACT: Domain Transfer Request
16  
17 49 has 'name' => (
18 is => 'ro',
19 isa => DomainName,
20 required => 1,
21 );
22  
23 49 has 'verification_method' => (
24 is => 'ro',
25 isa => TransferVerificationMethod,
26 default => 'Autoverification',
27 );
28  
29 49 has 'is_private' => (
30 is => 'ro',
31 isa => Bool,
32 default => 0,
33 );
34  
35 49 has 'is_locked' => (
36 is => 'ro',
37 isa => Bool,
38 default => 1,
39 );
40  
41 49 has 'is_auto_renew' => (
42 is => 'ro',
43 isa => Bool,
44 default => 0,
45 );
46  
47 49 has 'epp_key' => (
48 is => 'ro',
49 isa => Str,
50 required => 1,
51 );
52  
53 49 has 'use_existing_contacts' => (
54 is => 'ro',
55 isa => Bool,
56 default => 0,
57 );
58  
59 49 has 'registrant_contact' => (
60 is => 'ro',
61 isa => Contact,
62 predicate => 'has_registrant_contact',
63 );
64  
65 49 has 'admin_contact' => (
66 is => 'ro',
67 isa => Contact,
68 predicate => 'has_admin_contact',
69 );
70  
71 49 has 'technical_contact' => (
72 is => 'ro',
73 isa => Contact,
74 predicate => 'has_technical_contact',
75 );
76  
77 49 has 'billing_contact' => (
78 is => 'ro',
79 isa => Contact,
80 predicate => 'has_billing_contact',
81 );
82  
83 49 with 'WWW::eNom::Role::ParseDomain';
84  
85 7 ▶sub BUILD {
Subroutine BUILD: called CC=13 SCAR=26.1
86 7 my $self = shift;
87  
88 7 ▶ if( $self->use_existing_contacts ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->use_existing_contacts) { } 4 3 7
89 4 ▶ ( $self->verification_method ne 'Fax' && $self->has_registrant_contact )
Branch: 1 branch
BranchTrueFalseTotal
$self->verification_method ne "Fax" and $self->has_registrant_contact and croak("When using existing contacts the registrant contact must not be specified") 1 3 4
Condition100%3/3
$self->verification_method ne "Fax" and $self->has_registrant_contact
!ll&&!rl&&r
211
MC/DC100%2/2
$self->verification_method ne "Fax" and $self->has_registrant_contact
$self->verification_method ne "Fax" $self->has_registrant_contact
Truth table100%3/3
A and B
A= $self->verification_method ne "Fax"B= $self->has_registrant_contact
ABresult
0X0
100
111
90 and croak 'When using existing contacts the registrant contact must not be specified';
91 3 ▶ $self->has_admin_contact and croak 'When using existing contacts the admin contact must not be specified';
Branch: 1 branch
BranchTrueFalseTotal
$self->has_admin_contact and croak("When using existing contacts the admin contact must not be specified") 0 3 3
92 3 ▶ $self->has_technical_contact and croak 'When using existing contacts the technical contact must not be specified';
Branch: 1 branch
BranchTrueFalseTotal
$self->has_technical_contact and croak("When using existing contacts the technical contact must not be specified") 0 3 3
93 3 ▶ $self->has_billing_contact and croak 'When using existing contacts the billing contact must not be specified';
Branch: 1 branch
BranchTrueFalseTotal
$self->has_billing_contact and croak("When using existing contacts the billing contact must not be specified") 0 3 3
94 }
95 else {
96 ## no critic ( ValuesAndExpressions::ProhibitMixedBooleanOperators )
97 3 ▶ !$self->has_registrant_contact and croak 'If not using existing contacts the registrant contact must be specified';
Branch: 1 branch
BranchTrueFalseTotal
$self->has_registrant_contact or croak("If not using existing contacts the registrant contact must be specified") 2 1 3
98 2 ▶ !$self->has_admin_contact and croak 'If not using existing contacts the admin contact must be specified';
Branch: 1 branch
BranchTrueFalseTotal
$self->has_admin_contact or croak("If not using existing contacts the admin contact must be specified") 2 0 2
99 2 ▶ !$self->has_technical_contact and croak 'If not using existing contacts the technical contact must be specified';
Branch: 1 branch
BranchTrueFalseTotal
$self->has_technical_contact or croak("If not using existing contacts the technical contact must be specified") 2 0 2
100 2 ▶ !$self->has_billing_contact and croak 'If not using existing contacts the billing contact must be specified';
Branch: 1 branch
BranchTrueFalseTotal
$self->has_billing_contact or croak("If not using existing contacts the billing contact must be specified") 2 0 2
101 ## use critic
102 }
103  
104 5 ▶ if( $self->verification_method eq 'Fax' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->verification_method eq "Fax") 3 2 5
105 ## no critic ( ValuesAndExpressions::ProhibitMixedBooleanOperators )
106 3 ▶ !$self->has_registrant_contact and croak 'If using Fax verification, a registrant contact must be specified';
Branch: 1 branch
BranchTrueFalseTotal
$self->has_registrant_contact or croak("If using Fax verification, a registrant contact must be specified") 2 1 3
107 ## use critic
108 }
109  
110 4 return $self;
111 }
112  
113 0 ▶sub construct_request {
Subroutine construct_request: not called CC=9 SCAR=45.0
114 0 my $self = shift;
115  
116 return {
117 DomainCount => 1,
118 SLD1 => $self->sld,
119 TLD1 => $self->tld,
120 AuthInfo1 => $self->epp_key,
121 OrderType => $self->verification_method,
122 IncludeIDP => $self->is_private ? 1 : 0,
123 Lock => $self->is_locked ? 1 : 0,
124 Renew => $self->is_auto_renew ? 1 : 0,
125 UseContacts => $self->use_existing_contacts ? 1 : 0,
126 0 ▶ $self->has_registrant_contact ? %{ $self->registrant_contact->construct_creation_request('Registrant') } : ( ),
Branch: 1 branch
BranchTrueFalseTotal
$self->has_admin_contact ? : 0 0 0
127 0 ▶ $self->has_admin_contact ? %{ $self->admin_contact->construct_creation_request('Admin') } : ( ),
Branch: 1 branch
BranchTrueFalseTotal
$self->has_technical_contact ? : 0 0 0
128 0 ▶ $self->has_technical_contact ? %{ $self->technical_contact->construct_creation_request('Tech') } : ( ),
Branch: 1 branch
BranchTrueFalseTotal
$self->has_billing_contact ? : 0 0 0
129 0 ▶ $self->has_billing_contact ? %{ $self->billing_contact->construct_creation_request('AuxBilling') } : ( ),
Branch: 5 branches
BranchTrueFalseTotal
$self->is_private ? : 0 0 0
$self->is_locked ? : 0 0 0
$self->is_auto_renew ? : 0 0 0
$self->use_existing_contacts ? : 0 0 0
$self->has_registrant_contact ? : 0 0 0
130 };
131 }
132  
133 49 __PACKAGE__->meta->make_immutable;
134 49 1;
135  
136 __END__
« WWW/eNom/Role/Command/Domain/PrivateNameServer.pm ↑ Summary WWW/eNom/Role/Command/Domain/Availability.pm »