Sha256: 61167da226211723616c99b0b8f14b73dfdd56b1f6c201cd687f77f6ca74fe6e

Contents?: true

Size: 863 Bytes

Versions: 2

Compression:

Stored size: 863 Bytes

Contents

module AmazonProduct
  # An Amazon locale.
  class Locale
    # Amazon hosts.
    HOSTS = { :ca => 'ecs.amazonaws.ca',
              :cn => 'webservices.amazon.cn',
              :de => 'ecs.amazonaws.de',
              :fr => 'ecs.amazonaws.fr',
              :it => 'webservices.amazon.it',
              :jp => 'ecs.amazonaws.jp',
              :us => 'ecs.amazonaws.com',
              :uk => 'ecs.amazonaws.co.uk' }

    # Country codes for Amazon locales.
    LOCALES = HOSTS.keys

    # The Amazon Web Services access key.
    attr_accessor :key

    # The Amazon Web Services secret.
    attr_accessor :secret

    # The Amazon associate tag.
    attr_accessor :tag

    def initialize(locale)
      raise BadLocale unless LOCALES.include?(locale)
      @locale = locale
    end

    # The Amazon host.
    def host
      HOSTS[@locale]
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
amazon_product-3.0.1 lib/amazon_product/locale.rb
amazon_product-3.0.0.pre.2 lib/amazon_product/locale.rb