blib/lib/WWW/LogicBoxes/Role/Command/Domain/Registration.pm

filter: Statementstmt 69.2% 27 / 39 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 66.6% 8 / 12 Podpod 100% 2 / 2 totaltotal 67.2% 37 / 55 CC 2 SCAR 6.9
CC
2
Cov
66%
__ANON__
6.0
register_domain
2.0
delete_domain_registration_by_id
2.0
CRAP 2.0
« blib/lib/WWW/LogicBoxes/DomainRequest/Registration.pm ↑ Summary blib/lib/WWW/LogicBoxes/PhoneNumber.pm »
1 package WWW::LogicBoxes::Role::Command::Domain::Registration;
2  
3 37 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 37 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 37 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 37 ▶use MooseX::Params::Validate;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 37 ▶use WWW::LogicBoxes::Types qw( DomainRegistration Int );
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 37 ▶use WWW::LogicBoxes::DomainRequest::Registration;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 37 ▶use Try::Tiny;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 37 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 37 requires 'submit', 'get_domain_by_id';
17  
18 37 our $VERSION = '1.2.0'; # VERSION
19 # ABSTRACT: Domain Registration API Calls
20  
21 sub register_domain {
22 0 ▶ my $self = shift;
Subroutine register_domain: not called CC=1 SCAR=6.9
Pod documented
23 0 my ( %args ) = validated_hash(
24 \@_,
25 request => { isa => DomainRegistration, coerce => 1 }
26 );
27  
28 my $response = $self->submit({
29 method => 'domains__register',
30 0 params => $args{request}->construct_request(),
31 });
32  
33 0 return $self->get_domain_by_id( $response->{entityid} );
34 }
35  
36 sub delete_domain_registration_by_id {
37 0 ▶ my $self = shift;
Subroutine delete_domain_registration_by_id: not called CC=1 SCAR=6.9
Pod documented
38 0 my ( $domain_id ) = pos_validated_list( \@_, { isa => Int } );
39  
40 return try {
41 0 ▶ $self->submit({
Subroutine __ANON__: not called CC=1 SCAR=6.9
42 method => 'domains__delete',
43 params => {
44 'order-id' => $domain_id,
45 },
46 });
47  
48 0 return;
49 }
50 catch {
51 0 ▶ if( $_ =~ m/No Entity found for Entityid/ ) {
Subroutine __ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
if ($_ =~ /No Entity found for Entityid/) 0 0 0
52 0 croak 'No such domain to delete';
53 }
54  
55 0 croak $_;
56 0 };
57 }
58  
59 37 1;
60  
61 __END__
62 =pod
63  
64 =head1 NAME
65  
66 WWW::LogicBoxes::Role::Command::Domain::Registration - Domain Registration Related Operations
67  
68 =head1 SYNOPSIS
69  
70 use WWW::LogicBoxes;
71 use WWW::LogicBoxes::Domain;
72 use WWW::LogicBoxes::DomainRequest::Registration;
73  
74 my $logic_boxes = WWW::LogicBoxes->new( ... );
75  
76 # Creation
77 my $registration_request = WWW::LogicBoxes::DomainRequest::Registration->new( ... );
78 my $domain = $logic_boxes->register_domain( request => $registration_request );
79  
80 # Deletion
81 $logic_boxes->delete_domain_registration_by_id( $domain->id );
82  
83 =head1 REQUIRES
84  
85 =over 4
86  
87 =item submit
88  
89 =item get_domain_by_id
90  
91 =back
92  
93 =head1 DESCRIPTION
94  
95 Implements domain registration related operations with the L<LogicBoxes's|http://www.logicboxes.com> API.
96  
97 =head1 METHODS
98  
99 =head2 register_domain
100  
101 use WWW::LogicBoxes;
102 use WWW::LogicBoxes::Domain;
103 use WWW::LogicBoxes::DomainRequest::Registration;
104  
105 my $logic_boxes = WWW::LogicBoxes->new( ... );
106  
107 my $registration_request = WWW::LogicBoxes::DomainRequest::Registration->new( ... );
108 my $domain = $logic_boxes->register_domain( request => $registration_request );
109  
110 Given a L<WWW::LogicBoxes::DomainRequest::Registration> or a HashRef that can be coreced into a L<WWW::LogicBoxes::DomainRequest::Registration>, attempts to register a domain with L<LogicBoxes|http://www.logicboxes.com>.
111  
112 Returned is a fully formed L<WWW::LogicBoxes::Domain>.
113  
114 =head2 delete_domain_registration_by_id
115  
116 use WWW::LogicBoxes;
117 use WWW::LogicBoxes::Domain;
118  
119 my $logic_boxes = WWW::LogicBoxes->new( ... );
120  
121 $logic_boxes->delete_domain_registration_by_id( $domain->id );
122  
123 Given an Integer L<domain|WWW::LogicBoxes::Domain> id, deletes the specified domain registration. There is a limited amount of time in which you can do this for a new order (typically between 24 and 72 hours) and if you do this too often then L<LogicBoxes|http://www.logicboxes.com> will get grumpy with you.
124  
125 =cut
« blib/lib/WWW/LogicBoxes/DomainRequest/Registration.pm ↑ Summary blib/lib/WWW/LogicBoxes/PhoneNumber.pm »