def upc_search(upc, mode='music', weight=HEAVY, &block)
unless @locale == 'us'
raise LocaleError, "search type invalid in '#{@locale}' locale"
end
url = AWS_PREFIX + "?t=%s&UpcSearch=%s&mode=%s&f=xml&type=%s&dev-t=%s"
@type = WEIGHT[weight]
upc.gsub!(/ /, ',') if upc.is_a? String
upc = upc.join(',') if upc.is_a? Array
if upc.count(',') >= (weight ? MAX_HEAVY_UPCS : MAX_LITE_UPCS)
raise TermError, "too many UPCs"
end
modes = %w[music classical software dvd vhs video
electronics pc-hardware photo]
unless modes.include? mode
raise ModeError, "mode must be one of %s" % modes.join(', ')
end
mode = localise_mode(mode)
search(url % [@id, upc, mode, @type, @token], &block)
end