line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Object::eBay::Item; |
2
|
|
|
|
|
|
|
our $VERSION = '0.5.1'; |
3
|
|
|
|
|
|
|
|
4
|
3
|
|
|
3
|
|
50990
|
use Class::Std; { |
|
3
|
|
|
|
|
27949
|
|
|
3
|
|
|
|
|
22
|
|
5
|
3
|
|
|
3
|
|
291
|
use warnings; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
100
|
|
6
|
3
|
|
|
3
|
|
15
|
use strict; |
|
3
|
|
|
|
|
11
|
|
|
3
|
|
|
|
|
102
|
|
7
|
3
|
|
|
3
|
|
17
|
use base qw( Object::eBay ); |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
1629
|
|
8
|
3
|
|
|
3
|
|
19
|
use overload '""' => 'item_id', fallback => 1; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
31
|
|
9
|
3
|
|
|
3
|
|
2181
|
use Object::eBay::Boolean; |
|
3
|
|
|
|
|
9
|
|
|
3
|
|
|
|
|
98
|
|
10
|
3
|
|
|
3
|
|
1173
|
use Object::eBay::Attributes; |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
84
|
|
11
|
3
|
|
|
3
|
|
1295
|
use Object::eBay::Condition; |
|
3
|
|
|
|
|
9
|
|
|
3
|
|
|
|
|
1872
|
|
12
|
|
|
|
|
|
|
|
13
|
0
|
|
|
0
|
1
|
0
|
sub api_call { "GetItem" }; |
14
|
0
|
|
|
0
|
1
|
0
|
sub response_field { "Item" }; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
__PACKAGE__->simple_attributes(qw{ |
17
|
|
|
|
|
|
|
Country |
18
|
|
|
|
|
|
|
Title |
19
|
|
|
|
|
|
|
Quantity |
20
|
|
|
|
|
|
|
}); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
__PACKAGE__->complex_attributes({ |
23
|
|
|
|
|
|
|
AttributeSetArray => { |
24
|
|
|
|
|
|
|
class => 'Attributes', |
25
|
|
|
|
|
|
|
DetailLevel => 'ItemReturnAttributes', |
26
|
|
|
|
|
|
|
}, |
27
|
|
|
|
|
|
|
BuyItNowPrice => { |
28
|
|
|
|
|
|
|
class => 'Currency', |
29
|
|
|
|
|
|
|
}, |
30
|
|
|
|
|
|
|
Seller => { |
31
|
|
|
|
|
|
|
class => 'User', |
32
|
|
|
|
|
|
|
}, |
33
|
|
|
|
|
|
|
SellingStatus => { |
34
|
|
|
|
|
|
|
class => 'SellingStatus', |
35
|
|
|
|
|
|
|
}, |
36
|
|
|
|
|
|
|
ListingDetails => { |
37
|
|
|
|
|
|
|
class => 'ListingDetails', |
38
|
|
|
|
|
|
|
}, |
39
|
|
|
|
|
|
|
Description => { |
40
|
|
|
|
|
|
|
DetailLevel => 'ItemReturnDescription', |
41
|
|
|
|
|
|
|
}, |
42
|
|
|
|
|
|
|
WatchCount => { |
43
|
|
|
|
|
|
|
IncludeWatchCount => 'true', |
44
|
|
|
|
|
|
|
}, |
45
|
|
|
|
|
|
|
}); |
46
|
|
|
|
|
|
|
|
47
|
2
|
|
|
2
|
1
|
1105
|
sub item_id { shift->api_inputs->{ItemID} } |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub attributes { |
50
|
0
|
|
|
0
|
1
|
|
my $attributes = eval { shift->attribute_set_array }; |
|
0
|
|
|
|
|
|
|
51
|
0
|
0
|
|
|
|
|
return $attributes if $attributes; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
# some auctions have no attributes at all |
54
|
|
|
|
|
|
|
# in this case, we want an empty Attributes object |
55
|
0
|
|
|
|
|
|
return Object::eBay::Attributes->new({ object_details => 'none' }); |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub is_ended { |
59
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
60
|
0
|
|
|
|
|
|
my $status = $self->selling_status->listing_status; |
61
|
0
|
0
|
|
|
|
|
die "eBay item #$self has no listing status\n" if not defined $status; |
62
|
|
|
|
|
|
|
|
63
|
0
|
|
|
|
|
|
my $true = Object::eBay::Boolean->true; |
64
|
0
|
|
|
|
|
|
my $false = Object::eBay::Boolean->false; |
65
|
|
|
|
|
|
|
|
66
|
0
|
0
|
|
|
|
|
return $false if $status eq 'Active'; |
67
|
0
|
0
|
|
|
|
|
return $true if $status eq 'Ended'; |
68
|
0
|
0
|
|
|
|
|
return $true if $status eq 'Completed'; |
69
|
0
|
|
|
|
|
|
die "eBay item #$self has an unknown listing status: $status\n"; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
######################################################################### |
73
|
|
|
|
|
|
|
# Usage : my @images = $item->pictures() |
74
|
|
|
|
|
|
|
# Purpose : Combine various sources of pictures into one method |
75
|
|
|
|
|
|
|
# Returns : a list of image URLs |
76
|
|
|
|
|
|
|
# Arguments : none |
77
|
|
|
|
|
|
|
# Throws : no exceptions |
78
|
|
|
|
|
|
|
# Comments : none |
79
|
|
|
|
|
|
|
# See Also : n/a |
80
|
|
|
|
|
|
|
sub pictures { |
81
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
# TODO this should probably be implemented in terms of other |
84
|
|
|
|
|
|
|
# methods instead of manually searching the details hash |
85
|
|
|
|
|
|
|
# but I haven't implement those other methods yet. |
86
|
|
|
|
|
|
|
|
87
|
0
|
|
|
|
|
|
my @places = ( |
88
|
|
|
|
|
|
|
[qw( PictureDetails GalleryURL )], |
89
|
|
|
|
|
|
|
[qw( PictureDetails PictureURL )], |
90
|
|
|
|
|
|
|
[qw( SiteHostedPicture PictureURL )], # deprecated |
91
|
|
|
|
|
|
|
[qw( VendorHostedPicture SelfHostedURL )], # deprecated |
92
|
|
|
|
|
|
|
); |
93
|
|
|
|
|
|
|
|
94
|
0
|
|
|
|
|
|
my $details = $self->get_details(); |
95
|
0
|
0
|
|
|
|
|
return if !$details; |
96
|
|
|
|
|
|
|
|
97
|
0
|
|
|
|
|
|
my @image_urls; |
98
|
|
|
|
|
|
|
PLACE: |
99
|
0
|
|
|
|
|
|
for my $place (@places) { |
100
|
0
|
|
|
|
|
|
my ($major, $minor) = @$place; |
101
|
0
|
0
|
|
|
|
|
next PLACE if !exists $details->{$major}; |
102
|
0
|
0
|
|
|
|
|
next PLACE if !exists $details->{$major}{$minor}; |
103
|
|
|
|
|
|
|
|
104
|
0
|
|
|
|
|
|
my $url = $details->{$major}{$minor}; |
105
|
0
|
0
|
|
|
|
|
next PLACE if !defined $url; |
106
|
0
|
0
|
|
|
|
|
push @image_urls, ( ref $url eq 'ARRAY' ? @$url : $url ); |
107
|
|
|
|
|
|
|
} |
108
|
|
|
|
|
|
|
|
109
|
0
|
|
|
|
|
|
return @image_urls; |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
# can't be done with complex_attributes because ConditionID and |
113
|
|
|
|
|
|
|
# ConditionDisplayName are at the same depth in the Item response |
114
|
|
|
|
|
|
|
sub condition { |
115
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
116
|
0
|
|
|
|
|
|
my $id = $self->get_details->{ConditionID}; |
117
|
0
|
|
|
|
|
|
my $name = $self->get_details->{ConditionDisplayName}; |
118
|
0
|
0
|
0
|
|
|
|
return if !$id && !$name; |
119
|
0
|
|
|
|
|
|
return Object::eBay::Condition->new({ |
120
|
|
|
|
|
|
|
id => $id, |
121
|
|
|
|
|
|
|
name => $name, |
122
|
|
|
|
|
|
|
}); |
123
|
|
|
|
|
|
|
} |
124
|
|
|
|
|
|
|
} |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
1; |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
__END__ |