line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Webservice::OVH::Order::Cart::Item; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=encoding utf-8 |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 NAME |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
Webservice::OVH::Order::Cart::Item |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 SYNOPSIS |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
use Webservice::OVH; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
my $ovh = Webservice::OVH->new_from_json("credentials.json"); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
my $cart = $ovh->order->new_cart(ovh_subsidiary => 'DE'); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
my $items = $cart->items; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 DESCRIPTION |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
Provides info for a specific cart item. |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 METHODS |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=cut |
26
|
|
|
|
|
|
|
|
27
|
36
|
|
|
36
|
|
259
|
use strict; |
|
36
|
|
|
|
|
82
|
|
|
36
|
|
|
|
|
1063
|
|
28
|
36
|
|
|
36
|
|
181
|
use warnings; |
|
36
|
|
|
|
|
80
|
|
|
36
|
|
|
|
|
1325
|
|
29
|
36
|
|
|
36
|
|
191
|
use Carp qw{ carp croak }; |
|
36
|
|
|
|
|
86
|
|
|
36
|
|
|
|
|
48670
|
|
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
our $VERSION = 0.46; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head2 _new |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
Internal Method to create the Item object. |
36
|
|
|
|
|
|
|
This method is not ment to be called directly. |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=over |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=item * Parameter: $api_wrapper - ovh api wrapper object, $module - root object, $item_id - api id |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=item * Return: L<Webservice::OVH::Order::Cart> |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=item * Synopsis: Webservice::OVH::Order::Cart->_new($ovh_api_wrapper, $cart_id, $module); |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=back |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=cut |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub _new { |
51
|
|
|
|
|
|
|
|
52
|
0
|
|
|
0
|
|
|
my ( $class, %params ) = @_; |
53
|
|
|
|
|
|
|
|
54
|
0
|
0
|
|
|
|
|
die "Missing module" unless $params{module}; |
55
|
0
|
0
|
|
|
|
|
die "Missing wrapper" unless $params{wrapper}; |
56
|
0
|
0
|
|
|
|
|
die "Missing id" unless $params{id}; |
57
|
0
|
0
|
|
|
|
|
die "Missing cart" unless $params{cart}; |
58
|
|
|
|
|
|
|
|
59
|
0
|
|
|
|
|
|
my $module = $params{module}; |
60
|
0
|
|
|
|
|
|
my $api_wrapper = $params{wrapper}; |
61
|
0
|
|
|
|
|
|
my $item_id = $params{id}; |
62
|
0
|
|
|
|
|
|
my $cart = $params{cart}; |
63
|
|
|
|
|
|
|
|
64
|
0
|
|
|
|
|
|
my $cart_id = $cart->id; |
65
|
0
|
|
|
|
|
|
my $response = $api_wrapper->rawCall( method => 'get', path => "/order/cart/$cart_id/item/$item_id", noSignature => 0 ); |
66
|
0
|
0
|
|
|
|
|
croak $response->error if $response->error; |
67
|
|
|
|
|
|
|
|
68
|
0
|
|
|
|
|
|
my $porperties = $response->content; |
69
|
|
|
|
|
|
|
|
70
|
0
|
|
|
|
|
|
my $self = bless { _module => $module, _valid => 1, _api_wrapper => $api_wrapper, _id => $item_id, _properties => $porperties, _cart => $cart }, $class; |
71
|
|
|
|
|
|
|
|
72
|
0
|
|
|
|
|
|
return $self; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head2 is_valid |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
When the item is deleted on the api side, this method returns 0. |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=over |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=item * Return: VALUE |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=item * Synopsis: print "Valid" if $item->is_valid; |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=back |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=cut |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
sub is_valid { |
90
|
|
|
|
|
|
|
|
91
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
92
|
|
|
|
|
|
|
|
93
|
0
|
|
|
|
|
|
return $self->{_valid}; |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head2 _is_valid |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
Intern method to check validity. |
99
|
|
|
|
|
|
|
Difference is that this method carps an error. |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=over |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=item * Return: VALUE |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=item * Synopsis: $item->_is_valid; |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=back |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=cut |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
sub _is_valid { |
112
|
|
|
|
|
|
|
|
113
|
0
|
|
|
0
|
|
|
my ($self) = @_; |
114
|
|
|
|
|
|
|
|
115
|
0
|
|
|
|
|
|
my $item_id = $self->id; |
116
|
0
|
0
|
|
|
|
|
carp "Item $item_id is not valid anymore" unless $self->is_valid; |
117
|
0
|
|
|
|
|
|
return $self->is_valid; |
118
|
|
|
|
|
|
|
} |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=head2 _is_valid |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
Gets the associated cart. |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=over |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=item * Return: L<Webservice::OVH::Order::Cart> |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=item * Synopsis: my $cart = $item->cart; |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=back |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=cut |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
sub cart { |
135
|
|
|
|
|
|
|
|
136
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
137
|
|
|
|
|
|
|
|
138
|
0
|
|
|
|
|
|
return $self->{_cart}; |
139
|
|
|
|
|
|
|
} |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=head2 id |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
Returns the api id. |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=over |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=item * Return: VALUE |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=item * Synopsis: my $id = $item->id; |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=back |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=cut |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
sub id { |
156
|
|
|
|
|
|
|
|
157
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
158
|
|
|
|
|
|
|
|
159
|
0
|
|
|
|
|
|
return $self->{_id}; |
160
|
|
|
|
|
|
|
} |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
=head2 properties |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
Retrieves properties. |
165
|
|
|
|
|
|
|
This method updates the intern property variable. |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
=over |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
=item * Return: HASH |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=item * Synopsis: my $properties = $item->properties; |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
=back |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
=cut |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
sub properties { |
178
|
|
|
|
|
|
|
|
179
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
180
|
|
|
|
|
|
|
|
181
|
0
|
0
|
|
|
|
|
return unless $self->_is_valid; |
182
|
|
|
|
|
|
|
|
183
|
0
|
|
|
|
|
|
my $api = $self->{_api_wrapper}; |
184
|
0
|
|
|
|
|
|
my $cart_id = $self->{_cart}->id; |
185
|
0
|
|
|
|
|
|
my $item_id = $self->id; |
186
|
0
|
|
|
|
|
|
my $response = $api->rawCall( method => 'get', path => "/order/cart/$cart_id/item/$item_id", noSignature => 0 ); |
187
|
0
|
0
|
|
|
|
|
croak $response->error if $response->error; |
188
|
|
|
|
|
|
|
|
189
|
0
|
|
|
|
|
|
$self->{_properties} = $response->content; |
190
|
0
|
|
|
|
|
|
return $self->{_properties}; |
191
|
|
|
|
|
|
|
} |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
=head2 configuration_add |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
Setup configuration item for the product |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
=over |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
=item * Return: L<HASHREF> |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
=item * Synopsis: my $configurations = $item->configuration_add; |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
=back |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
=cut |
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
sub configuration_add { |
208
|
|
|
|
|
|
|
|
209
|
0
|
|
|
0
|
1
|
|
my ($self, $label, $value) = @_; |
210
|
|
|
|
|
|
|
|
211
|
0
|
0
|
|
|
|
|
return unless $self->_is_valid; |
212
|
|
|
|
|
|
|
|
213
|
0
|
|
|
|
|
|
my $api = $self->{_api_wrapper}; |
214
|
0
|
|
|
|
|
|
my $cart_id = $self->{_cart}->id; |
215
|
0
|
|
|
|
|
|
my $item_id = $self->id; |
216
|
|
|
|
|
|
|
|
217
|
0
|
0
|
|
|
|
|
croak "Missing label" unless $label; |
218
|
0
|
0
|
|
|
|
|
croak "Missing value" unless $value; |
219
|
|
|
|
|
|
|
|
220
|
0
|
|
|
|
|
|
my $body = {label => $label, value => $value}; |
221
|
0
|
|
|
|
|
|
my $response = $api->rawCall( method => 'post', path => "/order/cart/$cart_id/item/$item_id/configuration", body => $body, noSignature => 0 ); |
222
|
0
|
0
|
|
|
|
|
croak $response->error if $response->error; |
223
|
|
|
|
|
|
|
|
224
|
0
|
|
|
|
|
|
return $response->content; |
225
|
|
|
|
|
|
|
} |
226
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
=head2 configuration_delete |
228
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
Delete configuration item |
230
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
=over |
232
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
=item * Return: L<HASHREF> |
234
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
=item * Synopsis: my $configurations = $item->configuration_delete; |
236
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
=back |
238
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
=cut |
240
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
sub configuration_delete { |
242
|
|
|
|
|
|
|
|
243
|
0
|
|
|
0
|
1
|
|
my ($self, $configuration_id) = @_; |
244
|
|
|
|
|
|
|
|
245
|
0
|
0
|
|
|
|
|
return unless $self->_is_valid; |
246
|
|
|
|
|
|
|
|
247
|
0
|
|
|
|
|
|
my $api = $self->{_api_wrapper}; |
248
|
0
|
|
|
|
|
|
my $cart_id = $self->{_cart}->id; |
249
|
0
|
|
|
|
|
|
my $item_id = $self->id; |
250
|
|
|
|
|
|
|
|
251
|
0
|
0
|
|
|
|
|
croak "Missing configuration_id" unless $configuration_id; |
252
|
|
|
|
|
|
|
|
253
|
0
|
|
|
|
|
|
my $response = $api->rawCall( method => 'delete', path => "/order/cart/$cart_id/item/$item_id/configuration/$configuration_id", body => {}, noSignature => 0 ); |
254
|
0
|
0
|
|
|
|
|
croak $response->error if $response->error; |
255
|
|
|
|
|
|
|
|
256
|
0
|
|
|
|
|
|
return $response->content; |
257
|
|
|
|
|
|
|
} |
258
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
=head2 configurations |
260
|
|
|
|
|
|
|
|
261
|
|
|
|
|
|
|
Exposed property value. |
262
|
|
|
|
|
|
|
|
263
|
|
|
|
|
|
|
=over |
264
|
|
|
|
|
|
|
|
265
|
|
|
|
|
|
|
=item * Return: L<ARRAY> |
266
|
|
|
|
|
|
|
|
267
|
|
|
|
|
|
|
=item * Synopsis: my $configurations = $item->configurations; |
268
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
=back |
270
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
=cut |
272
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
sub configurations { |
274
|
|
|
|
|
|
|
|
275
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
276
|
|
|
|
|
|
|
|
277
|
0
|
|
|
|
|
|
return $self->{_properties}->{configurations}; |
278
|
|
|
|
|
|
|
} |
279
|
|
|
|
|
|
|
|
280
|
|
|
|
|
|
|
=head2 duration |
281
|
|
|
|
|
|
|
|
282
|
|
|
|
|
|
|
Exposed property value. |
283
|
|
|
|
|
|
|
|
284
|
|
|
|
|
|
|
=over |
285
|
|
|
|
|
|
|
|
286
|
|
|
|
|
|
|
=item * Return: VALUE |
287
|
|
|
|
|
|
|
|
288
|
|
|
|
|
|
|
=item * Synopsis: my $duration = $item->duration; |
289
|
|
|
|
|
|
|
|
290
|
|
|
|
|
|
|
=back |
291
|
|
|
|
|
|
|
|
292
|
|
|
|
|
|
|
=cut |
293
|
|
|
|
|
|
|
|
294
|
|
|
|
|
|
|
sub duration { |
295
|
|
|
|
|
|
|
|
296
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
297
|
|
|
|
|
|
|
|
298
|
0
|
|
|
|
|
|
return $self->{_properties}->{duration}; |
299
|
|
|
|
|
|
|
} |
300
|
|
|
|
|
|
|
|
301
|
|
|
|
|
|
|
=head2 offer_id |
302
|
|
|
|
|
|
|
|
303
|
|
|
|
|
|
|
Exposed property value. |
304
|
|
|
|
|
|
|
|
305
|
|
|
|
|
|
|
=over |
306
|
|
|
|
|
|
|
|
307
|
|
|
|
|
|
|
=item * Return: VALUE |
308
|
|
|
|
|
|
|
|
309
|
|
|
|
|
|
|
=item * Synopsis: my $offer_id = $item->offer_id; |
310
|
|
|
|
|
|
|
|
311
|
|
|
|
|
|
|
=back |
312
|
|
|
|
|
|
|
|
313
|
|
|
|
|
|
|
=cut |
314
|
|
|
|
|
|
|
|
315
|
|
|
|
|
|
|
sub offer_id { |
316
|
|
|
|
|
|
|
|
317
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
318
|
|
|
|
|
|
|
|
319
|
0
|
|
|
|
|
|
return $self->{_properties}->{offerId}; |
320
|
|
|
|
|
|
|
} |
321
|
|
|
|
|
|
|
|
322
|
|
|
|
|
|
|
=head2 options |
323
|
|
|
|
|
|
|
|
324
|
|
|
|
|
|
|
Exposed property value. |
325
|
|
|
|
|
|
|
|
326
|
|
|
|
|
|
|
=over |
327
|
|
|
|
|
|
|
|
328
|
|
|
|
|
|
|
=item * Return: HASH |
329
|
|
|
|
|
|
|
|
330
|
|
|
|
|
|
|
=item * Synopsis: my $options = $item->options; |
331
|
|
|
|
|
|
|
|
332
|
|
|
|
|
|
|
=back |
333
|
|
|
|
|
|
|
|
334
|
|
|
|
|
|
|
=cut |
335
|
|
|
|
|
|
|
|
336
|
|
|
|
|
|
|
sub options { |
337
|
|
|
|
|
|
|
|
338
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
339
|
|
|
|
|
|
|
|
340
|
0
|
|
|
|
|
|
return $self->{_properties}->{options}; |
341
|
|
|
|
|
|
|
} |
342
|
|
|
|
|
|
|
|
343
|
|
|
|
|
|
|
=head2 prices |
344
|
|
|
|
|
|
|
|
345
|
|
|
|
|
|
|
Exposed property value. |
346
|
|
|
|
|
|
|
|
347
|
|
|
|
|
|
|
=over |
348
|
|
|
|
|
|
|
|
349
|
|
|
|
|
|
|
=item * Return: HASH |
350
|
|
|
|
|
|
|
|
351
|
|
|
|
|
|
|
=item * Synopsis: my $prices = $item->prices; |
352
|
|
|
|
|
|
|
|
353
|
|
|
|
|
|
|
=back |
354
|
|
|
|
|
|
|
|
355
|
|
|
|
|
|
|
=cut |
356
|
|
|
|
|
|
|
|
357
|
|
|
|
|
|
|
sub prices { |
358
|
|
|
|
|
|
|
|
359
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
360
|
|
|
|
|
|
|
|
361
|
0
|
|
|
|
|
|
return $self->{_properties}->{prices}; |
362
|
|
|
|
|
|
|
} |
363
|
|
|
|
|
|
|
|
364
|
|
|
|
|
|
|
=head2 product_id |
365
|
|
|
|
|
|
|
|
366
|
|
|
|
|
|
|
Exposed property value. |
367
|
|
|
|
|
|
|
|
368
|
|
|
|
|
|
|
=over |
369
|
|
|
|
|
|
|
|
370
|
|
|
|
|
|
|
=item * Return: VALUE |
371
|
|
|
|
|
|
|
|
372
|
|
|
|
|
|
|
=item * Synopsis: my $product_id = $item->product_id; |
373
|
|
|
|
|
|
|
|
374
|
|
|
|
|
|
|
=back |
375
|
|
|
|
|
|
|
|
376
|
|
|
|
|
|
|
=cut |
377
|
|
|
|
|
|
|
|
378
|
|
|
|
|
|
|
sub product_id { |
379
|
|
|
|
|
|
|
|
380
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
381
|
|
|
|
|
|
|
|
382
|
0
|
|
|
|
|
|
return $self->{_properties}->{productId}; |
383
|
|
|
|
|
|
|
} |
384
|
|
|
|
|
|
|
|
385
|
|
|
|
|
|
|
=head2 settings |
386
|
|
|
|
|
|
|
|
387
|
|
|
|
|
|
|
Exposed property value. |
388
|
|
|
|
|
|
|
|
389
|
|
|
|
|
|
|
=over |
390
|
|
|
|
|
|
|
|
391
|
|
|
|
|
|
|
=item * Return: HASH |
392
|
|
|
|
|
|
|
|
393
|
|
|
|
|
|
|
=item * Synopsis: my $settings = $item->settings; |
394
|
|
|
|
|
|
|
|
395
|
|
|
|
|
|
|
=back |
396
|
|
|
|
|
|
|
|
397
|
|
|
|
|
|
|
=cut |
398
|
|
|
|
|
|
|
|
399
|
|
|
|
|
|
|
sub settings { |
400
|
|
|
|
|
|
|
|
401
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
402
|
|
|
|
|
|
|
|
403
|
0
|
|
|
|
|
|
return $self->{_properties}->{settings}; |
404
|
|
|
|
|
|
|
} |
405
|
|
|
|
|
|
|
|
406
|
|
|
|
|
|
|
=head2 available_configuration |
407
|
|
|
|
|
|
|
|
408
|
|
|
|
|
|
|
Exposed property value. |
409
|
|
|
|
|
|
|
|
410
|
|
|
|
|
|
|
=over |
411
|
|
|
|
|
|
|
|
412
|
|
|
|
|
|
|
=item * Return: L<ARRAY> |
413
|
|
|
|
|
|
|
|
414
|
|
|
|
|
|
|
=item * Synopsis: my $available_configuration = $item->available_configuration; |
415
|
|
|
|
|
|
|
|
416
|
|
|
|
|
|
|
=back |
417
|
|
|
|
|
|
|
|
418
|
|
|
|
|
|
|
=cut |
419
|
|
|
|
|
|
|
|
420
|
|
|
|
|
|
|
sub available_configuration { |
421
|
|
|
|
|
|
|
|
422
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
423
|
|
|
|
|
|
|
|
424
|
0
|
0
|
|
|
|
|
return unless $self->_is_valid; |
425
|
|
|
|
|
|
|
|
426
|
0
|
|
|
|
|
|
my $api = $self->{_api_wrapper}; |
427
|
0
|
|
|
|
|
|
my $cart_id = $self->{_cart}->id; |
428
|
0
|
|
|
|
|
|
my $item_id = $self->id; |
429
|
|
|
|
|
|
|
|
430
|
0
|
|
|
|
|
|
my $response = $api->rawCall( method => 'get', path => "/order/cart/$cart_id/item/$item_id/configuration", noSignature => 0 ); |
431
|
0
|
0
|
|
|
|
|
croak $response->error if $response->error; |
432
|
|
|
|
|
|
|
|
433
|
0
|
|
|
|
|
|
return $response->content; |
434
|
|
|
|
|
|
|
} |
435
|
|
|
|
|
|
|
|
436
|
|
|
|
|
|
|
=head2 delete |
437
|
|
|
|
|
|
|
|
438
|
|
|
|
|
|
|
Deletes the item and sets the object to invalid. |
439
|
|
|
|
|
|
|
|
440
|
|
|
|
|
|
|
=over |
441
|
|
|
|
|
|
|
|
442
|
|
|
|
|
|
|
=item * Synopsis: $item->delete; |
443
|
|
|
|
|
|
|
|
444
|
|
|
|
|
|
|
=back |
445
|
|
|
|
|
|
|
|
446
|
|
|
|
|
|
|
=cut |
447
|
|
|
|
|
|
|
|
448
|
|
|
|
|
|
|
sub delete { |
449
|
|
|
|
|
|
|
|
450
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
451
|
|
|
|
|
|
|
|
452
|
0
|
0
|
|
|
|
|
return unless $self->_is_valid; |
453
|
|
|
|
|
|
|
|
454
|
0
|
|
|
|
|
|
my $api = $self->{_api_wrapper}; |
455
|
0
|
|
|
|
|
|
my $cart_id = $self->{_cart}->id; |
456
|
0
|
|
|
|
|
|
my $item_id = $self->id; |
457
|
0
|
|
|
|
|
|
my $response = $api->rawCall( method => 'delete', path => "/order/cart/$cart_id/item/$item_id", noSignature => 0 ); |
458
|
0
|
0
|
|
|
|
|
croak $response->error if $response->error; |
459
|
|
|
|
|
|
|
|
460
|
0
|
|
|
|
|
|
$self->{_valid} = 0; |
461
|
|
|
|
|
|
|
} |
462
|
|
|
|
|
|
|
|
463
|
|
|
|
|
|
|
1; |