File Coverage

blib/lib/WWW/LogicBoxes/Domain/Factory.pm
Criterion Covered Total %
statement 15 25 60.0
branch 0 8 0.0
condition 0 3 0.0
subroutine 5 6 83.3
pod 0 1 0.0
total 20 43 46.5


line stmt bran cond sub pod time code
1             package WWW::LogicBoxes::Domain::Factory;
2              
3 38     38   273 use strict;
  38         101  
  38         1223  
4 38     38   226 use warnings;
  38         87  
  38         1162  
5              
6 38     38   16155 use WWW::LogicBoxes::Domain;
  38         176  
  38         1876  
7 38     38   22960 use WWW::LogicBoxes::DomainTransfer;
  38         199  
  38         1789  
8              
9 38     38   369 use Carp;
  38         91  
  38         7962  
10              
11             our $VERSION = '1.10.0'; # VERSION
12             # ABSTRACT: Domain Factory for Building Domain Objects from Responses
13              
14             sub construct_from_response {
15 0     0 0   my $self = shift;
16 0           my $response = shift;
17              
18 0 0         if( !$response ) {
19 0           return;
20             }
21              
22 0 0         if( $response->{actiontype} ) {
23 0 0 0       if( $response->{actiontype} eq 'AddTransferDomain' ) {
    0          
24 0           return WWW::LogicBoxes::DomainTransfer->construct_from_response( $response );
25             }
26             elsif( $response->{actiontype} eq 'DelDomain' || $response->{actiontype} eq 'ModContact' ) {
27 0           return WWW::LogicBoxes::Domain->construct_from_response( $response );
28             }
29             else {
30 0           croak $response->{actiontype} . ' is an unknown action type';
31             }
32             }
33             else {
34 0           return WWW::LogicBoxes::Domain->construct_from_response( $response );
35             }
36             }
37              
38             1;
39              
40             __END__