| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package WWW::LogicBoxes::Role::Command::Contact; |
|
2
|
|
|
|
|
|
|
|
|
3
|
38
|
|
|
38
|
|
525452
|
use strict; |
|
|
38
|
|
|
|
|
101
|
|
|
|
38
|
|
|
|
|
1171
|
|
|
4
|
38
|
|
|
38
|
|
199
|
use warnings; |
|
|
38
|
|
|
|
|
89
|
|
|
|
38
|
|
|
|
|
959
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
38
|
|
|
38
|
|
657
|
use Moose::Role; |
|
|
38
|
|
|
|
|
182974
|
|
|
|
38
|
|
|
|
|
314
|
|
|
7
|
38
|
|
|
38
|
|
216603
|
use MooseX::Params::Validate; |
|
|
38
|
|
|
|
|
88760
|
|
|
|
38
|
|
|
|
|
364
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
38
|
|
|
38
|
|
19837
|
use WWW::LogicBoxes::Types qw( Contact Int ); |
|
|
38
|
|
|
|
|
81
|
|
|
|
38
|
|
|
|
|
410
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
38
|
|
|
38
|
|
404709
|
use WWW::LogicBoxes::Contact::CA::Agreement; |
|
|
38
|
|
|
|
|
214
|
|
|
|
38
|
|
|
|
|
1778
|
|
|
12
|
38
|
|
|
38
|
|
22027
|
use WWW::LogicBoxes::Contact::Factory; |
|
|
38
|
|
|
|
|
161
|
|
|
|
38
|
|
|
|
|
1668
|
|
|
13
|
|
|
|
|
|
|
|
|
14
|
38
|
|
|
38
|
|
284
|
use Try::Tiny; |
|
|
38
|
|
|
|
|
97
|
|
|
|
38
|
|
|
|
|
2209
|
|
|
15
|
38
|
|
|
38
|
|
243
|
use Carp; |
|
|
38
|
|
|
|
|
91
|
|
|
|
38
|
|
|
|
|
1714
|
|
|
16
|
|
|
|
|
|
|
|
|
17
|
38
|
|
|
38
|
|
889
|
use Readonly; |
|
|
38
|
|
|
|
|
3815
|
|
|
|
38
|
|
|
|
|
22325
|
|
|
18
|
|
|
|
|
|
|
Readonly our $UPDATE_CONTACT_OBSOLETE => 'Due to IRTP Regulations, as of 2016-12-01 it is no longer possible to update contacts. Instead, you should create a new contact and then assoicate this new contact with the domain whose contact you wish to change'; |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
requires 'submit'; |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
our $VERSION = '1.10.0'; # VERSION |
|
23
|
|
|
|
|
|
|
# ABSTRACT: Contact API Calls |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub create_contact { |
|
26
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
27
|
0
|
|
|
|
|
|
my (%args) = validated_hash( |
|
28
|
|
|
|
|
|
|
\@_, |
|
29
|
|
|
|
|
|
|
contact => { isa => Contact, coerce => 1 }, |
|
30
|
|
|
|
|
|
|
); |
|
31
|
|
|
|
|
|
|
|
|
32
|
0
|
0
|
|
|
|
|
if( $args{contact}->has_id ) { |
|
33
|
0
|
|
|
|
|
|
croak "Contact already exists (it has an id)"; |
|
34
|
|
|
|
|
|
|
} |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
my $response = $self->submit({ |
|
37
|
|
|
|
|
|
|
method => 'contacts__add', |
|
38
|
0
|
|
|
|
|
|
params => $args{contact}->construct_creation_request(), |
|
39
|
|
|
|
|
|
|
}); |
|
40
|
|
|
|
|
|
|
|
|
41
|
0
|
|
|
|
|
|
$args{contact}->_set_id($response->{id}); |
|
42
|
|
|
|
|
|
|
|
|
43
|
0
|
|
|
|
|
|
return $args{contact}; |
|
44
|
|
|
|
|
|
|
} |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub get_contact_by_id { |
|
47
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
48
|
0
|
|
|
|
|
|
my ( $id ) = pos_validated_list( \@_, { isa => Int } ); |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
return try { |
|
51
|
0
|
|
|
0
|
|
|
my $response = $self->submit({ |
|
52
|
|
|
|
|
|
|
method => 'contacts__details', |
|
53
|
|
|
|
|
|
|
params => { |
|
54
|
|
|
|
|
|
|
'contact-id' => $id, |
|
55
|
|
|
|
|
|
|
}, |
|
56
|
|
|
|
|
|
|
}); |
|
57
|
|
|
|
|
|
|
|
|
58
|
0
|
|
|
|
|
|
return WWW::LogicBoxes::Contact::Factory->construct_from_response( $response ); |
|
59
|
|
|
|
|
|
|
} |
|
60
|
|
|
|
|
|
|
catch { |
|
61
|
0
|
0
|
0
|
0
|
|
|
if( $_ =~ m/^Invalid contact-id/ || $_ =~ m/^No Entity found/ ) { |
|
62
|
0
|
|
|
|
|
|
return; |
|
63
|
|
|
|
|
|
|
} |
|
64
|
|
|
|
|
|
|
|
|
65
|
0
|
|
|
|
|
|
croak $_; |
|
66
|
0
|
|
|
|
|
|
}; |
|
67
|
|
|
|
|
|
|
} |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub update_contact { |
|
70
|
0
|
|
|
0
|
1
|
|
croak $UPDATE_CONTACT_OBSOLETE; |
|
71
|
|
|
|
|
|
|
} |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub delete_contact_by_id { |
|
74
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
75
|
0
|
|
|
|
|
|
my ( $id ) = pos_validated_list( \@_, { isa => Int } ); |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
return try { |
|
78
|
0
|
|
|
0
|
|
|
$self->submit({ |
|
79
|
|
|
|
|
|
|
method => 'contacts__delete', |
|
80
|
|
|
|
|
|
|
params => { |
|
81
|
|
|
|
|
|
|
'contact-id' => $id, |
|
82
|
|
|
|
|
|
|
}, |
|
83
|
|
|
|
|
|
|
}); |
|
84
|
|
|
|
|
|
|
|
|
85
|
0
|
|
|
|
|
|
return; |
|
86
|
|
|
|
|
|
|
} |
|
87
|
|
|
|
|
|
|
catch { |
|
88
|
0
|
|
|
0
|
|
|
croak $_; |
|
89
|
0
|
|
|
|
|
|
}; |
|
90
|
|
|
|
|
|
|
} |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
sub get_ca_registrant_agreement { |
|
93
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
return try { |
|
96
|
0
|
|
|
0
|
|
|
my $response = $self->submit({ |
|
97
|
|
|
|
|
|
|
method => 'contacts__dotca__registrantagreement', |
|
98
|
|
|
|
|
|
|
}); |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
return WWW::LogicBoxes::Contact::CA::Agreement->new( |
|
101
|
|
|
|
|
|
|
version => $response->{version}, |
|
102
|
|
|
|
|
|
|
content => $response->{agreement}, |
|
103
|
0
|
|
|
|
|
|
); |
|
104
|
|
|
|
|
|
|
} |
|
105
|
|
|
|
|
|
|
catch { |
|
106
|
0
|
|
|
0
|
|
|
croak $_; |
|
107
|
0
|
|
|
|
|
|
}; |
|
108
|
|
|
|
|
|
|
} |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
1; |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
__END__ |
|
113
|
|
|
|
|
|
|
=pod |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=head1 NAME |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
WWW::LogicBoxes::Role::Command::Contact - Contact Related Operations |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
use WWW::LogicBoxes; |
|
122
|
|
|
|
|
|
|
use WWW::LogicBoxes::Customer; |
|
123
|
|
|
|
|
|
|
use WWW::LogicBoxes::Contact; |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
my $customer = WWW::LogicBoxes::Customer->new( ... ); |
|
126
|
|
|
|
|
|
|
my $contact = WWW::LogicBoxes::Contact->new( ... ); |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
# Creation |
|
129
|
|
|
|
|
|
|
my $logic_boxes = WWW::LogicBoxes->new( ... ); |
|
130
|
|
|
|
|
|
|
$logic_boxes->create_contact( contact => $contact ); |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
# Retrieval |
|
133
|
|
|
|
|
|
|
my $retrieved_contact = $logic_boxes->get_contact_by_id( $contact->id ); |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
# Update |
|
136
|
|
|
|
|
|
|
# UPDATE IS OBSOLETE AND NO LONGER SUPPORTED! ( See POD ) |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
# Deletion |
|
139
|
|
|
|
|
|
|
$logic_boxes->delete_contact_by_id( $contact->id ); |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
# CA Registrant Agreement |
|
142
|
|
|
|
|
|
|
my $agreement = $logic_boxes->get_ca_registrant_agreement(); |
|
143
|
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=head1 REQURIES |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
submit |
|
147
|
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
Implements contact related operations with the L<LogicBoxes's|http://www.logicboxes.com> API. |
|
151
|
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=head1 METHODS |
|
153
|
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=head2 create_contact |
|
155
|
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
use WWW::LogicBoxes; |
|
157
|
|
|
|
|
|
|
use WWW::LogicBoxes::Customer; |
|
158
|
|
|
|
|
|
|
use WWW::LogicBoxes::Contact; |
|
159
|
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
my $customer = WWW::LogicBoxes::Customer->new( ... ); |
|
161
|
|
|
|
|
|
|
my $contact = WWW::LogicBoxes::Contact->new( ... ); |
|
162
|
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
my $logic_boxes = WWW::LogicBoxes->new( ... ); |
|
164
|
|
|
|
|
|
|
$logic_boxes->create_contact( contact => $contact ); |
|
165
|
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
print 'New contact id: ' . $contact->id . "\n"; |
|
167
|
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
Given a L<WWW::LogicBoxes::Contact> or a HashRef that can be coerced into a L<WWW::LogicBoxes::Contact>, creates the specified contact with LogicBoxes. |
|
169
|
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=head2 get_contact_by_id |
|
171
|
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
use WWW::LogicBoxes; |
|
173
|
|
|
|
|
|
|
use WWW::LogicBoxes::Contact; |
|
174
|
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
my $logic_boxes = WWW::LogicBoxes->new( ... ); |
|
176
|
|
|
|
|
|
|
my $contact = $logic_boxes->get_contact_by_id( 42 ); |
|
177
|
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
Given an Integer ID, will return an instance of L<WWW::LogicBoxes::Contact> (or one of it's subclass for specialized contacts). Returns undef if there is no matching L<contact|WWW::LogicBoxes::Contact> with the specified id. |
|
179
|
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
=head2 update_contact |
|
181
|
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
OBSOLETE! |
|
183
|
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
On 2016-12-01, a new L<ICANN Inter Registrar Transfer Policy|https://www.icann.org/resources/pages/transfer-policy-2016-06-01-en> went into effect. LogicBoxes is complying with this by not permitting modification of contacts any longer. |
|
185
|
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
Instead, if you wish to update a contact, you should do the following: |
|
187
|
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
=over 4 |
|
189
|
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
=item 1. Create a New Contact - L<create_contact|WWW::LogicBoxes::Role::Command::Contact/create_contact> |
|
191
|
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
=item 2. Assign That Contact To The Domain - L<update_domain_contacts|WWW::LogicBoxes::Role::Command::Domain/update_domain_contacts> |
|
193
|
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
=item 3. (Optionally) Delete the previous contact after the changes are approved - L<delete_contact_by_id|WWW::LogicBoxes::Role::Command::Contact/delete_contact_by_id> |
|
195
|
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
=back |
|
197
|
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
=head2 delete_contact_by_id |
|
199
|
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
use WWW::LogicBoxes; |
|
201
|
|
|
|
|
|
|
use WWW::LogicBoxes::Contact; |
|
202
|
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
my $logic_boxes = WWW::LogicBoxes->new( ... ); |
|
204
|
|
|
|
|
|
|
$logic_boxes->delete_contact_by_id( 42 ); |
|
205
|
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
Given an Integer ID, will delete the L<contact|WWW::LogicBoxes::Contact> with L<LogicBoxes|http://www.logicboxes.com>. |
|
207
|
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
This method will croak if the contact is in use (assigned to a domain). |
|
209
|
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
=head2 get_ca_registrant_agreement |
|
211
|
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
use WWW::LogicBoxes; |
|
213
|
|
|
|
|
|
|
use WWW::LogicBoxes::Contact; |
|
214
|
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
my $logic_boxes = WWW::LogicBoxes->new( ... ); |
|
216
|
|
|
|
|
|
|
my $agreement = $logic_boxes->get_ca_registrant_agreement(); |
|
217
|
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
Accepts no arguments, returns an instance of L<WWW::LogicBoxes::Contact::CA::Agreement> that describes the currently active and required CA Registrant Agreement. |
|
219
|
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
B<Note> Registrants are required to accept this agreement in order to register a .ca domain. |
|
221
|
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
=cut |