Net::Amazon::Result::Seller::Listing - Class for a single Listing of a Seller


Net-Amazon documentation Contained in the Net-Amazon distribution.

Index


Code Index:

NAME

Top

Net::Amazon::Result::Seller::Listing - Class for a single Listing of a Seller

SYNOPSIS

Top

  for($seller_search_resp->result()->seller()->listings()) {
      print $_->as_string(), "\n";
  }

DESCRIPTION

Top

Net::Amazon::Result::Seller::Listing is a container for a single listing owned by a third-party seller, who is represented by a Net::Amazon::Result::Seller object.

An object of this class is also returned by an Exchange request, using Net::Amazon::Response::Exchange's result method.

METHODS

ExchangeStartDate()
ExchangeConditionType()
ExchangeCondition()
ExchangeSubCondition()
ExchangeAsin()
ExchangeSellerId()
ExchangeEndDate()
ExchangePrice()
ExchangeAmount()
ExchangeCurrencyCode()
ExchangeStatus()
ExchangeId()
ExchangeTitle()
ExchangeQuantityAllocated()
ExchangeQuantity()
ExchangeSellerNickname()
ListingId()

AUTHOR

Top

Mike Schilli, <m@perlmeister.com>

COPYRIGHT AND LICENSE

Top


Net-Amazon documentation Contained in the Net-Amazon distribution.

######################################################################
package Net::Amazon::Result::Seller::Listing;
######################################################################
use warnings;
use strict;
use base qw(Net::Amazon);

use Data::Dumper;
use Log::Log4perl qw(:easy);

# Tracking the different functions between AWS3 and AWS4.
# ExchangeConditionType -> ExchangeCondition
# ExchangeSellerRating -> ???
# ExchangeQuantityAllocated  -> ExchangeQuantity
# ExchangeSellerCountry -> ???
# ExchangeSellerState -> ???
# ExchangeFeaturedCategory -> ???
# ExchangeAvailability -> ???
# ExchangeOfferingType -> ??? 
# ??? -> ExchangeSubCondition 
# ExchangeDescription -> ???


our %DEFAULT_ATTRIBUTES_XPATH = (
    ExchangeStartDate    => [qw(StartDate)],
    ExchangeEndDate      => [qw(EndDate)],
    ExchangeAsin         => [qw(ASIN)],
    ExchangeTitle        => [qw(Title)],
    ListingId            => [qw(ListingId)],
    ExchangeId           => [qw(ExchangeId)],
    ExchangeQuantityAllocated => [qw(Quantity)],
    ExchangeQuantity     => [qw(Quantity)],
    ExchangeCondition    => [qw(Condition)],
    ExchangeConditionType=> [qw(SubCondition)],
    ExchangeSubCondition => [qw(SubCondition)],
    ExchangeStatus       => [qw(Status)],
    ExchangePrice        => [qw(Price FormattedPrice)],
    ExchangeCurrencyCode => [qw(Price CurrencyCode)],
    ExchangeAmount       => [qw(Price Amount)],
    ExchangeSellerId     => [qw(Seller SellerId)],
    ExchangeSellerNickname => [qw(Seller Nickname)],
);

__PACKAGE__->make_accessor($_) for keys %DEFAULT_ATTRIBUTES_XPATH;

##################################################
sub new {
##################################################
    my($class, %options) = @_;

    if(!$options{xmlref}) {
        die "Mandatory param xmlref missing";
    }

    my $self = { 
        %options, 
               };

    bless $self, $class;

    DEBUG "Calling Listing with xmlref=", Dumper($options{xmlref});

    for my $attr (keys %DEFAULT_ATTRIBUTES_XPATH) {
        my $value = __PACKAGE__->walk_hash_ref($options{xmlref}, $DEFAULT_ATTRIBUTES_XPATH{$attr});
        $self->$attr($value);
    }

    return $self;
}

##################################################
sub as_string {
##################################################
    my($self) = @_;

    my $result = 
                 $self->ExchangeTitle() .
                 " (" .
                 $self->ExchangeAsin() . 
                 "): " .
                 $self->ExchangePrice() .
                 "";

    return $result;
}

1;

__END__