| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package WWW::LogicBoxes::Customer; |
|
2
|
|
|
|
|
|
|
|
|
3
|
40
|
|
|
40
|
|
360017
|
use strict; |
|
|
40
|
|
|
|
|
105
|
|
|
|
40
|
|
|
|
|
1371
|
|
|
4
|
40
|
|
|
40
|
|
269
|
use warnings; |
|
|
40
|
|
|
|
|
92
|
|
|
|
40
|
|
|
|
|
1154
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
40
|
|
|
40
|
|
729
|
use Moose; |
|
|
40
|
|
|
|
|
144599
|
|
|
|
40
|
|
|
|
|
344
|
|
|
7
|
40
|
|
|
40
|
|
286687
|
use Moose::Util::TypeConstraints; |
|
|
40
|
|
|
|
|
105
|
|
|
|
40
|
|
|
|
|
442
|
|
|
8
|
40
|
|
|
40
|
|
99712
|
use MooseX::StrictConstructor; |
|
|
40
|
|
|
|
|
39223
|
|
|
|
40
|
|
|
|
|
363
|
|
|
9
|
40
|
|
|
40
|
|
173232
|
use namespace::autoclean; |
|
|
40
|
|
|
|
|
109
|
|
|
|
40
|
|
|
|
|
420
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
40
|
|
|
40
|
|
4928
|
use WWW::LogicBoxes::Types qw(EmailAddress Int Language PhoneNumber Str ); |
|
|
40
|
|
|
|
|
115
|
|
|
|
40
|
|
|
|
|
441
|
|
|
12
|
|
|
|
|
|
|
|
|
13
|
40
|
|
|
40
|
|
452700
|
use WWW::LogicBoxes::PhoneNumber; |
|
|
40
|
|
|
|
|
110
|
|
|
|
40
|
|
|
|
|
20734
|
|
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our $VERSION = '1.11.0'; # VERSION |
|
16
|
|
|
|
|
|
|
# ABSTRACT: LogicBoxes Customer |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
has 'id' => ( |
|
19
|
|
|
|
|
|
|
is => 'ro', |
|
20
|
|
|
|
|
|
|
isa => Int, |
|
21
|
|
|
|
|
|
|
required => 0, |
|
22
|
|
|
|
|
|
|
predicate => 'has_id', |
|
23
|
|
|
|
|
|
|
writer => '_set_id', |
|
24
|
|
|
|
|
|
|
); |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
has 'username' => ( |
|
27
|
|
|
|
|
|
|
is => 'ro', |
|
28
|
|
|
|
|
|
|
isa => EmailAddress, |
|
29
|
|
|
|
|
|
|
required => 1, |
|
30
|
|
|
|
|
|
|
); |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
has 'name' => ( |
|
33
|
|
|
|
|
|
|
is => 'ro', |
|
34
|
|
|
|
|
|
|
isa => Str, |
|
35
|
|
|
|
|
|
|
required => 1, |
|
36
|
|
|
|
|
|
|
); |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
has 'company' => ( |
|
39
|
|
|
|
|
|
|
is => 'ro', |
|
40
|
|
|
|
|
|
|
isa => Str, |
|
41
|
|
|
|
|
|
|
required => 1, |
|
42
|
|
|
|
|
|
|
); |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
has 'address1' => ( |
|
45
|
|
|
|
|
|
|
is => 'ro', |
|
46
|
|
|
|
|
|
|
isa => Str, |
|
47
|
|
|
|
|
|
|
required => 1, |
|
48
|
|
|
|
|
|
|
); |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
has 'address2' => ( |
|
51
|
|
|
|
|
|
|
is => 'ro', |
|
52
|
|
|
|
|
|
|
isa => Str, |
|
53
|
|
|
|
|
|
|
required => 0, |
|
54
|
|
|
|
|
|
|
predicate => 'has_address2', |
|
55
|
|
|
|
|
|
|
); |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
has 'address3' => ( |
|
58
|
|
|
|
|
|
|
is => 'ro', |
|
59
|
|
|
|
|
|
|
isa => Str, |
|
60
|
|
|
|
|
|
|
required => 0, |
|
61
|
|
|
|
|
|
|
predicate => 'has_address3', |
|
62
|
|
|
|
|
|
|
); |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
has 'city' => ( |
|
65
|
|
|
|
|
|
|
is => 'ro', |
|
66
|
|
|
|
|
|
|
isa => Str, |
|
67
|
|
|
|
|
|
|
required => 1, |
|
68
|
|
|
|
|
|
|
); |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
has 'state' => ( |
|
71
|
|
|
|
|
|
|
is => 'ro', |
|
72
|
|
|
|
|
|
|
isa => Str, |
|
73
|
|
|
|
|
|
|
required => 0, |
|
74
|
|
|
|
|
|
|
predicate => 'has_state', |
|
75
|
|
|
|
|
|
|
); |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
has 'country' => ( |
|
78
|
|
|
|
|
|
|
is => 'ro', |
|
79
|
|
|
|
|
|
|
isa => Str, |
|
80
|
|
|
|
|
|
|
required => 1, |
|
81
|
|
|
|
|
|
|
); |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
has 'zipcode' => ( |
|
84
|
|
|
|
|
|
|
is => 'ro', |
|
85
|
|
|
|
|
|
|
isa => Str, |
|
86
|
|
|
|
|
|
|
required => 1, |
|
87
|
|
|
|
|
|
|
); |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
has 'phone_number' => ( |
|
90
|
|
|
|
|
|
|
is => 'ro', |
|
91
|
|
|
|
|
|
|
isa => PhoneNumber, |
|
92
|
|
|
|
|
|
|
required => 1, |
|
93
|
|
|
|
|
|
|
coerce => 1, |
|
94
|
|
|
|
|
|
|
); |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
has 'alt_phone_number' => ( |
|
97
|
|
|
|
|
|
|
is => 'ro', |
|
98
|
|
|
|
|
|
|
isa => PhoneNumber, |
|
99
|
|
|
|
|
|
|
required => 0, |
|
100
|
|
|
|
|
|
|
coerce => 1, |
|
101
|
|
|
|
|
|
|
predicate => 'has_alt_phone_number', |
|
102
|
|
|
|
|
|
|
); |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
has 'mobile_phone_number' => ( |
|
105
|
|
|
|
|
|
|
is => 'ro', |
|
106
|
|
|
|
|
|
|
isa => PhoneNumber, |
|
107
|
|
|
|
|
|
|
required => 0, |
|
108
|
|
|
|
|
|
|
coerce => 1, |
|
109
|
|
|
|
|
|
|
predicate => 'has_mobile_phone_number', |
|
110
|
|
|
|
|
|
|
); |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
has 'fax_number' => ( |
|
113
|
|
|
|
|
|
|
is => 'ro', |
|
114
|
|
|
|
|
|
|
isa => PhoneNumber, |
|
115
|
|
|
|
|
|
|
required => 0, |
|
116
|
|
|
|
|
|
|
coerce => 1, |
|
117
|
|
|
|
|
|
|
predicate => 'has_fax_number', |
|
118
|
|
|
|
|
|
|
); |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
has 'language_preference' => ( |
|
121
|
|
|
|
|
|
|
is => 'ro', |
|
122
|
|
|
|
|
|
|
isa => Language, |
|
123
|
|
|
|
|
|
|
default => 'en', |
|
124
|
|
|
|
|
|
|
); |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
sub construct_from_response { |
|
127
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
128
|
0
|
|
|
|
|
|
my $response = shift; |
|
129
|
|
|
|
|
|
|
|
|
130
|
0
|
0
|
|
|
|
|
if(!defined $response) { |
|
131
|
0
|
|
|
|
|
|
return; |
|
132
|
|
|
|
|
|
|
} |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
return $self->new({ |
|
135
|
|
|
|
|
|
|
id => $response->{customerid}, |
|
136
|
|
|
|
|
|
|
username => $response->{username}, |
|
137
|
|
|
|
|
|
|
name => $response->{name}, |
|
138
|
|
|
|
|
|
|
company => $response->{company}, |
|
139
|
|
|
|
|
|
|
address1 => $response->{address1}, |
|
140
|
|
|
|
|
|
|
( exists $response->{address2} ) ? ( address2 => $response->{address2} ) : ( ), |
|
141
|
|
|
|
|
|
|
( exists $response->{address3} ) ? ( address3 => $response->{address3} ) : ( ), |
|
142
|
|
|
|
|
|
|
city => $response->{city}, |
|
143
|
|
|
|
|
|
|
( $response->{state} ne 'Not Applicable' ) ? ( state => $response->{state} ) : ( ), |
|
144
|
|
|
|
|
|
|
country => $response->{country}, |
|
145
|
|
|
|
|
|
|
zipcode => $response->{zip}, |
|
146
|
|
|
|
|
|
|
phone_number => ( $response->{telnocc} . $response->{telno} ), |
|
147
|
|
|
|
|
|
|
( exists $response->{faxnocc} ) |
|
148
|
|
|
|
|
|
|
? ( fax_number => ( $response->{faxnocc} . $response->{faxno} ) ) |
|
149
|
|
|
|
|
|
|
: ( ), |
|
150
|
|
|
|
|
|
|
( exists $response->{mobilenocc} ) |
|
151
|
|
|
|
|
|
|
? ( mobile_phone_number => ( $response->{mobilenocc} . $response->{mobileno} ) ) |
|
152
|
|
|
|
|
|
|
: ( ), |
|
153
|
|
|
|
|
|
|
( exists $response->{alttelnocc} ) |
|
154
|
|
|
|
|
|
|
? ( alt_phone_number => ( $response->{alttelnocc} . $response->{alttelno} ) ) |
|
155
|
|
|
|
|
|
|
: ( ), |
|
156
|
|
|
|
|
|
|
language_preference => $response->{langpref}, |
|
157
|
0
|
0
|
|
|
|
|
}); |
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
} |
|
159
|
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
|
161
|
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
1; |
|
163
|
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
__END__ |
|
165
|
|
|
|
|
|
|
=pod |
|
166
|
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
=head1 NAME |
|
168
|
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
WWW::LogicBoxes::Customer - Representation of LogicBoxes Customer |
|
170
|
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
172
|
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
use strict; |
|
174
|
|
|
|
|
|
|
use warnings; |
|
175
|
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
use WWW::LogicBoxes::Customer; |
|
177
|
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
my $customer = WWW::LogicBoxes::Customer->new( |
|
179
|
|
|
|
|
|
|
id => 42, |
|
180
|
|
|
|
|
|
|
username => 'alan.turing@enigma-crackers.com', |
|
181
|
|
|
|
|
|
|
name => 'Alan Turing', |
|
182
|
|
|
|
|
|
|
company => 'Princeton University', |
|
183
|
|
|
|
|
|
|
address1 => 'Office P is Equal to NP', |
|
184
|
|
|
|
|
|
|
address2 => '123 Turing Machine Way', |
|
185
|
|
|
|
|
|
|
address3 => 'Suite 100', |
|
186
|
|
|
|
|
|
|
city => 'New York', |
|
187
|
|
|
|
|
|
|
state => 'New York', |
|
188
|
|
|
|
|
|
|
country => 'US', |
|
189
|
|
|
|
|
|
|
zipcode => '10108', |
|
190
|
|
|
|
|
|
|
phone_number => '18005551212', |
|
191
|
|
|
|
|
|
|
alt_phone_number => '18005551212', |
|
192
|
|
|
|
|
|
|
mobile_phone_number => '18005551212', |
|
193
|
|
|
|
|
|
|
fax_number => '18005551212', |
|
194
|
|
|
|
|
|
|
language_preference => 'en', |
|
195
|
|
|
|
|
|
|
); |
|
196
|
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
198
|
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
Representation of a L<LogicBoxes|http://www.logicobxes.com> customer. |
|
200
|
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
|
202
|
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
=head2 id |
|
204
|
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
Customers that have been created with LogicBoxes will have an id assigned for them. A predicate exists 'has_id' that can be used to check to see if an id has been assigned to this customer. A private writer of _set_id is also provided. |
|
206
|
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
=head2 B<username> |
|
208
|
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
Email address for customer. |
|
210
|
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
=head2 B<name> |
|
212
|
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
=head2 B<company> |
|
214
|
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
Company of the customer. This is a required field so if there is no company some sentinal string of "None" or something similiar shou ld be used. |
|
216
|
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
=head2 B<address1> |
|
218
|
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
=head2 address2 |
|
220
|
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
Predicate of has_address2. |
|
222
|
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
=head2 address3 |
|
224
|
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
Predicate of has_address3. |
|
226
|
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
=head2 B<city> |
|
228
|
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
=head2 state |
|
230
|
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
This is the full name of the state, so Texas rather than TX should be used. Not all regions in the world have states so this is not a required field, a predicate of has_state exists. |
|
232
|
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
=head2 B<country> |
|
234
|
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
The ISO-3166 code for the country. For more information on ISO-3166 please see L<Wikipedia|https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2>. |
|
236
|
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
=head2 B<zipcode> |
|
238
|
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
=head2 B<phone_number> |
|
240
|
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
Be sure to include the country code. When it comes to the phone number a string or L<Number::Phone> object can be provided and it wi ll be coerced into the L<WWW::LogicBoxes::PhoneNumber> internal representation used. |
|
242
|
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
=head2 alt_phone_number |
|
244
|
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
Predicate of has_alt_phone_number. |
|
246
|
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
=head2 mobile_phone_number |
|
248
|
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
Predicate of has_mobile_phone_number. |
|
250
|
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
=head2 fax_number |
|
252
|
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
Predicate of has_fax_number. |
|
254
|
|
|
|
|
|
|
|
|
255
|
|
|
|
|
|
|
=head2 language_preference |
|
256
|
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
The default language to use for messages that are displayed to customers if they log directly into L<LogicBoxes|http://www.logicboxes.com>. This must be an ISO-639-1 two digit language code as detailed in L<https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes>. The default is en for English. |
|
258
|
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
If you have fully abstracted LogicBoxes for your customers and they never log in directly to manage their domains then this value doesn't really matter. |
|
260
|
|
|
|
|
|
|
|
|
261
|
|
|
|
|
|
|
=head1 METHODS |
|
262
|
|
|
|
|
|
|
|
|
263
|
|
|
|
|
|
|
These methods are used internally, it's fairly unlikely that consumers will ever call them directly. |
|
264
|
|
|
|
|
|
|
|
|
265
|
|
|
|
|
|
|
=head2 construct_from_response |
|
266
|
|
|
|
|
|
|
|
|
267
|
|
|
|
|
|
|
my $logic_boxes = WWW::LogicBoxes->new( ... ); |
|
268
|
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
my $response = $logic_boxes->submit({ |
|
270
|
|
|
|
|
|
|
method => 'customers__details_by_id', |
|
271
|
|
|
|
|
|
|
params => { |
|
272
|
|
|
|
|
|
|
'customer-id' => 42, |
|
273
|
|
|
|
|
|
|
} |
|
274
|
|
|
|
|
|
|
}); |
|
275
|
|
|
|
|
|
|
|
|
276
|
|
|
|
|
|
|
my $customer = WWW::LogicBoxes::Customer->construct_from_response( $response ); |
|
277
|
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
Creates an instance of $self from a L<LogicBoxes|http://www.logicbox.com> response. |
|
279
|
|
|
|
|
|
|
|
|
280
|
|
|
|
|
|
|
=cut |