0
votes

I installed the ruby-aaws gem and I tried to run a sample script. I Get the following error. Is there something I am missing ?Thanks.

1. gem install ruby-aaws

2. amazon.rb

require 'amazon/aws'
require 'amazon/aws/search'

include Amazon::AWS
include Amazon::AWS::Search

ASSOCIATES_ID = "************"
KEY_ID = '**************'

il = ItemLookup.new( 'ASIN', { 'ItemId' => 'B001COU9I6',
'MerchantId' => 'Amazon' })

rg = ResponseGroup.new( 'Medium' )

req = Request.new(KEY_ID, ASSOCIATES_ID)

resp = req.search( il, rg)
item_sets = resp.item_lookup_response[0].items
item_sets.each do |item_set|
item_set.item.each do |item|
attribs = item.item_attributes[0]
puts attribs
end
end
  1. (ERROR)

    $ ruby amazon.rb

/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in require': cannot load such file -- iconv (LoadError) from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in require' from /Library/Ruby/Gems/2.0.0/gems/ruby-aaws-0.8.1/lib/amazon/aws.rb:12:in <module:AWS>' from /Library/Ruby/Gems/2.0.0/gems/ruby-aaws-0.8.1/lib/amazon/aws.rb:7:in ' from /Library/Ruby/Gems/2.0.0/gems/ruby-aaws-0.8.1/lib/amazon/aws.rb:5:in <top (required)>' from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:135:in require' from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:135:in rescue in require' from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:144:in require' from amazon.rb:7:in `'

1

1 Answers

4
votes

You're missing iconv in your system, or your version doesn't match requirements from other packages.

Check if you have iconv installed

iconv --version

or

which iconv

Install iconv gem

gem install iconv

or

rvm pkg install iconv

If nothing works, try older/other versions

gem install iconv -v '~> 1.0.3'