skeniver
skeniver

Reputation: 2647

AWS ItemSearch with Ruby SDK

I am trying to do an ItemSearch using the Amazon aws-sdk Gem for Ruby on Rails, but can't get it to work and am struggling to find any documentation (it all seems to be old)

I have the following page: /app/views/home/index.html.erb:

<%= form_tag('/search') do %>
  <%= label_tag(:keywords, 'Search for:') %>
  <%= text_field_tag(:keywords) %>
  <%= submit_tag('Search') %><br/>
  <%= text_area_tag(:result, @result) %>
<% end %>

the following controller: /app/controllers/home_controller.rb:

class HomeController < ApplicationController
  require 'aws-sdk'

  def index
    @result = ''
  end

  def search
    AWS.config( :access_key_id => 'xx', :secret_access_key => 'xx')
    sea = ItemSearch.new('Books', {'Title' => 'ruby programming'} )
    @result = params[:keywords]
    render :action => :index
  end
end

but am getting the error:

uninitialized constant HomeController::ItemSearch

I am simply trying to get a result and display the result in the text area on the page.

But as I said, the only documentation I can find seems to be older.

Can anyone help me out with this? Or point me towards a more recent tutorial that I can use?

Many thanks

Upvotes: 0

Views: 315

Answers (1)

Trevor Rowe
Trevor Rowe

Reputation: 6538

The AWS SDK for Ruby (aws-sdk gem) does not support the Amazon Product Advertising API. It appears the code you are trying to use it from some other gem (perhaps ruby-aaws). The aws-sdk cover AWS APIs, but not Amazon APIs.

Upvotes: 2

Related Questions