I am using the gem amazon_product for searching the books in Amazon. The search is perfectly fine but it gets me only a list of first 10 books. I want to get all the search results and paginate them. How can I do this?
开发者_如何学GoMy code looks like this,
req = AmazonProduct["us"]
req.configure do |c|
c.key = "KEY"
c.secret = "SECRET_KEY"
c.tag = "TAG"
end
resp = req.search("Books", :power => params[:book][:search_term], :sort => "reviewrank")
@books = resp.to_hash["Items"]["Item"]
From their API page at - http://webservices.amazon.com/AWSECommerceService/AWSECommerceService.wsdl
They have "RelatedItemPage" and "ItemPage"
You should give this a try
resp = req.search("Books", :power => params[:book][:search_term], :itemPage => 20)
Hope this helps.
精彩评论