Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting an error from within the Asin gem... #1

Closed
robacarp opened this issue Nov 3, 2010 · 2 comments
Closed

Getting an error from within the Asin gem... #1

robacarp opened this issue Nov 3, 2010 · 2 comments

Comments

@robacarp
Copy link

robacarp commented Nov 3, 2010

Hey, many thanks for this gem. I've been able to use it to query the Amazon API by manually loading it into IRB. When I tried to load it into my rails application I ran into some problems though.

Not sure if I'm doing it wrong or not. Here is what I have:

config/initializers/asin.rb:
require 'asin'
include ASIN
configure :secret => '', :key => ''

and when I start the rails app (rails s or rails c) I get a stackdump starting with:
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/asin-0.0.8/lib/asin.rb:91:in `merge!': can't convert Class into Hash (TypeError)

I'm done working for the night, but tomorrow I'll probably crack open the gem and see what I can find.

@phoet
Copy link
Owner

phoet commented Nov 3, 2010

sounds like you are passing a class into the configure method instead of a hash.

i use asin in a helper-class that is located in my lib folder:

class Helper
  extend ASIN
  def self.amazon_book(asin)
    configure(:secret => ENV['ASIN_SECRET'], :key => ENV['ASIN_KEY'], :host => 'webservices.amazon.de', :logger => logger)
  end
end

@robacarp
Copy link
Author

robacarp commented Nov 3, 2010

Yes, thanks for the reply. I also have it in a helper class, I think the problem I was having was that I was doing "include ASIN" instead of "extend ASIN".

my helper class:
module Amazonian
extend ASIN
end

and my initializer:
require 'amazonian'
Amazonian.configure(:secret => '<>', :key => '<>')

I had almost the same setup yesterday when it was throwing that error so I was distilling it down to the bare minimum for some testing. Swapping out that include for extend seems to have done it.

Thanks!

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants