| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package WWW::LogicBoxes::Domain::Factory; | 
| 2 |  |  |  |  |  |  |  | 
| 3 | 38 |  |  | 38 |  | 289 | use strict; | 
|  | 38 |  |  |  |  | 87 |  | 
|  | 38 |  |  |  |  | 1277 |  | 
| 4 | 38 |  |  | 38 |  | 213 | use warnings; | 
|  | 38 |  |  |  |  | 84 |  | 
|  | 38 |  |  |  |  | 1059 |  | 
| 5 |  |  |  |  |  |  |  | 
| 6 | 38 |  |  | 38 |  | 15891 | use WWW::LogicBoxes::Domain; | 
|  | 38 |  |  |  |  | 175 |  | 
|  | 38 |  |  |  |  | 1821 |  | 
| 7 | 38 |  |  | 38 |  | 23345 | use WWW::LogicBoxes::DomainTransfer; | 
|  | 38 |  |  |  |  | 189 |  | 
|  | 38 |  |  |  |  | 1827 |  | 
| 8 |  |  |  |  |  |  |  | 
| 9 | 38 |  |  | 38 |  | 372 | use Carp; | 
|  | 38 |  |  |  |  | 88 |  | 
|  | 38 |  |  |  |  | 7300 |  | 
| 10 |  |  |  |  |  |  |  | 
| 11 |  |  |  |  |  |  | our $VERSION = '1.10.1'; # 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 |  |  |  |  |  |  |  | 
| 24 |  |  |  |  |  |  | # actiontype is an undocumented return value.  I spoke with a LogicBoxes | 
| 25 |  |  |  |  |  |  | # engineer who told me that it identifies an action that has been | 
| 26 |  |  |  |  |  |  | # requested but not yet completed - their API is asynchronous and a | 
| 27 |  |  |  |  |  |  | # successful call simply means an action has been queued for processing. | 
| 28 |  |  |  |  |  |  | # | 
| 29 |  |  |  |  |  |  | # Furthermore, the range of values for actiontype is not well defined - | 
| 30 |  |  |  |  |  |  | # new values are added routinely as needed. Accordingly, we need to be | 
| 31 |  |  |  |  |  |  | # lenient in looking at this value. | 
| 32 |  |  |  |  |  |  | # | 
| 33 |  |  |  |  |  |  | # In general, the only actiontype we need to concern ourselves with is | 
| 34 |  |  |  |  |  |  | # AddtransferDomain, which means the domain is in the process of being | 
| 35 |  |  |  |  |  |  | # transfered to LogicBoxes.  That gets a different class constructed for | 
| 36 |  |  |  |  |  |  | # it. All other values should be treated normally. | 
| 37 |  |  |  |  |  |  | # | 
| 38 |  |  |  |  |  |  | # Known values include: | 
| 39 |  |  |  |  |  |  | # AddtransferDomain - domain is being transferred in | 
| 40 |  |  |  |  |  |  | # DelDomain - a domain is being deleted | 
| 41 |  |  |  |  |  |  | # ModContact - a contact is being updated | 
| 42 |  |  |  |  |  |  | # ParkDomain - a domain has expired and is being parked at the | 
| 43 |  |  |  |  |  |  | #       registrar for the redemption period. | 
| 44 |  |  |  |  |  |  | # RenewDomain - a domain is being renewed | 
| 45 |  |  |  |  |  |  |  | 
| 46 | 0 | 0 |  |  |  |  | if( $response->{actiontype} eq 'AddTransferDomain' ) { | 
| 47 | 0 |  |  |  |  |  | return WWW::LogicBoxes::DomainTransfer->construct_from_response( $response ); | 
| 48 |  |  |  |  |  |  | } | 
| 49 |  |  |  |  |  |  | else { | 
| 50 | 0 |  |  |  |  |  | return WWW::LogicBoxes::Domain->construct_from_response( $response ); | 
| 51 |  |  |  |  |  |  | } | 
| 52 |  |  |  |  |  |  | } | 
| 53 |  |  |  |  |  |  | else { | 
| 54 | 0 |  |  |  |  |  | return WWW::LogicBoxes::Domain->construct_from_response( $response ); | 
| 55 |  |  |  |  |  |  | } | 
| 56 |  |  |  |  |  |  | } | 
| 57 |  |  |  |  |  |  |  | 
| 58 |  |  |  |  |  |  | 1; | 
| 59 |  |  |  |  |  |  |  | 
| 60 |  |  |  |  |  |  | __END__ |