Репозиторий Sisyphus
Последнее обновление: 1 октября 2023 | Пакетов: 18631 | Посещений: 37046486
en ru br
Репозитории ALT

Группа :: Разработка/Perl
Пакет: perl-Net-Amazon

 Главная   Изменения   Спек   Патчи   Sources   Загрузить   Gear   Bugs and FR  Repocop 

Текущая версия: 0.62-alt1
Время сборки: 24 июля 2013, 18:30 ( 557.2 недели назад )
Размер архива: 227.31 Kb

Домашняя страница:   http://www.cpan.org

Лицензия: Artistic
О пакете: Framework for accessing amazon.com via REST
Описание:

"Net::Amazon" works very much like "LWP": First you define a useragent
like

 my $ua = Net::Amazon->new(
     token      => 'YOUR_AMZN_TOKEN',
     secret_key => 'YOUR_AMZN_SECRET_KEY',
     max_pages => 3,
 );

which you pass your personal amazon developer's token (can be obtained
from <http://amazon.com/soap>;) and (optionally) the maximum number of
result pages the agent is going to request from Amazon in case all
results don't fit on a single page (typically holding 20 items).  Note that
each new page requires a minimum delay of 1 second to comply with Amazon's
one-query-per-second policy.

According to the different search methods on Amazon, there's a bunch
of different request types in "Net::Amazon". The user agent's
convenience method "search()" triggers different request objects,
depending on which parameters you pass to it:

=over 4

=item "$ua->search(asin => "0201360683")"

The "asin" parameter has Net::Amazon search for an item with the
specified ASIN. If the specified value is an arrayref instead of a single
scalar, like in

   $ua->search(asin => ["0201360683", "0596005083"])

then a search for multiple ASINs is performed, returning a list of
results.

=item "$ua->search(actor => "Adam Sandler")"

The "actor" parameter has the user agent search for items created by
the specified actor. Can return many results.

=item "$ua->search(artist => "Rolling Stones")"

The "artist" parameter has the user agent search for items created by
the specified artist. Can return many results.

=item "$ua->search(author => "Robert Jordan")"

The "author" parameter has the user agent search for items created by
the specified author. Can return many results.

=item "$ua->search(browsenode=>"4025", mode=>"books" [, keywords=>"perl"])"

Returns a list of items by category ID (node). For example node "4025"
is the CGI books category.  You can add a keywords parameter to filter
the results by that keyword.

=item "$ua->search(exchange => 'Y04Y3424291Y2398445')"

Returns an item offered by a third-party seller. The item is referenced
by the so-called *exchange ID*.

=item "$ua->search(keyword => "perl xml", mode => "books")"

Search by keyword, mandatory parameters "keyword" and "mode".
Can return many results.

=item "$ua->search(wishlist => "1XL5DWOUFMFVJ")"

Search for all items in a specified wishlist.
Can return many results.

=item "$ua->search(upc => "075596278324", mode => "music")"

Music search by UPC (product barcode), mandatory parameter "upc".
"mode" has to be set to "music". Returns at most one result.

=item "$ua->search(isbn => "0439784549")"

Book search by ISBN (International Standard Book Number), mandatory parameter
"isbn".  Returns at most one result.  When searching non-US locales use the
13-digit ISBN.

=item "$ua->search(similar => "0201360683")"

Search for all items similar to the one represented by the ASIN provided.
Can return many results.

=item "$ua->search(power => "subject: perl and author: schwartz", mode => "books")"

Initiate a power search for all books matching the power query.
Can return many results. See Net::Amazon::Request::Power for details.

=item "$ua->search(manufacturer => "Disney")"

Initiate a search for all items made by a given manufacturrer.
Can return many results. See Net::Amazon::Request::Manufacturer
for details.

=item "$ua->search(musiclabel => "Arista")"

Initiate a search for all items made by a given music label. Can return many
results. See Net::Amazon::Request::MusicLabel for details.

=item "$ua->search(publisher => "o'reilly")"

Initiate a search for all items made by a given publisher. Can return many
results. See Net::Amazon::Request::Publisher for details.

=item "$ua->search(blended => "Perl")"

Initiate a search for items in all categories.

=item "$ua->search(seller => "A2GXAGU54VOP7")"

Start a search on items sold by a specific third-party seller, referenced
by its ID (not seller name).

=item "$ua->search(textstream => "Blah blah Rolling Stones blah blah")"

Find items related to keywords within a text stream.

=back

The user agent's "search" method returns a response object, which can be
checked for success or failure:

 if($resp->is_success()) {
     print $resp->as_string();
 } else {
     print "Error: ", $resp->message(), "\n";
 }

In case the request for an item search
succeeds, the response contains one or more
Amazon 'properties', as it calls the products found.
All matches can be retrieved from the Response
object using it's "properties()" method.

In case the request fails, the response contains one or more
error messages. The response object's "message()" method will
return it (or them) as a single string, while "messages()" (notice
the plural) will
return a reference to an array of message strings.

Response objects always have the methods
"is_success()",
"is_error()",
"message()",
"total_results()",
"as_string()" and
"properties()" available.

"total_results()" returns the total number of results the search
yielded.
"properties()" returns one or more "Net::Amazon::Property" objects of type
"Net::Amazon::Property" (or one of its subclasses like
"Net::Amazon::Property::Book", "Net::Amazon::Property::Music"
or Net::Amazon::Property::DVD), each
of which features accessors named after the attributes of the product found
in Amazon's database:

   for ($resp->properties) {
      print $_->Asin(), " ",
            $_->OurPrice(), "\n";
   }

In scalar context, "properties()" just returns the *first*
"Net::Amazon::Property" object found.
Commonly available accessors to "Net::Amazon::Property" objects are
"OurPrice()",
"ImageUrlLarge()",
"ImageUrlMedium()",
"ImageUrlSmall()",
"ReleaseDate()",
"Catalog()",
"Asin()",
"url()",
"Manufacturer()",
"UsedPrice()",
"ListPrice()",
"ProductName()",
"Availability()",
"SalesRank()",
"CollectiblePrice()",
"CollectibleCount()",
"NumberOfOfferings()",
"UsedCount()",
"ThirdPartyNewPrice()",
"ThirdPartyNewCount()",
"similar_asins()".
For details, check Net::Amazon::Property.

Also, the specialized classes "Net::Amazon::Property::Book" and
"Net::Amazon::Property::Music" feature convenience methods like
"authors()" (returning the list of authors of a book) or
"album()" for CDs, returning the album title.

Customer reviews:
Every property features a "review_set()" method which returns a
"Net::Amazon::Attribute::ReviewSet" object, which in turn offers
a list of "Net::Amazon::Attribute::Review" objects. Check the respective
man pages for details on what's available.

Текущий майнтейнер: Denis Smirnov

Список всех майнтейнеров, принимавших участие
в данной и/или предыдущих сборках пакета:

Список rpm-пакетов, предоставляемый данным srpm-пакетом:

  • perl-Net-Amazon
ACL:
     
    дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
    текущий майнтейнер: Michael Shigorin