lineofflight / peddler

Amazon Selling Partner API (SP-API) in Ruby
MIT License
307 stars 130 forks source link

BadID #34

Closed viperouge closed 9 years ago

viperouge commented 9 years ago

I was trying to set up peddler and after I put my marketplace_id, merchant_id etc and start the server the following error is returned: gems/peddler-0.12.7/lib/peddler/marketplace.rb:44:in `block in find_host': Peddler::Marketplace::BadId (Peddler::Marketplace::BadId)

I'm using Ruby 2.1.3 and Rails 4.2.0

Any ideas how to fix it?

hakanensari commented 9 years ago

It sounds like you didn't set the marketplace_id on the client or you set it to something not in here?

viperouge commented 9 years ago

I did.. my marketplace id is:

marketplace_id: "ATVPDKIKX0DER"

viperouge commented 9 years ago

in which files should I place:

require 'peddler'

client = MWS.orders parser = client.get_service_status parser.parse

and

client = MWS.orders( marketplace_id: "...", merchant_id: "...", aws_access_key_id: "...", aws_secret_access_key: "..." )

? maybe I'm doing something wrong

hakanensari commented 9 years ago

I added a descriptive message to the Marketplace::BadId error. Could you point your Gemfile to the GitHub repo and see what the error message says?

viperouge commented 9 years ago

missing MarketplaceId (Peddler::Marketplace::BadId). Currently the ID is in a file called peddler.rb in config/initializers. Maybe I'm just doing something wrong?

hakanensari commented 9 years ago

Looks like it. You need to set the credentials each time you instantiate a client. There's no singleton configuration object that stores credentials across instances.

If you are using a single set of credentials, I recommend you set them through environment variables, as I explain in the README.

I'll keep this issue open until I get a chance to reword the README to make this more explicit.