line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
=encoding utf-8 |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
=head1 NAME |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
Webservice::OVH::Order |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 SYNOPSIS |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
use Webservice::OVH; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
my $ovh = Webservice::OVH->new_from_json("credentials.json"); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
my $carts = $ovh->order->carts; |
15
|
|
|
|
|
|
|
my $cart_id = $carts->[0]->id; |
16
|
|
|
|
|
|
|
my $cart = $ovh->order->cart($cart_id); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
my $new_cart = $ovh->order->new_cart(ovh_subsidiary => 'DE'); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
$ovh->order->hosting->web; |
21
|
|
|
|
|
|
|
$ovh->order->email->domain; |
22
|
|
|
|
|
|
|
$ovh->order->domain->zone; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head1 DESCRIPTION |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
Module that support carts and domain/transfer orders at the moment |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head1 METHODS |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=cut |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
use strict; |
33
|
36
|
|
|
36
|
|
227
|
use warnings; |
|
36
|
|
|
|
|
70
|
|
|
36
|
|
|
|
|
975
|
|
34
|
36
|
|
|
36
|
|
159
|
use Carp qw{ carp croak }; |
|
36
|
|
|
|
|
76
|
|
|
36
|
|
|
|
|
1027
|
|
35
|
36
|
|
|
36
|
|
245
|
|
|
36
|
|
|
|
|
89
|
|
|
36
|
|
|
|
|
2388
|
|
36
|
|
|
|
|
|
|
our $VERSION = 0.47; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
# sub modules |
39
|
|
|
|
|
|
|
use Webservice::OVH::Order::Cart; |
40
|
36
|
|
|
36
|
|
15360
|
use Webservice::OVH::Order::Hosting; |
|
36
|
|
|
|
|
95
|
|
|
36
|
|
|
|
|
1210
|
|
41
|
36
|
|
|
36
|
|
14576
|
use Webservice::OVH::Order::Email; |
|
36
|
|
|
|
|
92
|
|
|
36
|
|
|
|
|
986
|
|
42
|
36
|
|
|
36
|
|
12420
|
use Webservice::OVH::Order::Domain; |
|
36
|
|
|
|
|
94
|
|
|
36
|
|
|
|
|
989
|
|
43
|
36
|
|
|
36
|
|
12893
|
|
|
36
|
|
|
|
|
87
|
|
|
36
|
|
|
|
|
15256
|
|
44
|
|
|
|
|
|
|
=head2 _new |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
Internal Method to create the order object. |
47
|
|
|
|
|
|
|
This method is not ment to be called external. |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=over |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=item * Parameter: $api_wrapper - ovh api wrapper object, $module - root object |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=item * Return: L<Webservice::OVH::Order> |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=item * Synopsis: Webservice::OVH::Order->_new($ovh_api_wrapper, $self); |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=back |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=cut |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
my ( $class, %params ) = @_; |
63
|
|
|
|
|
|
|
|
64
|
0
|
|
|
0
|
|
|
die "Missing module" unless $params{module}; |
65
|
|
|
|
|
|
|
die "Missing wrapper" unless $params{wrapper}; |
66
|
0
|
0
|
|
|
|
|
|
67
|
0
|
0
|
|
|
|
|
my $module = $params{module}; |
68
|
|
|
|
|
|
|
my $api_wrapper = $params{wrapper}; |
69
|
0
|
|
|
|
|
|
|
70
|
0
|
|
|
|
|
|
my $hosting = Webservice::OVH::Order::Hosting->_new( wrapper => $api_wrapper, module => $module ); |
71
|
|
|
|
|
|
|
my $email = Webservice::OVH::Order::Email->_new( wrapper => $api_wrapper, module => $module ); |
72
|
0
|
|
|
|
|
|
my $domain = Webservice::OVH::Order::Domain->_new( wrapper => $api_wrapper, module => $module ); |
73
|
0
|
|
|
|
|
|
|
74
|
0
|
|
|
|
|
|
my $self = bless { _module => $module, _api_wrapper => $api_wrapper, _cards => {}, _hosting => $hosting, _email => $email, _domain => $domain }, $class; |
75
|
|
|
|
|
|
|
|
76
|
0
|
|
|
|
|
|
return $self; |
77
|
|
|
|
|
|
|
} |
78
|
0
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head2 new_cart |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
Creates a new 'shopping' cart. |
82
|
|
|
|
|
|
|
Items can be put into it, to create orders. |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=over |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=item * Parameter: %params - key => value (required) ovh_subsidiary => 'DE' (optional) expire => DateTime-str description => "shopping" |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=item * Return: L<Webservice::OVH::Order::Cart> |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=item * Synopsis: my $cart = $ovh->order->new_cart(ovh_subsidiary => 'DE'); |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=back |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=cut |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
my ( $self, %params ) = @_; |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
my $api = $self->{_api_wrapper}; |
100
|
0
|
|
|
0
|
1
|
|
my $cart = Webservice::OVH::Order::Cart->_new( wrapper => $api, module => $self->{_module}, %params ); |
101
|
|
|
|
|
|
|
return $cart; |
102
|
0
|
|
|
|
|
|
} |
103
|
0
|
|
|
|
|
|
|
104
|
0
|
|
|
|
|
|
=head2 carts |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
Produces an array of all available carts that are connected to the used account. |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=over |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=item * Return: ARRAY |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=item * Synopsis: my $carts = $ovh->order->carts(); |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=back |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=cut |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
my ($self) = @_; |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
my $api = $self->{_api_wrapper}; |
122
|
|
|
|
|
|
|
my $response = $api->rawCall( method => 'get', path => "/order/cart", noSignature => 0 ); |
123
|
0
|
|
|
0
|
1
|
|
croak $response->error if $response->error; |
124
|
|
|
|
|
|
|
|
125
|
0
|
|
|
|
|
|
my $card_ids = $response->content; |
126
|
0
|
|
|
|
|
|
my $cards = []; |
127
|
0
|
0
|
|
|
|
|
|
128
|
|
|
|
|
|
|
foreach my $card_id (@$card_ids) { |
129
|
0
|
|
|
|
|
|
|
130
|
0
|
|
|
|
|
|
my $card = $self->{_cards}{$card_id} = $self->{_cards}{$card_id} || Webservice::OVH::Order::Cart->_new_existing( wrapper => $api, id => $card_id, module => $self->{_module} ); |
131
|
|
|
|
|
|
|
push @$cards, $card; |
132
|
0
|
|
|
|
|
|
} |
133
|
|
|
|
|
|
|
|
134
|
0
|
|
0
|
|
|
|
return $cards; |
135
|
0
|
|
|
|
|
|
} |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=head2 cart |
138
|
0
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
Returns a single cart by id |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=over |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=item * Parameter: cart_id - cart id |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=item * Return: L<Webservice::OVH::Order::Cart> |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=item * Synopsis: my $cart = $ovh->order->cart(1234567); |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=back |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=cut |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
my ( $self, $card_id ) = @_; |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
my $api = $self->{_api_wrapper}; |
157
|
|
|
|
|
|
|
my $from_array_card = $self->{_cards}{$card_id} if $self->{_cards}{$card_id} && $self->{_cards}{$card_id}->is_valid; |
158
|
|
|
|
|
|
|
my $card = $self->{_cards}{$card_id} = $from_array_card || Webservice::OVH::Order::Cart->_new_existing( wrapper => $api, id => $card_id, module => $self->{_module} ); |
159
|
0
|
|
|
0
|
1
|
|
return $card; |
160
|
|
|
|
|
|
|
} |
161
|
0
|
|
|
|
|
|
|
162
|
0
|
0
|
0
|
|
|
|
=head2 hosting |
163
|
0
|
|
0
|
|
|
|
|
164
|
0
|
|
|
|
|
|
Gives Acces to the /order/hosting/ methods of the ovh api |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
=over |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=item * Return: L<Webservice::OVH::Order::Hosting> |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=item * Synopsis: $ovh->order->hosting |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=back |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
=cut |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
my ($self) = @_; |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
return $self->{_hosting}; |
180
|
|
|
|
|
|
|
} |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
=head2 email |
183
|
0
|
|
|
0
|
1
|
|
|
184
|
|
|
|
|
|
|
Gives Acces to the /order/email/ methods of the ovh api |
185
|
0
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
=over |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
=item * Return: L<Webservice::OVH::Order::Email> |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
=item * Synopsis: $ovh->order->email |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
=back |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
=cut |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
my ($self) = @_; |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
return $self->{_email}; |
200
|
|
|
|
|
|
|
} |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
=head2 domain |
203
|
|
|
|
|
|
|
|
204
|
0
|
|
|
0
|
1
|
|
Gives Acces to the /order/domain/ methods of the ovh api |
205
|
|
|
|
|
|
|
|
206
|
0
|
|
|
|
|
|
=over |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
=item * Return: L<Webservice::OVH::Order::Domain> |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
=item * Synopsis: $ovh->order->domain |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
=back |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
=cut |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
my ($self) = @_; |
218
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
return $self->{_domain}; |
220
|
|
|
|
|
|
|
} |
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
1; |