1###################################################################### 2package Net::Amazon::Result::Seller::Listing; 3###################################################################### 4use warnings; 5use strict; 6use base qw(Net::Amazon); 7 8use Data::Dumper; 9use Log::Log4perl qw(:easy); 10 11# Tracking the different functions between AWS3 and AWS4. 12# ExchangeConditionType -> ExchangeCondition 13# ExchangeSellerRating -> ??? 14# ExchangeQuantityAllocated -> ExchangeQuantity 15# ExchangeSellerCountry -> ??? 16# ExchangeSellerState -> ??? 17# ExchangeFeaturedCategory -> ??? 18# ExchangeAvailability -> ??? 19# ExchangeOfferingType -> ??? 20# ??? -> ExchangeSubCondition 21# ExchangeDescription -> ??? 22 23 24our %DEFAULT_ATTRIBUTES_XPATH = ( 25 ExchangeStartDate => [qw(StartDate)], 26 ExchangeEndDate => [qw(EndDate)], 27 ExchangeAsin => [qw(ASIN)], 28 ExchangeTitle => [qw(Title)], 29 ListingId => [qw(ListingId)], 30 ExchangeId => [qw(ExchangeId)], 31 ExchangeQuantityAllocated => [qw(Quantity)], 32 ExchangeQuantity => [qw(Quantity)], 33 ExchangeCondition => [qw(Condition)], 34 ExchangeConditionType=> [qw(SubCondition)], 35 ExchangeSubCondition => [qw(SubCondition)], 36 ExchangeStatus => [qw(Status)], 37 ExchangePrice => [qw(Price FormattedPrice)], 38 ExchangeCurrencyCode => [qw(Price CurrencyCode)], 39 ExchangeAmount => [qw(Price Amount)], 40 ExchangeSellerId => [qw(Seller SellerId)], 41 ExchangeSellerNickname => [qw(Seller Nickname)], 42); 43 44__PACKAGE__->make_accessor($_) for keys %DEFAULT_ATTRIBUTES_XPATH; 45 46################################################## 47sub new { 48################################################## 49 my($class, %options) = @_; 50 51 if(!$options{xmlref}) { 52 die "Mandatory param xmlref missing"; 53 } 54 55 my $self = { 56 %options, 57 }; 58 59 bless $self, $class; 60 61 DEBUG "Calling Listing with xmlref=", Dumper($options{xmlref}); 62 63 for my $attr (keys %DEFAULT_ATTRIBUTES_XPATH) { 64 my $value = __PACKAGE__->walk_hash_ref($options{xmlref}, $DEFAULT_ATTRIBUTES_XPATH{$attr}); 65 $self->$attr($value); 66 } 67 68 return $self; 69} 70 71################################################## 72sub as_string { 73################################################## 74 my($self) = @_; 75 76 my $result = 77 $self->ExchangeTitle() . 78 " (" . 79 $self->ExchangeAsin() . 80 "): " . 81 $self->ExchangePrice() . 82 ""; 83 84 return $result; 85} 86 871; 88 89__END__ 90 91=head1 NAME 92 93Net::Amazon::Result::Seller::Listing - Class for a single Listing of a Seller 94 95=head1 SYNOPSIS 96 97 for($seller_search_resp->result()->seller()->listings()) { 98 print $_->as_string(), "\n"; 99 } 100 101=head1 DESCRIPTION 102 103C<Net::Amazon::Result::Seller::Listing> is a container for a single listing 104owned by a third-party seller, who is represented by a 105C<Net::Amazon::Result::Seller> object. 106 107An object of this class is also returned by an C<Exchange> request, using 108C<Net::Amazon::Response::Exchange>'s C<result> method. 109 110=head2 METHODS 111 112=over 4 113 114=item ExchangeStartDate() 115 116=item ExchangeConditionType() 117 118=item ExchangeCondition() 119 120=item ExchangeSubCondition() 121 122=item ExchangeAsin() 123 124=item ExchangeSellerId() 125 126=item ExchangeEndDate() 127 128=item ExchangePrice() 129 130=item ExchangeAmount() 131 132=item ExchangeCurrencyCode() 133 134=item ExchangeStatus() 135 136=item ExchangeId() 137 138=item ExchangeTitle() 139 140=item ExchangeQuantityAllocated() 141 142=item ExchangeQuantity() 143 144=item ExchangeSellerNickname() 145 146=item ListingId() 147 148=back 149 150=head1 AUTHOR 151 152Mike Schilli, E<lt>m@perlmeister.comE<gt> 153 154=head1 COPYRIGHT AND LICENSE 155 156Copyright 2004 by Mike Schilli E<lt>m@perlmeister.comE<gt> 157 158This library is free software; you can redistribute it and/or modify 159it under the same terms as Perl itself. 160 161=cut 162