Amazon::Locale (Module)

In: lib/amazon/locale.rb

Use of this module requires the use of the GeoIP library from MaxMind. It also requires the net-geoip Ruby module to interface with it.

Load this library as follows:

 require 'amazon/locale'

Constants

DE = %w[ at ch de ]
  ISO 3166 codes of countries likely to want to shop in the DE locale.
JP = %w[ jp ]
  ISO 3166 codes of countries likely to want to shop in the JP locale.
UK = %w[ ad al ba be cy cz dk ee es fi fo fr gi gr gl ie is it li lt lu lv mk mt nl no pl pt ro se si sk sm uk ]
  ISO 3166 codes of countries likely to want to shop in the UK locale.
US = %w[ ca mx us ]
  ISO 3166 codes of countries likely to want to shop in the US locale. Any countries not explicitly listed above default to the US locale.

Public Class methods

This will attempt to return a reasonable locale (de, jp, uk or us) to use for the IP address addr.

For example:

 get_locale_by_addr('217.110.207.55') => "de"

This will attempt to return a reasonable locale (de, jp, uk or us) to use for host.

For example:

 get_locale_by_name('xs1.xs4all.nl') => "uk"

[Validate]