Command/Check/Contact.pm

filter: Statementstmt 83.3% 10 / 12 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod n/a totaltotal 87.5% 14 / 16 CC 1 SCAR 0.7
CC
1
Cov
83%
BEGIN
1.3
BEGIN
1.0
BEGIN
1.0
CRAP 1.1
« Command.pm ↑ Summary Command/Check/Domain.pm »
1  
2  
3 package SRS::EPP::Command::Check::Contact;
4  
5 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 extends 'SRS::EPP::Command::Check';
7 1 ▶use MooseX::Method::Signatures;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use Crypt::Password;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use SRS::EPP::Session;
Subroutine BEGIN: called CC=1 SCAR=2.6
10 use XML::EPP::Contact;
11  
12 # for plugin system to connect
13 sub xmlns {
14 XML::EPP::Contact::Node::xmlns();
15 }
16  
17 method process( SRS::EPP::Session $session ) {
18 $self->session($session);
19 my $epp = $self->message;
20  
21 my $payload = $epp->message->argument->payload;
22  
23 return XML::SRS::Handle::Query->new( handle_id_filter => $payload->ids );
24 }
25  
26 has 'ids_to_check' =>
27 is => 'rw',
28 isa => 'ArrayRef[Str]',
29 ;
30  
31 has 'avail' =>
32 is => "rw",
33 isa => "HashRef[Str]",
34 ;
35  
36 method notify( SRS::EPP::SRSResponse @rs ) {
37 $self->avail({ map { $_->message->response->handle_id => 1 } grep { $_->message->response } @rs });
38  
39 my $epp = $self->message;
40 my $payload = $epp->message->argument->payload;
41  
42 my $ids = $payload->ids;
43 my $avail = $self->avail();
44  
45 my @ids = map { XML::EPP::Contact::Check::ID->new(
46 name => $_,
47 available => ($avail->{$_} ? 0 : 1),
48 ) } @$ids;
49  
50 my $status = XML::EPP::Contact::Check::Status->new(
51 id_status => \@ids,
52 );
53  
54 my $r = XML::EPP::Contact::Check::Response->new(
55 items => [ $status ],
56 );
57  
58 # from SRS::EPP::Response::Check
59 return $self->make_response(
60 'Check',
61 code => 1000,
62 payload => $r,
63 );
64 }
65  
66 1;
« Command.pm ↑ Summary Command/Check/Domain.pm »