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

different languages #40

Closed
mattherick opened this issue Jul 28, 2014 · 5 comments
Closed

different languages #40

mattherick opened this issue Jul 28, 2014 · 5 comments

Comments

@mattherick
Copy link

Hi!

Is it possible to change the language dynamically for the amazon results? I only get US-results at the moment and I also like to receive german results.
How could I change your gem to provide this feature also? Any suggestions?
Best regards.

Matthias

@mattherick
Copy link
Author

Okay my fault.. it is possible to configure the host for getting different results depending on the language.
For others:

ASIN::Configuration.configure do |config|
  config.secret        = Rails.application.secrets.amazon["secret_access_key"]
  config.key           = Rails.application.secrets.amazon["access_key_id"]
  config.associate_tag = Rails.application.secrets.amazon["associate_tag"]
  config.host          = "webservices.amazon.de"
end

This would return german results.

Do you have a list of all possible hosts? And maybe you can update your README - the optional host configuration is not mentioned anywhere.

@jaimerump
Copy link

@mattherick I've found a list, but I think it's incomplete because I think I remember there being an Indian endpoint that isn't listed there. http://docs.aws.amazon.com/AWSECommerceService/latest/DG/AnatomyOfaRESTRequest.html

@jaimerump
Copy link

Springboarding off of this, what if I want to change it dynamically at runtime? I have users from all across the world, and I'd like to serve up their country's version if there is one. Could I do something like this at runtime to change which site I query just for that specific user?

ASIN::Configuration.configure do |config|
  config.host          = "webservices.amazon.de"
end

@kurtfunai
Copy link
Collaborator

👍

@phoet
Copy link
Owner

phoet commented Jul 28, 2014

@jaimerump @kurtfunai ❤️ for helping!

confiture has a feature that allows you to set block-scoped configuration. it's also thread-safe:

ASIN::Configuration.with_config(host: "webservices.amazon.de") do
  client.lookup('B0096BYG7C').first.detail_page_url # http://www.amazon.de/Practical...
end

@phoet phoet closed this as completed Jul 28, 2014
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

4 participants