Topic: "Ruby on Rails Bible" Ch. 6 example Amazon AWS help
Hello,
I've been stuck on this for a day and a half now and I hope someone could help me out...
It really looks like I got everything right and I'm constantly getting a HTTP 400 back.
I installed ruby-aaws via gems:
user@localhost:~$ gem list
*** LOCAL GEMS ***
actionmailer (2.3.4)
actionpack (2.3.4)
activerecord (2.3.4)
activeresource (2.3.4)
activesupport (2.3.4)
amazon-ec2 (0.7.3)
builder (2.1.2)
highline (1.5.1)
hoe (2.3.3)
json_pure (1.2.0)
mime-types (1.16)
mysql (2.8.1)
rack (1.0.1)
rails (2.3.4)
rake (0.8.7)
ruby-aaws (0.7.0)
ruby-aws (1.2.0)
rubyforge (2.0.3)
xml-simple (1.0.12)
I have my ~/.amazonrc config file set up, in the seemingly correct format:
key_id = 'my Amazon Key ID'
secret_key_id = 'my secret amazon key id'
cache = false
locale = 'us'
And finally here in irb:
Loading development environment (Rails 2.3.4)
>> require 'amazon/aws/search'
=> ["Amazon"]
>> include Amazon::AWS
=> Object
>> include Amazon::AWS::Search
=> Object
>> con=Request.new('--my key id -----', 'calibanorg-20' )
=> #<Amazon::AWS::Search::Request:0xb71d36cc @locale="us", @key_id="--my key id -----", @conn=nil, @cache=#<Amazon::AWS::Cache:0xb71d2560 @path="/tmp/amazon">, @user_agent="Ruby/Amazon/AWS 0.7.0", @tag="calibanorg-20", @encoding=nil, @config={}, @api=nil>
>> is = ItemSearch.new('Books', {'Keywords' => 'Ruby Programming'})
=> #<Amazon::AWS::ItemSearch:0xb71ca8b0 @response_group=#<Amazon::AWS::ResponseGroup:0xb71ca4dc @params={"ResponseGroup"=>"Large"}, @list=[:Large]>, @params={"Operation"=>"ItemSearch", "Keywords"=>"Ruby Programming", "SearchIndex"=>"Books"}, @kind="ItemSearch">
>> resp=con.search(is)
Amazon::AWS::HTTPError: HTTP response code 400
from /var/lib/gems/1.8/gems/ruby-aaws-0.7.0/lib/amazon/aws.rb:170:in `get_page'
from /var/lib/gems/1.8/gems/ruby-aaws-0.7.0/lib/amazon/aws/search.rb:305:in `search'
from (irb):6
My only clue, I think, is up there @config{}... its nil. Thought it should contain my secret_key_id from the config file, .amazonrc.
Help me, Obi-one-kinobis...