blib/lib/WWW/LogicBoxes/DomainRequest/Registration.pm

filter: Statementstmt 92.0% 23 / 25 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 85.7% 6 / 7 Podpod 100% 1 / 1 totaltotal 85.7% 30 / 35 CC 2 SCAR 8.1
CC
2
Cov
85%
construct_request
6.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.2
« blib/lib/WWW/LogicBoxes/Types.pm ↑ Summary blib/lib/WWW/LogicBoxes/Role/Command/Domain/Registration.pm »
1 package WWW::LogicBoxes::DomainRequest::Registration;
2  
3 39 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 39 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 39 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 39 ▶use MooseX::StrictConstructor;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 39 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 39 ▶use WWW::LogicBoxes::Types qw( Int );
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 39 extends 'WWW::LogicBoxes::DomainRequest';
13  
14 39 our $VERSION = '1.2.0'; # VERSION
15 # ABSTRACT: Domain Registration Request
16  
17 39 has years => (
18 is => 'ro',
19 isa => Int,
20 required => 1,
21 );
22  
23 sub construct_request {
24 0 ▶ my $self = shift;
Subroutine construct_request: not called CC=2 SCAR=17.9
Pod documented
25  
26 return {
27 0 ▶ 'domain-name' => $self->name,
Branch: 1 branch
BranchTrueFalseTotal
$self->is_private ? : 0 0 0
28 years => $self->years,
29 ns => $self->ns,
30 'customer-id' => $self->customer_id,
31 'reg-contact-id' => $self->registrant_contact_id,
32 'admin-contact-id' => $self->admin_contact_id,
33 'tech-contact-id' => $self->technical_contact_id,
34 'billing-contact-id' => $self->billing_contact_id,
35 'invoice-option' => $self->invoice_option,
36 $self->is_private ? (
37 'protect-privacy' => 'true',
38 'purchase-privacy' => 'true',
39 ) : ( ),
40 };
41 }
42  
43 39 __PACKAGE__->meta->make_immutable;
44 39 1;
45  
46 __END__
47 =pod
48  
49 =head1 NAME
50  
51 WWW::LogicBoxes::DomainRequest::Registration - Representation of Domain Registration Request
52  
53 =head1 SYNOPSIS
54  
55 use WWW::LogicBoxes;
56 use WWW::LogicBoxes::Customer;
57 use WWW::LogicBoxes::Contact;
58 use WWW::LogicBoxes::Domain;
59 use WWW::LogicBoxes::DomainRequest::Registration;
60  
61 my $logic_boxes = WWW::LogicBoxes->new( ... );
62 my $customer = WWW:::LogicBoxes::Customer->new( ... ); # Valid LogicBoxes Customer
63  
64 my $registrant_contact = WWW::LogicBoxes::Contact->new( ... ); # Valid LogicBoxes Contact
65 my $admin_contact = WWW::LogicBoxes::Contact->new( ... ); # Valid LogicBoxes Contact
66 my $technical_contact = WWW::LogicBoxes::Contact->new( ... ); # Valid LogicBoxes Contact
67 my $billing_contact = WWW::LogicBoxes::Contact->new( ... ); # Valid LogicBoxes Contact
68  
69 my $registration_request = WWW::LogicBoxes::DomainRequest::Registration->new(
70 name => 'test-domain.com',
71 years => 1,
72 customer_id => $customer->id,
73 ns => [ 'ns1.logicboxes.com', 'ns2.logicboxes.com' ],
74 registrant_contact_id => $registrant_contact->id,
75 admin_contact_id => $admin_contact->id,
76 technical_contact_id => $technical_contact->id,
77 billing_contact_id => $billing_contact->id,
78 invoice_option => 'NoInvoice',
79 );
80  
81 my $registered_domain = $logic_boxes->register_domain( request => $registration_request );
82  
83 =head1 EXTENDS
84  
85 L<WWW::LogicBoxes::DomainRequest>
86  
87 =head1 DESCRIPTION
88  
89 WWW::LogicBoxes::DomainRequest::Registration is a representation of all the data needed in order to complete a domain registration. It is used when requesting a new registration from L<LogicBoxes|http://www.logicboxes.com>.
90  
91 =head1 ATTRIBUTES
92  
93 All of the existing L<WWW::LogicBoxes::DomainRequest> attributes remain unchanged with one addition attribute.
94  
95 =head2 B<years>
96  
97 The number of years to register this L<domain|WWW::LogicBoxes::Domain> for.
98  
99 =head1 METHODS
100  
101 This method is used internally, it's fairly unlikely that consumers will ever call it directly.
102  
103 =head2 construct_request
104  
105 my $logic_boxes = WWW::LogicBoxes->new( ... );
106 my $registration_request = WWW::LogicBoxes::DomainRequest::Registration->new( ... );
107  
108 my $response = $logic_boxes->submit({
109 method => 'domains__register',
110 params => $registration_request->consturct_request(),
111 });
112  
113 Converts $self into a HashRef suitable for requesting a domain registration with L<LogicBoxes|http://www.logicboxes.com>.
114  
115 =cut
« blib/lib/WWW/LogicBoxes/Types.pm ↑ Summary blib/lib/WWW/LogicBoxes/Role/Command/Domain/Registration.pm »