From bcbf441e09fb502cf64924ff2530fa144bdf52c5 Mon Sep 17 00:00:00 2001 From: Andreas Brachold Date: Mon, 13 Aug 2007 18:41:27 +0000 Subject: * Move files to trunk --- lib/Net/Amazon/Request/ASIN.pm | 139 +++++++++++++++++++ lib/Net/Amazon/Request/Artist.pm | 86 ++++++++++++ lib/Net/Amazon/Request/Blended.pm | 80 +++++++++++ lib/Net/Amazon/Request/BrowseNode.pm | 137 ++++++++++++++++++ lib/Net/Amazon/Request/Exchange.pm | 91 ++++++++++++ lib/Net/Amazon/Request/Keyword.pm | 90 ++++++++++++ lib/Net/Amazon/Request/Manufacturer.pm | 78 +++++++++++ lib/Net/Amazon/Request/Power.pm | 95 +++++++++++++ lib/Net/Amazon/Request/Seller.pm | 84 +++++++++++ lib/Net/Amazon/Request/Similar.pm | 95 +++++++++++++ lib/Net/Amazon/Request/Sort.pm | 246 +++++++++++++++++++++++++++++++++ lib/Net/Amazon/Request/TextStream.pm | 76 ++++++++++ lib/Net/Amazon/Request/UPC.pm | 94 +++++++++++++ lib/Net/Amazon/Request/Wishlist.pm | 89 ++++++++++++ 14 files changed, 1480 insertions(+) create mode 100644 lib/Net/Amazon/Request/ASIN.pm create mode 100644 lib/Net/Amazon/Request/Artist.pm create mode 100644 lib/Net/Amazon/Request/Blended.pm create mode 100644 lib/Net/Amazon/Request/BrowseNode.pm create mode 100644 lib/Net/Amazon/Request/Exchange.pm create mode 100644 lib/Net/Amazon/Request/Keyword.pm create mode 100644 lib/Net/Amazon/Request/Manufacturer.pm create mode 100644 lib/Net/Amazon/Request/Power.pm create mode 100644 lib/Net/Amazon/Request/Seller.pm create mode 100644 lib/Net/Amazon/Request/Similar.pm create mode 100644 lib/Net/Amazon/Request/Sort.pm create mode 100644 lib/Net/Amazon/Request/TextStream.pm create mode 100644 lib/Net/Amazon/Request/UPC.pm create mode 100644 lib/Net/Amazon/Request/Wishlist.pm (limited to 'lib/Net/Amazon/Request') diff --git a/lib/Net/Amazon/Request/ASIN.pm b/lib/Net/Amazon/Request/ASIN.pm new file mode 100644 index 0000000..4d8f752 --- /dev/null +++ b/lib/Net/Amazon/Request/ASIN.pm @@ -0,0 +1,139 @@ +###################################################################### +package Net::Amazon::Request::ASIN; +###################################################################### +use warnings; +use strict; +use base qw(Net::Amazon::Request); + +# These values are defined in the AWS SDK +# (http://amazon.com/webservices) under +# "Product and Catalog Data" / "ASIN and ISBN Searches" +use constant MAX_ASINS_PER_TYPE => { + heavy => 10, + lite => 30, +}; + +################################################## +sub new { +################################################## + my($class, %options) = @_; + + $class->_assert_options_defined(\%options, 'asin'); + + $class->_convert_option(\%options, + 'asin', + 'AsinSearch', + \&_process_asin_option); + + my $self = $class->SUPER::new(%options); + + bless $self, $class; # reconsecrate +} + +## +## PRIVATE FUNCTIONS +## + +# _process_asin_option( OPTIONS, KEY ) +# +# Takes a reference to a hash of OPTIONS and checks the value keyed by +# KEY to make sure it looks legitimate. If the value associated with +# KEY is an array, we check to make sure that we're not asking for +# too many asins at once. +# +# Returns true if all goes well. If any problems are encountered, +# die() will be called. +# +sub _process_asin_option { + my ($options, $key) = @_; + + # If the asins are supplied in the form of an array, we have to + # make sure that the caller isn't trying to ask for too many at a + # time. If we don't make this test, those excessive asins will be + # silently ignored by the AWS servers...resulting in potentially + # confusing results for the user. + if ( ref $options->{$key} eq 'ARRAY' ) { + my $type = $options->{'type'} || __PACKAGE__->SUPER::DEFAULT_TYPE; + my $max_asins = MAX_ASINS_PER_TYPE->{$type}; + + # Dying is the right thing to do here because this is + # indicative of a programming error. + die "Only $max_asins may be requested at a time using type '$type'" + if ( @{$options->{$key}} > $max_asins ); + + $options->{$key} = join ',', @{$options->{$key}}; + } elsif ( ref $options->{$key} ) { + die "The 'asin' parameter must either be a scalar or an array"; + } + + return 1; +} + +1; + +__END__ + +=head1 NAME + +Net::Amazon::Request::ASIN - Class for submitting ASIN requests + +=head1 SYNOPSIS + + use Net::Amazon; + use Net::Amazon::Request::ASIN; + + my $ua = Net::Amazon->new( + token => 'YOUR_AMZN_TOKEN' + ); + + my $req = Net::Amazon::Request::ASIN->new( + asin => '0201360683' + ); + + # Response is of type Net::Amazon::Response::ASIN + my $resp = $ua->request($req); + +=head1 DESCRIPTION + +C is a class used to submit ASIN requests +to the Amazon web service. + +The ASIN of the item to look is specified in the C parameter. + +Upon success, the responses' C method will return one +single C object. + +=head2 METHODS + +=over 4 + +=item new( asin => $asin ) + +Constructs a new C object, used to query +the Amazon web service for an item with the specified ASIN number. + +C<$asin> can also be a reference to an array of ASINs, like in + + $ua->search(asin => ["0201360683", "0596005083"]) + +in which case a search for multiple ASINs is performed, returning a list of +results. + +=back + +Check L for common request parameters not listed here. + +=head1 SEE ALSO + +=head1 AUTHOR + +Mike Schilli, Em@perlmeister.comE + +=head1 COPYRIGHT AND LICENSE + +Copyright 2003 by Mike Schilli Em@perlmeister.comE + +This library is free software; you can redistribute it and/or modify +it under the same terms as Perl itself. + +=cut diff --git a/lib/Net/Amazon/Request/Artist.pm b/lib/Net/Amazon/Request/Artist.pm new file mode 100644 index 0000000..4c111f8 --- /dev/null +++ b/lib/Net/Amazon/Request/Artist.pm @@ -0,0 +1,86 @@ +###################################################################### +package Net::Amazon::Request::Artist; +###################################################################### +use warnings; +use strict; +use base qw(Net::Amazon::Request); + +################################################## +sub new { +################################################## + my($class, %options) = @_; + + if(exists $options{artist}) { + $options{ArtistSearch} = $options{artist}; + delete $options{artist}; + $options{mode} = "music"; + } else { + die "Mandatory parameter 'artist' not defined"; + } + + my $self = $class->SUPER::new(%options); + + bless $self, $class; # reconsecrate +} + +1; + +__END__ + +=head1 NAME + +Net::Amazon::Request::Artist - Class for submitting Artist requests + +=head1 SYNOPSIS + + use Net::Amazon; + use Net::Amazon::Request::Artist; + + my $ua = Net::Amazon->new( + token => 'YOUR_AMZN_TOKEN' + ); + + my $req = Net::Amazon::Request::Artist->new( + artist => 'Zwan' + ); + + # Response is of type Net::Amazon::Response::Artist + my $resp = $ua->request($req); + +=head1 DESCRIPTION + +C is a class used to submit Artist search +requests to the Amazon web service. + +The artist to search for is specified in the C parameter. + +Upon success, the responses' C method will return a list of +C objects. + +Check L for common request parameters not listed here. + +=head2 METHODS + +=over 4 + +=item new( artist => $artist ) + +Constructs a new C object, used to query +the Amazon web service for items of a given artist. + +=back + +=head1 SEE ALSO + +=head1 AUTHOR + +Mike Schilli, Em@perlmeister.comE + +=head1 COPYRIGHT AND LICENSE + +Copyright 2003 by Mike Schilli Em@perlmeister.comE + +This library is free software; you can redistribute it and/or modify +it under the same terms as Perl itself. + +=cut diff --git a/lib/Net/Amazon/Request/Blended.pm b/lib/Net/Amazon/Request/Blended.pm new file mode 100644 index 0000000..1000eec --- /dev/null +++ b/lib/Net/Amazon/Request/Blended.pm @@ -0,0 +1,80 @@ +###################################################################### +package Net::Amazon::Request::Blended; +###################################################################### +use warnings; +use strict; +use base qw(Net::Amazon::Request); + +################################################## +sub new { +################################################## + my($class, %options) = @_; + + $class->_assert_options_defined(\%options, 'blended'); + + $class->_convert_option(\%options, + 'blended', + 'BlendedSearch'); + + my $self = $class->SUPER::new(%options); + + bless $self, $class; # reconsecrate +} + +1; + +__END__ + +=head1 NAME + +Net::Amazon::Request::Blended - request class for 'Blended Search' + +=head1 SYNOPSIS + + use Net::Amazon; + use Net::Amazon::Request::Blended; + + my $ua = Net::Amazon->new( + token => 'YOUR_AMZN_TOKEN' + ); + + my $req = Net::Amazon::Request::Blended->new( + blended => 'perl' + ); + + # Response is of type Net::Amazon::Response::Blended + my $resp = $ua->request($req); + +=head1 DESCRIPTION + +C is a class used to request +I from the Amazon web service. + +The C parameter specifies the keyword search string +for the blended query. C is not applicable to blended +searches which returns books, music, etc all at once. + +Upon success, the response's C method will return a list +of C objects. + +=head2 METHODS + +=over 4 + +=item new(keyword => $search_string) + +Constructs a new C object. + +See the "Amazon Web Services 2.1 API and Integration Guide" for details. + +=back + +Check L for common request parameters not listed here. + +=head1 SEE ALSO + +=head1 AUTHORS + +Robert Graff, Ergraff@workingdemo.comE + +=cut diff --git a/lib/Net/Amazon/Request/BrowseNode.pm b/lib/Net/Amazon/Request/BrowseNode.pm new file mode 100644 index 0000000..2f8d92f --- /dev/null +++ b/lib/Net/Amazon/Request/BrowseNode.pm @@ -0,0 +1,137 @@ +###################################################################### +package Net::Amazon::Request::BrowseNode; +###################################################################### +use warnings; +use strict; +use base qw(Net::Amazon::Request); + +################################################## +sub new { +################################################## + my($class, %options) = @_; + + $class->_assert_options_defined(\%options, + qw(browsenode mode)); + + $class->_convert_option(\%options, + 'browsenode', + 'BrowseNodeSearch', + \&_assert_node_is_numeric); + + my $self = $class->SUPER::new(%options); + + bless $self, $class; # reconsecrate +} + +## +## 'PRIVATE' FUNCTIONS +## + +# _assert_node_is_numeric( OPTIONS, KEY ) +# +# Takes a reference to a hash of OPTIONS and makes sure +# that the browse node id keyed by KEY is numeric. +# +# Returns if all is well, dies otherwise. +# +sub _assert_node_is_numeric { + my ($options, $key) = @_; + + die "Browse Node ID must be numeric." + if ( $options->{$key} =~ /\D/ ); +} + + +1; + +__END__ + +=head1 NAME + +Net::Amazon::Request::BrowseNode - request class for browse node search + +=head1 SYNOPSIS + + use Net::Amazon; + use Net::Amazon::Request::BrowseNode; + + my $ua = Net::Amazon->new( + token => 'YOUR_AMZN_TOKEN' + ); + + my $req = Net::Amazon::Request::BrowseNode->new( + browsenode => 30, + mode => 'books' + ); + + # Response is of type Net::Amazon::Response::BrowseNode + my $resp = $ua->request($req); + +=head1 DESCRIPTION + +C is a class used to submit node search +requests to the Amazon web service. + +The node to search for is specified in the C parameter. The +browse node ID is a number that corresponds to a general subject area +of Amazon.com. + +To find browse node IDs, the best way is to visit the "browse" area +of the various product lines at Amazon.com. When you find a subject area +that you would like to generate XML for, look at the web page URL. The +browse ID should appear after the string "/tg/browse/-/". Here are some +examples of URLs that contain browse IDs: + +=over 8 + +http://www.amazon.com/exec/obidos/tg/browse/-/30 +(In this example, the browse ID = 30) + +http://www.amazon.com/exec/obidos/tg/browse/-/467970 +(In this example, the browse ID = 467970) + +http://www.amazon.com/exec/obidos/tg/browse/-/602314 +(In this example, the browse ID = 60231 + +=back + +Please be aware that some nodes cannot be used with a +BrowseNodeSearch. (The vast majority of them can, but you +may run across a few that simply will not work). It is also +important to point out that from time to time, some browse +nodes are deprecated or are changed without notice. + +The catalog to search in is specified in the C parameter, +typical values are C, C, C or C. + +An optional C parameter may be added to filter the results by that keyword. + +Upon success, the responses' C method will return a list of +C objects. + +=head2 METHODS + +=over 4 + +=item new( browsenode => $nodeID, mode => $mode [, keywords => $keywords] ) + +Constructs a new C object, used to query +the Amazon web service for items in a particular category (node) in the +mode (catalog) specified. + +=back + +Check L for common request parameters not listed here. + +=head1 AUTHOR + +Net::Amazon framework by Mike Schilli, Em@perlmeister.comE + +BrowseNode.pm by Jackie Hamilton, Ekira@cgi101.comE + +=head1 LICENSE + +This library is free software; you can redistribute it and/or modify +it under the same terms as Perl itself. + +=cut diff --git a/lib/Net/Amazon/Request/Exchange.pm b/lib/Net/Amazon/Request/Exchange.pm new file mode 100644 index 0000000..df75549 --- /dev/null +++ b/lib/Net/Amazon/Request/Exchange.pm @@ -0,0 +1,91 @@ +###################################################################### +package Net::Amazon::Request::Exchange; +###################################################################### +use warnings; +use strict; +use base qw(Net::Amazon::Request); + +################################################## +sub new { +################################################## + my($class, %options) = @_; + + if(exists $options{exchange}) { + $options{ExchangeSearch} = $options{exchange}; + delete $options{exchange}; + $options{type} = "lite"; + $options{mode} = ""; + } else { + die "Mandatory parameter 'exchange' not defined"; + } + +# if(!exists $options{exchange}) { +# die "Mandatory parameter 'exchange' not defined"; +# } + + my $self = $class->SUPER::new(%options); + + bless $self, $class; # reconsecrate +} + +1; + +__END__ + +=head1 NAME + +Net::Amazon::Request::Exchange - Class for submitting Exchange requests + +=head1 SYNOPSIS + + use Net::Amazon; + use Net::Amazon::Request::Exchange; + + my $ua = Net::Amazon->new( + token => 'YOUR_AMZN_TOKEN' + ); + + my $req = Net::Amazon::Request::Exchange->new( + exchange => 'Y04Y3424291Y2398445' + ); + + # Response is of type Net::Amazon::Response::Seller + my $resp = $ua->request($req); + +=head1 DESCRIPTION + +C is a class used to submit Exchange search +requests to the Amazon web service. Exchange requests send an item's +exchange ID and retrieve a description of the item, offered by a third +party seller on Amazon. + +Upon success, the responses' C method will return a single +C object. + +Check L for common request parameters not listed here. + +=head2 METHODS + +=over 4 + +=item new( exchange => $exchange_id ) + +Constructs a new C object, used to query +the Amazon web service with the given seller id. + +=back + +=head1 SEE ALSO + +=head1 AUTHOR + +Mike Schilli, Em@perlmeister.comE + +=head1 COPYRIGHT AND LICENSE + +Copyright 2005 by Mike Schilli Em@perlmeister.comE + +This library is free software; you can redistribute it and/or modify +it under the same terms as Perl itself. + +=cut diff --git a/lib/Net/Amazon/Request/Keyword.pm b/lib/Net/Amazon/Request/Keyword.pm new file mode 100644 index 0000000..0b15d1d --- /dev/null +++ b/lib/Net/Amazon/Request/Keyword.pm @@ -0,0 +1,90 @@ +###################################################################### +package Net::Amazon::Request::Keyword; +###################################################################### +use warnings; +use strict; +use base qw(Net::Amazon::Request); + +################################################## +sub new { +################################################## + my($class, %options) = @_; + + $class->_assert_options_defined(\%options, + qw(keyword mode)); + + $class->_convert_option(\%options, + 'keyword', + 'KeywordSearch'); + + my $self = $class->SUPER::new(%options); + + bless $self, $class; # reconsecrate +} + +1; + +__END__ + +=head1 NAME + +Net::Amazon::Request::Keyword - request class for keyword search + +=head1 SYNOPSIS + + use Net::Amazon; + use Net::Amazon::Request::Keyword; + + my $ua = Net::Amazon->new( + token => 'YOUR_AMZN_TOKEN' + ); + + my $req = Net::Amazon::Request::Keyword->new( + keyword => 'Zwan', + mode => 'books' + ); + + # Response is of type Net::Amazon::Response::Keyword + my $resp = $ua->request($req); + +=head1 DESCRIPTION + +C is a class used to submit keyword search +requests to the Amazon web service. + +The keyword to search for is specified in the C parameter. + +The catalog to search in is specified in the C parameter, +typical values are C, C, C or C. + +Upon success, the responses' C method will return a list of +C objects. + +=head2 METHODS + +=over 4 + +=item new( keyword => $keyword, mode => $mode ) + +Constructs a new C object, used to query +the Amazon web service for items matching a given keyword in the +mode (catalog) specified. + +=back + +Check L for common request parameters not listed here. + +=head1 SEE ALSO + +=head1 AUTHOR + +Mike Schilli, Em@perlmeister.comE + +=head1 COPYRIGHT AND LICENSE + +Copyright 2003 by Mike Schilli Em@perlmeister.comE + +This library is free software; you can redistribute it and/or modify +it under the same terms as Perl itself. + +=cut diff --git a/lib/Net/Amazon/Request/Manufacturer.pm b/lib/Net/Amazon/Request/Manufacturer.pm new file mode 100644 index 0000000..0e8adb8 --- /dev/null +++ b/lib/Net/Amazon/Request/Manufacturer.pm @@ -0,0 +1,78 @@ +###################################### +package Net::Amazon::Request::Manufacturer; +###################################### +use warnings; +use strict; +use base qw(Net::Amazon::Request); + +###################################### +sub new { +###################################### + my($class, %options) = @_; + + $class->_assert_options_defined(\%options, + 'manufacturer'); + + $class->_convert_option(\%options, + 'manufacturer', + 'ManufacturerSearch'); + + my $self = $class->SUPER::new(%options); + + bless $self, $class; # reconsecrate +} +1; + +__END__ + +=head1 NAME + +Net::Amazon::Request::Manufacturer - Class for submitting Manufacturer requests + +=head1 SYNOPSIS + + use Net::Amazon; + use Net::Amazon::Request::Manufacturer; + + my $ua = Net::Amazon->new( + token => 'YOUR_AMZN_TOKEN' + ); + + my $req = Net::Amazon::Request::Manufacturer->new( + manufacturer => 'Disney' + ); + + # Response is of type Net::Amazon::Response::Manufacturer + my $resp = $ua->request($req); + +=head1 DESCRIPTION + +C is a class used to submit +searches for items made by a given manufacturer. + +The manufacturer to search for is specified in the C parameter. + +Upon success, the responses' C method will return one +or more C objects. + +=head2 METHODS + +=over 4 + +=item new( manufacturer => $manufacturer ) + +Constructs a new C object, used to query +the Amazon web service for an item with the specified manufacturer name. + +=back + +Check L for common request parameters not listed here. + +=head1 SEE ALSO + +=head1 AUTHORS + +Bill Fitzpatrick +Mike Schilli, Em@perlmeister.comE + +=cut diff --git a/lib/Net/Amazon/Request/Power.pm b/lib/Net/Amazon/Request/Power.pm new file mode 100644 index 0000000..fdfd74e --- /dev/null +++ b/lib/Net/Amazon/Request/Power.pm @@ -0,0 +1,95 @@ +###################################################################### +package Net::Amazon::Request::Power; +###################################################################### +use warnings; +use strict; +use base qw(Net::Amazon::Request); + +################################################## +sub new { +################################################## + my($class, %options) = @_; + + $class->_assert_options_defined(\%options, + qw(power mode)); + + $class->_convert_option(\%options, + 'power', + 'PowerSearch'); + + my $self = $class->SUPER::new(%options); + + bless $self, $class; # reconsecrate +} + +1; + +__END__ + +=head1 NAME + +Net::Amazon::Request::Power - request class for 'Power Search' + +=head1 SYNOPSIS + + use Net::Amazon; + use Net::Amazon::Request::Power; + + my $ua = Net::Amazon->new( + token => 'YOUR_AMZN_TOKEN' + ); + + my $req = Net::Amazon::Request::Power->new( + power => 'subject: perl and author: schwartz', + mode => 'books', + ); + + # Response is of type Net::Amazon::Response::Power + my $resp = $ua->request($req); + +=head1 DESCRIPTION + +C is a class used to request +so-called I from the Amazon web service. + +The C parameter specifies the power search string, C +defines which properties to look for. + +Upon success, the response's C method will return a list +of C objects. + +=head2 METHODS + +=over 4 + +=item new(power => $search_string, mode => $property) + +Constructs a new C object. C<$property> +is typically C<"books">. Examples for C<$search_string> are: + + author: schwartz + + author: schwartz and pubdate: after 10-2002 + + subject: perl and (objects or object-oriented) + + keywords: "high tech*" and not fiction and pubdate: during 1999 + + power "author: randal schwartz and publisher: Addison Wesley" + + author: randal schwartz and title: object books + +See the "Amazon Web Services 2.1 API and Integration Guide" for details. + +=back + +Check L for common request parameters not listed here. + +=head1 SEE ALSO + +=head1 AUTHORS + +Martin Streicher, Emartin.streicher@apress.comE +Mike Schilli, Em@perlmeister.comE + +=cut diff --git a/lib/Net/Amazon/Request/Seller.pm b/lib/Net/Amazon/Request/Seller.pm new file mode 100644 index 0000000..54e1930 --- /dev/null +++ b/lib/Net/Amazon/Request/Seller.pm @@ -0,0 +1,84 @@ +###################################################################### +package Net::Amazon::Request::Seller; +###################################################################### +use base qw(Net::Amazon::Request); + +################################################## +sub new { +################################################## + my($class, %options) = @_; + + if(exists $options{seller}) { + $options{SellerSearch} = $options{seller}; + delete $options{seller}; + } else { + die "Mandatory parameter 'seller' not defined"; + } + + my $self = $class->SUPER::new(%options); + + bless $self, $class; # reconsecrate +} + +1; + +__END__ + +=head1 NAME + +Net::Amazon::Request::Seller - Class for submitting Seller requests + +=head1 SYNOPSIS + + use Net::Amazon; + use Net::Amazon::Request::Seller; + + my $ua = Net::Amazon->new( + token => 'YOUR_AMZN_TOKEN' + ); + + my $req = Net::Amazon::Request::Seller->new( + seller => 'A2GXAGU54VOP7' + ); + + # Response is of type Net::Amazon::Response::Seller + my $resp = $ua->request($req); + +=head1 DESCRIPTION + +C is a class used to submit Seller search +requests to the Amazon web service. + +The seller to search for is specified in the C parameter, which +contains the seller's ID (not the seller's nickname!). + +Upon success, the responses' C method will return a single +C object. + +Check L for common request parameters not listed here. + +=head2 METHODS + +=over 4 + +=item new( seller => $seller_id ) + +Constructs a new C object, used to query +the Amazon web service with the given seller id. + +=back + +=head1 SEE ALSO + +=head1 AUTHOR + +Mike Schilli, Em@perlmeister.comE + +=head1 COPYRIGHT AND LICENSE + +Copyright 2004 by Mike Schilli Em@perlmeister.comE + +This library is free software; you can redistribute it and/or modify +it under the same terms as Perl itself. + +=cut diff --git a/lib/Net/Amazon/Request/Similar.pm b/lib/Net/Amazon/Request/Similar.pm new file mode 100644 index 0000000..c5b5a53 --- /dev/null +++ b/lib/Net/Amazon/Request/Similar.pm @@ -0,0 +1,95 @@ +###################################################################### +package Net::Amazon::Request::Similar; +###################################################################### +use warnings; +use strict; +use base qw(Net::Amazon::Request); + +our $AMZN_XML_URL = "http://xml.amazon.com/onca/xml3"; + +################################################## +sub amzn_xml_url { +################################################## + return $AMZN_XML_URL; +} + +################################################## +sub new { +################################################## + my($class, %options) = @_; + + # For backwards compatibility + $class->_convert_option(\%options, 'asin', 'similar'); + + $class->_assert_options_defined(\%options, 'similar'); + + $class->_convert_option(\%options, + 'similar', + 'SimilaritySearch'); + + my $self = $class->SUPER::new(%options); + + bless $self, $class; # reconsecrate +} + +1; + +__END__ + +=head1 NAME + +Net::Amazon::Request::Similar - request class for 'Similarities Search' + +=head1 SYNOPSIS + + use Net::Amazon; + use Net::Amazon::Request::Similar; + + my $ua = Net::Amazon->new( + token => 'YOUR_AMZN_TOKEN' + ); + + my $req = Net::Amazon::Request::Similar->new( + similar => 'B00005B6TL', + ); + + # Response is of type Net::Amazon::Response::Similar + my $resp = $ua->request($req); + +=head1 DESCRIPTION + +C is a class used to request +so-called I from the Amazon web service. + +The C parameter specifies the ASIN of the item which you want +to get similar items for. + +Upon success, the response's C method will return a list +of C objects. + +=head2 METHODS + +=over 4 + +=item new(similar => $asin) + +Constructs a new C object. + +=back + +Check L for common request parameters not listed here. + +=head1 SEE ALSO + +=head1 AUTHOR + +Mike Schilli, Em@perlmeister.comE + +=head1 COPYRIGHT AND LICENSE + +Copyright 2003 by Mike Schilli Em@perlmeister.comE + +This library is free software; you can redistribute it and/or modify +it under the same terms as Perl itself. + +=cut diff --git a/lib/Net/Amazon/Request/Sort.pm b/lib/Net/Amazon/Request/Sort.pm new file mode 100644 index 0000000..059845d --- /dev/null +++ b/lib/Net/Amazon/Request/Sort.pm @@ -0,0 +1,246 @@ +=pod + +=head1 SORT TYPES + +Search results can be sorted in various ways, depending on the type of +product returned by the search. If a sort parameter isn't specified in +the request, the results will be ordered as if the +salesrank value is +specified. + +=head2 Sorting Books Results + + +---------------------------------------------------+ + | Sort Type | Value | + |-------------------------+-------------------------+ + | Featured Items | +pmrank | + |-------------------------+-------------------------+ + | Bestselling | +salesrank | + |-------------------------+-------------------------+ + | Average Customer Review | +reviewrank | + |-------------------------+-------------------------+ + | Price (Low to High) | +pricerank | + |-------------------------+-------------------------+ + | Price (High to Low) | +inverse-pricerank | + |-------------------------+-------------------------+ + | Publication Date | +daterank | + |-------------------------+-------------------------+ + | Alphabetical (A-Z) | +titlerank | + |-------------------------+-------------------------+ + | Alphabetical (Z-A) | -titlerank | + +---------------------------------------------------+ + +=head2 Sorting Software Results + + +---------------------------------------------------+ + | Sort Type | Value | + |-------------------------+-------------------------+ + | Featured items | +pmrank | + |-------------------------+-------------------------+ + | Bestselling | +salesrank | + |-------------------------+-------------------------+ + | Alphabetical | +titlerank | + |-------------------------+-------------------------+ + | Price (High to Low) | +price | + |-------------------------+-------------------------+ + | Price (Low to High) | -price | + +---------------------------------------------------+ + +=head2 Sorting Outdoor Living Results + + +---------------------------------------------------+ + | Sort Type | Value | + |-------------------------+-------------------------+ + | Featured Items | +psrank | + |-------------------------+-------------------------+ + | Bestselling | +salesrank | + |-------------------------+-------------------------+ + | Alphabetical (A-Z) | +titlerank | + |-------------------------+-------------------------+ + | Alphabetical (Z-A) | -titlerank | + |-------------------------+-------------------------+ + | Manufacturer (A-Z) | +manufactrank | + |-------------------------+-------------------------+ + | Manufacturer (Z-A) | -manufactrank | + |-------------------------+-------------------------+ + | Price (Low to High) | +price | + |-------------------------+-------------------------+ + | Price (High to Low) | -price | + +---------------------------------------------------+ + +=head2 Sorting Tools Results + + +---------------------------------------------------+ + | Sort Type | Value | + |-------------------------+-------------------------+ + | Featured Items | +psrank | + |-------------------------+-------------------------+ + | Bestselling | +salesrank | + |-------------------------+-------------------------+ + | Alphabetical (A-Z) | +titlerank | + |-------------------------+-------------------------+ + | Alphabetical (Z-A) | -titlerank | + |-------------------------+-------------------------+ + | Manufacturer (A-Z) | +manufactrank | + |-------------------------+-------------------------+ + | Manufacturer (Z-A) | -manufactrank | + |-------------------------+-------------------------+ + | Price (Low to High) | +price | + |-------------------------+-------------------------+ + | Price (High to Low) | -price | + +---------------------------------------------------+ + +=head2 Sorting Camera and Photo Results + + +---------------------------------------------------+ + | Sort Type | Value | + |-------------------------+-------------------------+ + | Featured Items | +pmrank | + |-------------------------+-------------------------+ + | Bestselling | +salesrank | + |-------------------------+-------------------------+ + | Alphabetical (A-Z) | +titlerank | + |-------------------------+-------------------------+ + | Alphabetical (Z-A) | -titlerank | + +---------------------------------------------------+ + +=head2 Sorting Computers Results + + +---------------------------------------------------+ + | Sort Type | Value | + |-------------------------+-------------------------+ + | Featured Items | +psrank | + |-------------------------+-------------------------+ + | Bestselling | +salesrank | + |-------------------------+-------------------------+ + | Alphabetical (A-Z) | +titlerank | + |-------------------------+-------------------------+ + | Alphabetical (Z-A) | -titlerank | + +---------------------------------------------------+ + +=head2 Sorting Video Games Results + + +---------------------------------------------------+ + | Sort Type | Value | + |-------------------------+-------------------------+ + | Featured Items | +pmrank | + |-------------------------+-------------------------+ + | Bestselling | +salesrank | + |-------------------------+-------------------------+ + | Alphabetical | +titlerank | + |-------------------------+-------------------------+ + | Price (Low to High) | +price | + |-------------------------+-------------------------+ + | Price (High to Low) | -price | + +---------------------------------------------------+ + +=head2 Sorting Music Results + + +---------------------------------------------------+ + | Sort Type | Value | + |-------------------------+-------------------------+ + | Featured Items | +psrank | + |-------------------------+-------------------------+ + | Bestselling | +salesrank | + |-------------------------+-------------------------+ + | Artist Name | +artistrank | + |-------------------------+-------------------------+ + | Original Release Date | +orig-rel-date | + |-------------------------+-------------------------+ + | Alphabetical | +titlerank | + +---------------------------------------------------+ + +=head2 Sorting Office Products Results + + +---------------------------------------------------+ + | Sort Type | Value | + |-------------------------+-------------------------+ + | Featured Items | +pmrank | + |-------------------------+-------------------------+ + | Bestselling | +salesrank | + |-------------------------+-------------------------+ + | Alphabetical (A-Z) | +titlerank | + |-------------------------+-------------------------+ + | Alphabetical (Z-A) | -titlerank | + |-------------------------+-------------------------+ + | Price (Low to High) | +price | + |-------------------------+-------------------------+ + | Price (High to Low) | -price | + |-------------------------+-------------------------+ + | Review | +reviewrank | + +---------------------------------------------------+ + +=head2 Sorting Video Results + + +---------------------------------------------------+ + | Sort Type | Value | + |-------------------------+-------------------------+ + | Featured Items | +psrank | + |-------------------------+-------------------------+ + | Bestselling | +salesrank | + |-------------------------+-------------------------+ + | Alphabetical | +titlerank | + +---------------------------------------------------+ + +=head2 Sorting Electronics Results + + +---------------------------------------------------+ + | Type | Value | + |-------------------------+-------------------------+ + | Featured Items | +pmrank | + |-------------------------+-------------------------+ + | Bestselling | +salesrank | + |-------------------------+-------------------------+ + | Alphabetical | +titlerank | + |-------------------------+-------------------------+ + | Review | +reviewrank | + +---------------------------------------------------+ + +=head2 Sorting DVDs Results + + +---------------------------------------------------+ + | Type | Value | + |-------------------------+-------------------------+ + | Bestselling | +salesrank | + |-------------------------+-------------------------+ + | Alphabetical | +titlerank | + +---------------------------------------------------+ + +=head2 Sorting Kitchen Results + + +---------------------------------------------------+ + | Type | Value | + |-------------------------+-------------------------+ + | Featured Items | +pmrank | + |-------------------------+-------------------------+ + | Bestselling | +salesrank | + |-------------------------+-------------------------+ + | Alphabetical (A-Z) | +titlerank | + |-------------------------+-------------------------+ + | Alphabetical (Z-A) | -titlerank | + |-------------------------+-------------------------+ + | Manufacturer (A-Z) | +manufactrank | + |-------------------------+-------------------------+ + | Manufacturer (Z-A) | -manufactrank | + |-------------------------+-------------------------+ + | Price (Low to High) | +price | + |-------------------------+-------------------------+ + | Price (High to Low) | -price | + +---------------------------------------------------+ + +=head2 Sorting Toys Results + + +---------------------------------------------------+ + | Type | Value | + |-------------------------+-------------------------+ + | Featured Items | +pmrank | + |-------------------------+-------------------------+ + | Bestselling | +salesrank | + |-------------------------+-------------------------+ + | Price (Low to High) | +pricerank | + |-------------------------+-------------------------+ + | Price (High to Low) | +inverse-pricerank | + |-------------------------+-------------------------+ + | Alphabetical (A-Z) | +titlerank | + +---------------------------------------------------+ + +=cut diff --git a/lib/Net/Amazon/Request/TextStream.pm b/lib/Net/Amazon/Request/TextStream.pm new file mode 100644 index 0000000..62a0717 --- /dev/null +++ b/lib/Net/Amazon/Request/TextStream.pm @@ -0,0 +1,76 @@ +###################################################################### +package Net::Amazon::Request::TextStream; +###################################################################### +use warnings; +use strict; +use base qw(Net::Amazon::Request); + +################################################## +sub new { +################################################## + my($class, %options) = @_; + + $class->_assert_options_defined(\%options, + 'textstream'); + + $class->_convert_option(\%options, + 'textstream', + 'TextStreamSearch'); + + my $self = $class->SUPER::new(%options); + + bless $self, $class; # reconsecrate +} + +1; + +__END__ + +=head1 NAME + +Net::Amazon::Request::TextStream - request class for text stream search + +=head1 SYNOPSIS + + use Net::Amazon; + use Net::Amazon::Request::TextStream; + + my $ua = Net::Amazon->new( + token => 'YOUR_AMZN_TOKEN' + ); + + my $req = Net::Amazon::Request::TextStream->new( + textstream => 'Here is some text that mentions the Rolling Stones.', + ); + + # Response is of type Net::Amazon::Response::TextStream + my $resp = $ua->request($req); + +=head1 DESCRIPTION + +C is a class used to perform a search on +a block of text. Amazon extracts keywords from the given block of text, +but note that conjunctions and helper words, such as "and", "or", "the", +etc. are not excluded, so strip them out yourself if need be. + +TextStream searching is only available for the US service. + +Upon success, the response's C method will return a list +of C objects. + +=head2 METHODS + +=over 4 + +=item new(textstream => $text) + +Constructs a new C object, used to query +the Amazon web service with a block of text. + +=back + +Check L for common request parameters not listed here. + +=head1 SEE ALSO + +=cut diff --git a/lib/Net/Amazon/Request/UPC.pm b/lib/Net/Amazon/Request/UPC.pm new file mode 100644 index 0000000..ae77645 --- /dev/null +++ b/lib/Net/Amazon/Request/UPC.pm @@ -0,0 +1,94 @@ +###################################################################### +package Net::Amazon::Request::UPC; +###################################################################### +use warnings; +use strict; +use base qw(Net::Amazon::Request); + +################################################## +sub new { +################################################## + my($class, %options) = @_; + + $class->_assert_options_defined(\%options, 'upc'); + + $class->_convert_option(\%options, + 'upc', + 'UpcSearch'); + + my $self = $class->SUPER::new(%options); + + bless $self, $class; # reconsecrate +} + +1; + +__END__ + +=head1 NAME + +Net::Amazon::Request::UPC - request class for UPC search + +=head1 SYNOPSIS + + use Net::Amazon; + use Net::Amazon::Request::UPC; + + my $ua = Net::Amazon->new( + token => 'YOUR_AMZN_TOKEN' + ); + + my $req = Net::Amazon::Request::UPC->new( + upc => '724381198421', + mode => 'music', + + ); + + # Response is of type Net::Amazon::Response::UPC + my $resp = $ua->request($req); + +=head1 DESCRIPTION + +C is a class used to submit UPC (product barcode) +search requests to the Amazon web service. + +The UPC number to search for is specified in the C parameter. +It currently works with the following values of the C parameter: +C, +C, +C, +C, +C