ruby on rails - Unable to get the Item details from Amazon production API -
i using the gem item details. able except, item description, please suggest how can item description.please see screenshot want get. have selected description.
find configurations
gemfile
gem 'amazon_product', '~> 3.0', '>= 3.0.1'
services/amazon_service.rb
class amazonservice def initialize(params) @itempage = params[:itempage] @keyword = params[:keyword] @book_id = params[:book_id] $req = amazonproduct['us'] $req.configure |c| c.key = env['aws_access_key_id'] c.secret = env['aws_secret_key'] c.tag = env['associate_tag'] end end def itemlookup`enter code here` $req << { :operation => 'itemlookup', :search_index => 'books', :keywords => 'book', :idtype => 'isbn', :itemid => @book_id, :response_group => ['itemattributes','images'], } $req.get end end
controller
@resp = amazonservice.new({book_id: 1338099132}).itemlookup
the product description stored under editorial reviews node.
editorialreviews: editorialreview: source: product description content: '<ul><li> front opening, long sleeve, pure color, patternless, draped, scarf hem, stretch, loose style, textured, ruffled, </li><li> model 5.2ft in height.</li></ul><table border="1" cellpadding="1" cellspacing="1" width="200"><tr><td>asian size</td><td>international size</td><td>us size</td><td>bust girth</td><td>waist girth</td><td>hip girth</td><td>arm
to need find source node 'product description' value
product.description = array.wrap(item.editorial_reviews). find{|er| er['source'] == 'product description'}. try(:fetch, 'content', nil)
Comments
Post a Comment