class Vacuum::Locale

The target locale

@see webservices.amazon.com/paapi5/documentation/common-request-parameters.html#host-and-region

Constants

HOSTS_AND_REGIONS

Attributes

access_key[R]

@return [String]

host[R]

@return [String]

partner_tag[R]

@return [String]

partner_type[R]

@return [String]

region[R]

@return [String]

secret_key[R]

@return [String]

Public Class Methods

new(marketplace, access_key:, secret_key:, partner_tag:, partner_type: 'Associates') click to toggle source

Creates a locale

@param [Symbol,String] marketplace @param [String] access_key @param [String] secret_key @param [String] partner_tag @param [String] partner_type @raise [NotFound] if marketplace is not found

# File lib/vacuum/locale.rb, line 44
def initialize(marketplace, access_key:, secret_key:, partner_tag:,
               partner_type: 'Associates')
  @host, @region = find_host_and_region(marketplace)
  @access_key = access_key
  @secret_key = secret_key
  @partner_tag = partner_tag
  @partner_type = partner_type
end

Private Instance Methods

find_host_and_region(marketplace) click to toggle source
# File lib/vacuum/locale.rb, line 55
def find_host_and_region(marketplace)
  marketplace = marketplace.to_sym.downcase
  marketplace = :gb if marketplace == :uk

  HOSTS_AND_REGIONS.fetch(marketplace)
rescue KeyError
  raise NotFound, "marketplace not found: :#{marketplace}"
end