Module: Amazon::Hacks::Countries

Included in:
Image, Link
Defined in:
lib/amazon-hacks.rb

Overview

The countries module is a convenience mixin to retrieve the correct server, etc. for an Image or Link. This module requires the class to include a @country instance variable.

Instance Method Summary collapse

Instance Method Details

#country_hostObject

Returns a hostname for the Amazon store for that country



35
36
37
# File 'lib/amazon-hacks.rb', line 35

def country_host 
  COUNTRIES[@country].host
end

#country_imgcodeObject

Each country in Amazon seems to use a different image code number in its images (eg, “01” for the US, “08” for France). This method returns the image code for the country



43
44
45
# File 'lib/amazon-hacks.rb', line 43

def country_imgcode
  COUNTRIES[@country].img_code
end

#country_imghostObject

Each country also has a different server for its images. This returns the correct server.



50
51
52
# File 'lib/amazon-hacks.rb', line 50

def country_imghost
  COUNTRIES[@country].img_host
end