line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
=encoding utf-8 |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
=head1 NAME |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
Webservice::OVH::Me |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 SYNOPSIS |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
use Webservice::OVH; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
my $ovh = Webservice::OVH->new_from_json("credentials.json"); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
my $contacts = $ovh->me->contacts; |
15
|
|
|
|
|
|
|
my $tasks_contact_change = $ovh->me->tasks_contact_change; |
16
|
|
|
|
|
|
|
my $orders = $ovh->me->orders(DateTime->now->sub(days => -1), DateTime->now); |
17
|
|
|
|
|
|
|
my $bills = $ovh->me->bills(DateTime->now->sub(days => -1), DateTime->now); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
my $bill_id = $bills->[0]->id; |
20
|
|
|
|
|
|
|
my $order_id = $orders->[0]->id; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
my $bill = $me->ovh->bill($bill_id); |
23
|
|
|
|
|
|
|
my $order = $me->ovh->bill($order_id); |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
print $bill->pdf_url; |
26
|
|
|
|
|
|
|
print $order->url; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head1 DESCRIPTION |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
Module support for now only basic retrieval methods for contacs, tasks, orders and bills |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head1 METHODS |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=cut |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
use strict; |
37
|
36
|
|
|
36
|
|
244
|
use warnings; |
|
36
|
|
|
|
|
73
|
|
|
36
|
|
|
|
|
1034
|
|
38
|
36
|
|
|
36
|
|
184
|
use Carp qw{ carp croak }; |
|
36
|
|
|
|
|
92
|
|
|
36
|
|
|
|
|
985
|
|
39
|
36
|
|
|
36
|
|
164
|
use Webservice::OVH::Helper; |
|
36
|
|
|
|
|
65
|
|
|
36
|
|
|
|
|
1811
|
|
40
|
36
|
|
|
36
|
|
204
|
|
|
36
|
|
|
|
|
75
|
|
|
36
|
|
|
|
|
1298
|
|
41
|
|
|
|
|
|
|
our $VERSION = 0.47; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
# sub modules |
44
|
|
|
|
|
|
|
use Webservice::OVH::Me::Contact; |
45
|
36
|
|
|
36
|
|
190
|
use Webservice::OVH::Me::Order; |
|
36
|
|
|
|
|
104
|
|
|
36
|
|
|
|
|
872
|
|
46
|
36
|
|
|
36
|
|
13938
|
use Webservice::OVH::Me::Bill; |
|
36
|
|
|
|
|
96
|
|
|
36
|
|
|
|
|
1054
|
|
47
|
36
|
|
|
36
|
|
14130
|
use Webservice::OVH::Me::Task; |
|
36
|
|
|
|
|
82
|
|
|
36
|
|
|
|
|
1018
|
|
48
|
36
|
|
|
36
|
|
12778
|
|
|
36
|
|
|
|
|
87
|
|
|
36
|
|
|
|
|
33342
|
|
49
|
|
|
|
|
|
|
=head2 _new |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
Internal Method to create the me object. |
52
|
|
|
|
|
|
|
This method is not ment to be called external. |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=over |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=item * Parameter: $api_wrapper - ovh api wrapper object, $module - root object |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=item * Return: L<Webservice::OVH::Me> |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=item * Synopsis: Webservice::OVH::Me->_new($ovh_api_wrapper, $self); |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=back |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=cut |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
my ( $class, %params ) = @_; |
68
|
|
|
|
|
|
|
|
69
|
0
|
|
|
0
|
|
|
die "Missing module" unless $params{module}; |
70
|
|
|
|
|
|
|
die "Missing wrapper" unless $params{wrapper}; |
71
|
0
|
0
|
|
|
|
|
|
72
|
0
|
0
|
|
|
|
|
my $module = $params{module}; |
73
|
|
|
|
|
|
|
my $api_wrapper = $params{wrapper}; |
74
|
0
|
|
|
|
|
|
|
75
|
0
|
|
|
|
|
|
my $self = bless { _module => $module, _api_wrapper => $api_wrapper, _contacts => {}, _tasks_contact_change => {}, _orders => {}, _bills => {} }, $class; |
76
|
|
|
|
|
|
|
|
77
|
0
|
|
|
|
|
|
return $self; |
78
|
|
|
|
|
|
|
} |
79
|
0
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head2 contacts |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Produces an array of all available contacts that are stored for the used account. |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=over |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=item * Return: ARRAY |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=item * Synopsis: my $contacts = $ovh->me->contacs(); |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=back |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=cut |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
my ($self) = @_; |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
my $api = $self->{_api_wrapper}; |
98
|
0
|
|
|
0
|
1
|
|
my $response = $api->rawCall( method => 'get', path => "/me/contact", noSignature => 0 ); |
99
|
|
|
|
|
|
|
croak $response->error if $response->error; |
100
|
0
|
|
|
|
|
|
|
101
|
0
|
|
|
|
|
|
my $contact_ids = $response->content; |
102
|
0
|
0
|
|
|
|
|
my $contacts = []; |
103
|
|
|
|
|
|
|
|
104
|
0
|
|
|
|
|
|
foreach my $contact_id (@$contact_ids) { |
105
|
0
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
my $contact = $self->{_contacts}{$contact_id} = $self->{_contacts}{$contact_id} || Webservice::OVH::Me::Contact->_new_existing( wrapper => $api, id => $contact_id, module => $self->{_module} ); |
107
|
0
|
|
|
|
|
|
push @$contacts, $contact; |
108
|
|
|
|
|
|
|
} |
109
|
0
|
|
0
|
|
|
|
|
110
|
0
|
|
|
|
|
|
return $contacts; |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
|
113
|
0
|
|
|
|
|
|
=head2 contact |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
Returns a single contact by id |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=over |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=item * Parameter: $contact_id - id |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=item * Return: L<Webservice::OVH::Me::Contact> |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=item * Synopsis: my $contact = $ovh->me->contact(1234567); |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=back |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=cut |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
my ( $self, $contact_id ) = @_; |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
my $api = $self->{_api_wrapper}; |
133
|
|
|
|
|
|
|
my $contact = $self->{_contacts}{$contact_id} = $self->{_contacts}{$contact_id} || Webservice::OVH::Me::Contact->_new_existing( wrapper => $api, id => $contact_id, module => $self->{_module} ); |
134
|
0
|
|
|
0
|
1
|
|
|
135
|
|
|
|
|
|
|
return $contact; |
136
|
0
|
|
|
|
|
|
} |
137
|
0
|
|
0
|
|
|
|
|
138
|
|
|
|
|
|
|
=head2 tasks_contact_change |
139
|
0
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
Produces an array of all available contact change tasks. |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=over |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=item * Return: ARRAY |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=item * Synopsis: my $tasks = $ovh->me->tasks_contact_change(); |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=back |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=cut |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
my ($self) = @_; |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
my $api = $self->{_api_wrapper}; |
156
|
|
|
|
|
|
|
my $response = $api->rawCall( method => 'get', path => "/me/task/contactChange", noSignature => 0 ); |
157
|
|
|
|
|
|
|
croak $response->error if $response->error; |
158
|
0
|
|
|
0
|
1
|
|
|
159
|
|
|
|
|
|
|
my $task_ids = $response->content; |
160
|
0
|
|
|
|
|
|
my $tasks = []; |
161
|
0
|
|
|
|
|
|
|
162
|
0
|
0
|
|
|
|
|
foreach my $task_id (@$task_ids) { |
163
|
|
|
|
|
|
|
|
164
|
0
|
|
|
|
|
|
my $task = $self->{_tasks_contact_change}{$task_id} = $self->{_tasks_contact_change}{$task_id} || Webservice::OVH::Me::Task->_new( wrapper => $api, type => "contact_change", id => $task_id, module => $self->{_module} ); |
165
|
0
|
|
|
|
|
|
push @$tasks, $task; |
166
|
|
|
|
|
|
|
} |
167
|
0
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
return $tasks; |
169
|
0
|
|
0
|
|
|
|
} |
170
|
0
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=head2 task_contact_change |
172
|
|
|
|
|
|
|
|
173
|
0
|
|
|
|
|
|
Returns a single contact change task by id |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
=over |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
=item * Parameter: $task_id - id |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
=item * Return: L<Webservice::OVH::Me::Task> |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
=item * Synopsis: my $contact = $ovh->me->task_contact_change(1234567); |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
=back |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
=cut |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
my ( $self, $task_id ) = @_; |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
my $api = $self->{_api_wrapper}; |
191
|
|
|
|
|
|
|
my $task = $self->{_tasks_contact_change}{$task_id} = $self->{_tasks_contact_change}{$task_id} || Webservice::OVH::Me::Task->_new( wrapper => $api, type => "contact_change", id => $task_id, module => $self->{_module} ); |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
return $task; |
194
|
0
|
|
|
0
|
1
|
|
|
195
|
|
|
|
|
|
|
} |
196
|
0
|
|
|
|
|
|
|
197
|
0
|
|
0
|
|
|
|
=head2 orders |
198
|
|
|
|
|
|
|
|
199
|
0
|
|
|
|
|
|
Produces an array of all available orders. |
200
|
|
|
|
|
|
|
Orders can be optionally filtered by date. |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
=over |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
=item * Parameter: $date_from - optional filter DateTime, $date_to - optional filter DateTime |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
=item * Return: ARRAY |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
=item * Synopsis: my $orders = $ovh->me->orders(DateTime->new(), DateTime->new()); |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
=back |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
=cut |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
my ( $self, $date_from, $date_to ) = @_; |
216
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
my $str_date_from = $date_from ? $date_from->strftime("%Y-%m-%d") : ""; |
218
|
|
|
|
|
|
|
my $str_date_to = $date_to ? $date_to->strftime("%Y-%m-%d") : ""; |
219
|
|
|
|
|
|
|
my $filter = Webservice::OVH::Helper->construct_filter( "date.from" => $str_date_from, "date.to" => $str_date_to ); |
220
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
my $api = $self->{_api_wrapper}; |
222
|
0
|
|
|
0
|
1
|
|
my $response = $api->rawCall( method => 'get', path => "/me/order$filter", noSignature => 0 ); |
223
|
|
|
|
|
|
|
croak $response->error if $response->error; |
224
|
0
|
0
|
|
|
|
|
|
225
|
0
|
0
|
|
|
|
|
my $order_ids = $response->content; |
226
|
0
|
|
|
|
|
|
my $orders = []; |
227
|
|
|
|
|
|
|
|
228
|
0
|
|
|
|
|
|
foreach my $order_id (@$order_ids) { |
229
|
0
|
|
|
|
|
|
|
230
|
0
|
0
|
|
|
|
|
my $order = $self->{_orders}{$order_id} = $self->{_orders}{$order_id} || Webservice::OVH::Me::Order->_new( wrapper => $api, id => $order_id, module => $self->{_module} ); |
231
|
|
|
|
|
|
|
push @$orders, $order; |
232
|
0
|
|
|
|
|
|
} |
233
|
0
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
return $orders; |
235
|
0
|
|
|
|
|
|
} |
236
|
|
|
|
|
|
|
|
237
|
0
|
|
0
|
|
|
|
=head2 order |
238
|
0
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
Returns a single order by id |
240
|
|
|
|
|
|
|
|
241
|
0
|
|
|
|
|
|
=over |
242
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
=item * Parameter: $order_id - id |
244
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
=item * Return: L<Webservice::OVH::Me::Order> |
246
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
=item * Synopsis: my $order = $ovh->me->order(1234567); |
248
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
=back |
250
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
=cut |
252
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
my ( $self, $order_id ) = @_; |
255
|
|
|
|
|
|
|
|
256
|
|
|
|
|
|
|
my $api = $self->{_api_wrapper}; |
257
|
|
|
|
|
|
|
my $order = $self->{_orders}{$order_id} = $self->{_orders}{$order_id} || Webservice::OVH::Me::Order->_new( wrapper => $api, id => $order_id, module => $self->{_module} ); |
258
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
return $order; |
260
|
|
|
|
|
|
|
} |
261
|
|
|
|
|
|
|
|
262
|
0
|
|
|
0
|
1
|
|
=head2 bill |
263
|
|
|
|
|
|
|
|
264
|
0
|
|
|
|
|
|
Returns a single bill by id |
265
|
0
|
|
0
|
|
|
|
|
266
|
|
|
|
|
|
|
=over |
267
|
0
|
|
|
|
|
|
|
268
|
|
|
|
|
|
|
=item * Parameter: $bill_id - id |
269
|
|
|
|
|
|
|
|
270
|
|
|
|
|
|
|
=item * Return: L<Webservice::OVH::Me::Bill> |
271
|
|
|
|
|
|
|
|
272
|
|
|
|
|
|
|
=item * Synopsis: my $order = $ovh->me->bill(1234567); |
273
|
|
|
|
|
|
|
|
274
|
|
|
|
|
|
|
=back |
275
|
|
|
|
|
|
|
|
276
|
|
|
|
|
|
|
=cut |
277
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
|
279
|
|
|
|
|
|
|
my ( $self, $bill_id ) = @_; |
280
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
my $api = $self->{_api_wrapper}; |
282
|
|
|
|
|
|
|
my $bill = $self->{_bills}{$bill_id} = $self->{_bills}{$bill_id} || Webservice::OVH::Me::Bill->_new( wrapper => $api, id => $bill_id, module => $self->{_module} ); |
283
|
|
|
|
|
|
|
|
284
|
|
|
|
|
|
|
return $bill; |
285
|
|
|
|
|
|
|
} |
286
|
|
|
|
|
|
|
|
287
|
|
|
|
|
|
|
=head2 bills |
288
|
0
|
|
|
0
|
1
|
|
|
289
|
|
|
|
|
|
|
Produces an array of all available bills. |
290
|
0
|
|
|
|
|
|
Bills can be optionally filtered by date. |
291
|
0
|
|
0
|
|
|
|
|
292
|
|
|
|
|
|
|
=over |
293
|
0
|
|
|
|
|
|
|
294
|
|
|
|
|
|
|
=item * Parameter: $date_from - optional filter DateTime, $date_to - optional filter DateTime |
295
|
|
|
|
|
|
|
|
296
|
|
|
|
|
|
|
=item * Return: ARRAY |
297
|
|
|
|
|
|
|
|
298
|
|
|
|
|
|
|
=item * Synopsis: my $bills = $ovh->me->bills(DateTime->new(), DateTime->new()); |
299
|
|
|
|
|
|
|
|
300
|
|
|
|
|
|
|
=back |
301
|
|
|
|
|
|
|
|
302
|
|
|
|
|
|
|
=cut |
303
|
|
|
|
|
|
|
|
304
|
|
|
|
|
|
|
|
305
|
|
|
|
|
|
|
my ( $self, $date_from, $date_to ) = @_; |
306
|
|
|
|
|
|
|
|
307
|
|
|
|
|
|
|
my $str_date_from = $date_from ? $date_from->strftime("%Y-%m-%d") : ""; |
308
|
|
|
|
|
|
|
my $str_date_to = $date_to ? $date_to->strftime("%Y-%m-%d") : ""; |
309
|
|
|
|
|
|
|
my $filter = Webservice::OVH::Helper->construct_filter( "date.from" => $str_date_from, "date.to" => $str_date_to ); |
310
|
|
|
|
|
|
|
|
311
|
|
|
|
|
|
|
my $api = $self->{_api_wrapper}; |
312
|
|
|
|
|
|
|
my $response = $api->rawCall( method => 'get', path => sprintf( "/me/bill%s", $filter ), noSignature => 0 ); |
313
|
|
|
|
|
|
|
croak $response->error if $response->error; |
314
|
|
|
|
|
|
|
|
315
|
0
|
|
|
0
|
1
|
|
my $bill_ids = $response->content; |
316
|
|
|
|
|
|
|
my $bills = []; |
317
|
0
|
0
|
|
|
|
|
|
318
|
0
|
0
|
|
|
|
|
foreach my $bill_id (@$bill_ids) { |
319
|
0
|
|
|
|
|
|
|
320
|
|
|
|
|
|
|
my $bill = $self->{_bills}{$bill_id} = $self->{_bills}{$bill_id} || Webservice::OVH::Me::Bill->_new( wrapper => $api, id => $bill_id, module => $self->{_module} ); |
321
|
0
|
|
|
|
|
|
push @$bills, $bill; |
322
|
0
|
|
|
|
|
|
} |
323
|
0
|
0
|
|
|
|
|
|
324
|
|
|
|
|
|
|
return $bills; |
325
|
0
|
|
|
|
|
|
} |
326
|
0
|
|
|
|
|
|
|
327
|
|
|
|
|
|
|
1; |