File Coverage

blib/lib/WWW/LogicBoxes/DomainRequest/Transfer.pm
Criterion Covered Total %
statement 18 20 90.0
branch 0 4 0.0
condition n/a
subroutine 6 7 85.7
pod 1 1 100.0
total 25 32 78.1


line stmt bran cond sub pod time code
1             package WWW::LogicBoxes::DomainRequest::Transfer;
2              
3 39     39   388805 use strict;
  39         113  
  39         1243  
4 39     39   231 use warnings;
  39         119  
  39         1063  
5              
6 39     39   719 use Moose;
  39         138900  
  39         319  
7 39     39   267550 use MooseX::StrictConstructor;
  39         41499  
  39         365  
8 39     39   139290 use namespace::autoclean;
  39         112  
  39         414  
9              
10 39     39   4464 use WWW::LogicBoxes::Types qw( Str );
  39         112  
  39         320  
11              
12             extends 'WWW::LogicBoxes::DomainRequest';
13              
14             our $VERSION = '1.10.0'; # VERSION
15             # ABSTRACT: Domain Transfer Request
16              
17             has epp_key => (
18             is => 'ro',
19             isa => Str,
20             required => 0,
21             predicate => 'has_epp_key',
22             );
23              
24             sub construct_request {
25 0     0 1   my $self = shift;
26              
27             return {
28 0 0         'domain-name' => $self->name,
    0          
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->has_epp_key ? ( 'auth-code' => $self->epp_key ) : ( ),
37             $self->is_private ? (
38             'protect-privacy' => 'true',
39             'purchase-privacy' => 'true',
40             ) : ( ),
41             };
42             }
43              
44             __PACKAGE__->meta->make_immutable;
45             1;
46              
47             __END__
48             =pod
49              
50             =head1 NAME
51              
52             WWW::LogicBoxes::DomainRequest::Transfer - Representation of Domain Transfer Request
53              
54             =head1 SYNOPSIS
55              
56             use WWW::LogicBoxes;
57             use WWW::LogicBoxes::Customer;
58             use WWW::LogicBoxes::Contact;
59             use WWW::LogicBoxes::DomainTransfer;
60             use WWW::LogicBoxes::DomainRequest::Transfer;
61              
62             my $logic_boxes = WWW::LogicBoxes->new( ... );
63             my $customer = WWW:::LogicBoxes::Customer->new( ... ); # Valid LogicBoxes Customer
64              
65             my $registrant_contact = WWW::LogicBoxes::Contact->new( ... ); # Valid LogicBoxes Contact
66             my $admin_contact = WWW::LogicBoxes::Contact->new( ... ); # Valid LogicBoxes Contact
67             my $technical_contact = WWW::LogicBoxes::Contact->new( ... ); # Valid LogicBoxes Contact
68             my $billing_contact = WWW::LogicBoxes::Contact->new( ... ); # Valid LogicBoxes Contact
69              
70             my $transfer_request = WWW::LogicBoxes::DomainRequest::Transfer->new(
71             name => 'test-domain.com',
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 $transfer_domain = $logic_boxes->transfer_domain( request => $transfer_request );
82              
83             =head1 EXTENDS
84              
85             L<WWW::LogicBoxes::DomainRequest>
86              
87             =head1 DESCRIPTION
88              
89             WWW::LogicBoxes::DomainRequest::Transfer is a representation of all the data needed in order to complete a domain transfer. It is used when requesting a new domain transfer 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<epp_key>
96              
97             The epp_key (what L<LogicBoxes|http://www.logicboxes.com> calls the auth code) to register this L<domain transfer|WWW::LogicBoxes::DomainTransfer> for. This need not be specified at this point, and a predicate of has_epp_key is provied.
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 $transfer_request = WWW::LogicBoxes::DomainRequest::Transfer->new( ... );
107              
108             my $response = $logic_boxes->submit({
109             method => 'domains__transfer',
110             params => $transfer_request->consturct_request(),
111             });
112              
113             Converts $self into a HashRef suitable for requesting a domain transfer with L<LogicBoxes|http://www.logicboxes.com>.
114              
115             =cut