Module: Snail::Iso3166

Defined in:
lib/snail/constants.rb

Constant Summary collapse

ALPHA2 =

as of January 28, 2013 pulled en.wikipedia.org/wiki/ISO_3166-1_alpha-2

{
  'AC' => ['ASCENSION', 'ASCENSION ISLAND'],
  'AD' => ['ANDORRA'],
  'AE' => ['UNITED ARAB EMIRATES'],
  'AF' => ['AFGHANISTAN'],
  'AG' => ['ANTIGUA AND BARBUDA'],
  'AI' => ['ANGUILLA'],
  'AL' => ['ALBANIA'],
  'AM' => ['ARMENIA'],
  'AN' => ['NETHERLANDS ANTILLES'],
  'AO' => ['ANGOLA'],
  'AQ' => ['ANTARCTICA'],
  'AR' => ['ARGENTINA'],
  'AS' => ['AMERICAN SAMOA'],
  'AT' => ['AUSTRIA'],
  'AU' => ['AUSTRALIA'],
  'AW' => ['ARUBA'],
  'AX' => ['ALAND ISLANDS'],
  'AZ' => ['AZERBAIJAN'],
  'BA' => ['BOSNIA AND HERZEGOVINA'],
  'BB' => ['BARBADOS'],
  'BD' => ['BANGLADESH'],
  'BE' => ['BELGIUM'],
  'BF' => ['BURKINA FASO'],
  'BG' => ['BULGARIA'],
  'BH' => ['BAHRAIN'],
  'BI' => ['BURUNDI'],
  'BJ' => ['BENIN'],
  'BL' => ['SAINT BARTHELEMY'],
  'BM' => ['BERMUDA'],
  'BN' => ['BRUNEI DARUSSALAM'],
  'BO' => ['BOLIVIA'],
  'BR' => ['BRAZIL'],
  'BS' => ['BAHAMAS'],
  'BT' => ['BHUTAN'],
  'BV' => ['BOUVET ISLAND'],
  'BW' => ['BOTSWANA'],
  'BY' => ['BELARUS'],
  'BZ' => ['BELIZE'],
  'CA' => ['CANADA'],
  'CC' => ['COCOS (KEELING) ISLANDS'],
  'CD' => ['DEMOCRATIC REPUBLIC OF THE CONGO'],
  'CF' => ['CENTRAL AFRICAN REPUBLIC'],
  'CG' => ['CONGO', 'REPUBLIC OF THE CONGO'],
  'CH' => ['SWITZERLAND'],
  'CI' => ["COTE D'IVOIRE", "CÔTE D'IVOIRE", 'IVORY COAST', "REPUBLIC OF CÔTE D'IVOIRE"],
  'CK' => ['COOK ISLANDS'],
  'CL' => ['CHILE'],
  'CM' => ['CAMEROON'],
  'CN' => ['CHINA', "PEOPLE'S REPUBLIC OF CHINA"],
  'CO' => ['COLOMBIA'],
  'CP' => ['CLIPPERTON ISLAND'],
  'CR' => ['COSTA RICA'],
  'CU' => ['CUBA'],
  'CV' => ['CAPE VERDE'],
  'CW' => ['CURACAO', 'CURAçAO'],
  'CX' => ['CHRISTMAS ISLAND'],
  'CY' => ['CYPRUS'],
  'CZ' => ['CZECH REPUBLIC'],
  'DE' => ['GERMANY'],
  'DG' => ['DIEGO GARCIA'],
  'DJ' => ['DJIBOUTI'],
  'DK' => ['DENMARK'],
  'DM' => ['DOMINICA'],
  'DO' => ['DOMINICAN REPUBLIC'],
  'DZ' => ['ALGERIA'],
  'EA' => ['CEUTA, MELILLA'],
  'EC' => ['ECUADOR'],
  'EE' => ['ESTONIA'],
  'EG' => ['EGYPT'],
  'EH' => ['WESTERN SAHARA'],
  'ER' => ['ERITREA'],
  'ES' => ['SPAIN'],
  'ET' => ['ETHIOPIA'],
  'EU' => ['EUROPEAN UNION'],
  'FI' => ['FINLAND'],
  'FJ' => ['FIJI'],
  'FK' => ['FALKLAND ISLANDS'],
  'FM' => ['MICRONESIA'],
  'FO' => ['FAROE ISLANDS'],
  'FR' => ['FRANCE'],
  'GA' => ['GABON'],
  'GB' => ['UNITED KINGDOM', 'ENGLAND', 'NORTHERN IRELAND', 'SCOTLAND', 'WALES'],
  'GD' => ['GRENADA'],
  'GE' => ['GEORGIA'],
  'GF' => ['FRENCH GUIANA'],
  'GG' => ['GUERNSEY'],
  'GH' => ['GHANA'],
  'GI' => ['GIBRALTAR'],
  'GL' => ['GREENLAND'],
  'GM' => ['GAMBIA'],
  'GN' => ['GUINEA'],
  'GP' => ['GUADELOUPE'],
  'GQ' => ['EQUATORIAL GUINEA'],
  'GR' => ['GREECE'],
  'GS' => ['SOUTH GEORGIA AND THE SOUTH SANDWICH ISLANDS', 'SOUTH GEORGIA', 'SOUTH SANDWICH ISLANDS'],
  'GT' => ['GUATEMALA'],
  'GU' => ['GUAM'],
  'GW' => ['GUINEA-BISSAU'],
  'GY' => ['GUYANA'],
  'HK' => ['HONG KONG'],
  'HM' => ['HEARD ISLAND AND MCDONALD ISLANDS'],
  'HN' => ['HONDURAS'],
  'HR' => ['CROATIA'],
  'HT' => ['HAITI'],
  'HU' => ['HUNGARY'],
  'IC' => ['CANARY ISLANDS'],
  'ID' => ['INDONESIA'],
  'IE' => ['IRELAND'],
  'IL' => ['ISRAEL'],
  'IM' => ['ISLE OF MAN'],
  'IN' => ['INDIA'],
  'IO' => ['BRITISH INDIAN OCEAN TERRITORY'],
  'IQ' => ['IRAQ'],
  'IR' => ['IRAN', 'ISLAMIC REPUBLIC OF IRAN'],
  'IS' => ['ICELAND'],
  'IT' => ['ITALY'],
  'JE' => ['JERSEY'],
  'JM' => ['JAMAICA'],
  'JO' => ['JORDAN'],
  'JP' => ['JAPAN'],
  'KE' => ['KENYA'],
  'KG' => ['KYRGYZSTAN'],
  'KH' => ['CAMBODIA'],
  'KI' => ['KIRIBATI'],
  'KM' => ['COMOROS'],
  'KN' => ['SAINT KITTS AND NEVIS'],
  'KP' => ['NORTH KOREA', "DEMOCRATIC PEOPLE'S REPUBLIC OF KOREA"],
  'KR' => ['SOUTH KOREA', 'KOREA', 'REPUBLIC OF KOREA'],
  'KW' => ['KUWAIT'],
  'KY' => ['CAYMAN ISLANDS'],
  'KZ' => ['KAZAKHSTAN'],
  'LA' => ['LAOS'],
  'LB' => ['LEBANON'],
  'LC' => ['SAINT LUCIA'],
  'LI' => ['LIECHTENSTEIN'],
  'LK' => ['SRI LANKA'],
  'LR' => ['LIBERIA'],
  'LS' => ['LESOTHO'],
  'LT' => ['LITHUANIA'],
  'LU' => ['LUXEMBOURG'],
  'LV' => ['LATVIA'],
  'LY' => ['LIBYA', 'STATE OF LIBYA', 'LIBYAN ARAB JAMAHIRIYA'],
  'MA' => ['MOROCCO'],
  'MC' => ['MONACO'],
  'MD' => ['MOLDOVA'],
  'ME' => ['MONTENEGRO'],
  'MF' => ['SAINT MARTIN'],
  'MG' => ['MADAGASCAR'],
  'MH' => ['MARSHALL ISLANDS'],
  'MK' => ['MACEDONIA'],
  'ML' => ['MALI'],
  'MM' => ['MYANMAR'],
  'MN' => ['MONGOLIA'],
  'MO' => ['MACAO'],
  'MP' => ['NORTHERN MARIANA ISLANDS'],
  'MQ' => ['MARTINIQUE'],
  'MR' => ['MAURITANIA'],
  'MS' => ['MONTSERRAT'],
  'MT' => ['MALTA'],
  'MU' => ['MAURITIUS'],
  'MV' => ['MALDIVES'],
  'MW' => ['MALAWI'],
  'MX' => ['MEXICO'],
  'MY' => ['MALAYSIA'],
  'MZ' => ['MOZAMBIQUE'],
  'NA' => ['NAMIBIA'],
  'NC' => ['NEW CALEDONIA'],
  'NE' => ['NIGER'],
  'NF' => ['NORFOLK ISLAND'],
  'NG' => ['NIGERIA'],
  'NI' => ['NICARAGUA'],
  'NL' => ['NETHERLANDS'],
  'NO' => ['NORWAY'],
  'NP' => ['NEPAL'],
  'NR' => ['NAURU'],
  'NU' => ['NIUE'],
  'NZ' => ['NEW ZEALAND'],
  'OM' => ['OMAN'],
  'PA' => ['PANAMA'],
  'PE' => ['PERU'],
  'PF' => ['FRENCH POLYNESIA'],
  'PG' => ['PAPUA NEW GUINEA'],
  'PH' => ['PHILIPPINES'],
  'PK' => ['PAKISTAN'],
  'PL' => ['POLAND'],
  'PM' => ['SAINT PIERRE AND MIQUELON'],
  'PN' => ['PITCAIRN', 'PITCAIRN ISLAND', 'PITCAIRN ISLANDS'],
  'PR' => ['PUERTO RICO'],
  'PS' => ['PALESTINIAN TERRITORIES', 'PALESTINIAN TERRITORY', 'OCCUPIED PALESTINIAN TERRITORIES'],
  'PT' => ['PORTUGAL'],
  'PW' => ['PALAU'],
  'PY' => ['PARAGUAY'],
  'QA' => ['QATAR'],
  'RE' => ['REUNION'],
  'RO' => ['ROMANIA'],
  'RS' => ['SERBIA'],
  'RU' => ['RUSSIAN FEDERATION', 'RUSSIA'],
  'RW' => ['RWANDA'],
  'SA' => ['SAUDI ARABIA'],
  'SB' => ['SOLOMON ISLANDS'],
  'SC' => ['SEYCHELLES'],
  'SD' => ['SUDAN'],
  'SE' => ['SWEDEN'],
  'SG' => ['SINGAPORE'],
  'SH' => ['SAINT HELENA'],
  'SI' => ['SLOVENIA'],
  'SJ' => ['SVALBARD AND JAN MAYEN'],
  'SK' => ['SLOVAKIA', 'SLOVAK REPUBLIC'],
  'SL' => ['SIERRA LEONE'],
  'SM' => ['SAN MARINO'],
  'SN' => ['SENEGAL'],
  'SO' => ['SOMALIA'],
  'SR' => ['SURINAME'],
  'SS' => ['SOUTH SUDAN'],
  'ST' => ['SAO TOME AND PRINCIPE'],
  'SV' => ['EL SALVADOR'],
  'SY' => ['SYRIAN ARAB REPUBLIC', 'SYRIA'],
  'SZ' => ['SWAZILAND'],
  'TA' => ['TRISTAN DA CUNHA'],
  'TC' => ['TURKS AND CAICOS ISLANDS'],
  'TD' => ['CHAD'],
  'TF' => ['FRENCH SOUTHERN TERRITORIES'],
  'TG' => ['TOGO'],
  'TH' => ['THAILAND'],
  'TJ' => ['TAJIKISTAN'],
  'TK' => ['TOKELAU'],
  'TL' => ['TIMOR-LESTE', 'EAST TIMOR', 'DEMOCRATIC REPUBLIC OF TIMOR-LESTE'],
  'TM' => ['TURKMENISTAN'],
  'TN' => ['TUNISIA'],
  'TO' => ['TONGA'],
  'TR' => ['TURKEY'],
  'TT' => ['TRINIDAD AND TOBAGO'],
  'TV' => ['TUVALU'],
  'TW' => ['TAIWAN'],
  'TZ' => ['TANZANIA'],
  'UA' => ['UKRAINE'],
  'UG' => ['UGANDA'],
  'UM' => ['UNITED STATES MINOR OUTLYING ISLANDS'],
  'US' => ['UNITED STATES', 'UNITED STATES OF AMERICA'],
  'UY' => ['URUGUAY'],
  'UZ' => ['UZBEKISTAN'],
  'VA' => ['VATICAN CITY'],
  'VC' => ['SAINT VINCENT AND THE GRENADINES'],
  'VE' => ['VENEZUELA'],
  'VG' => ['VIRGIN ISLANDS, BRITISH', 'BRITISH VIRGIN ISLANDS'],
  'VI' => ['VIRGIN ISLANDS, U.S.'],
  'VN' => ['VIET NAM', 'VIETNAM', 'SOCIALIST REPUBLIC OF VIETNAM'],
  'VU' => ['VANUATU'],
  'WF' => ['WALLIS AND FUTUNA', 'WALLIS AND FUTUNA ISLANDS'],
  'WS' => ['SAMOA', 'INDEPENDENT STATE OF SAMOA', 'WESTERN SAMOA'],
  'XK' => ['KOSOVO'],
  'YE' => ['YEMEN'],
  'YT' => ['MAYOTTE'],
  'ZA' => ['SOUTH AFRICA'],
  'ZM' => ['ZAMBIA'],
  'ZW' => ['ZIMBABWE']
}
ALPHA2_EXCEPTIONS =
{
  'UK' => 'GB', # great britain aka united kingdom
  'FX' => 'FR', # france
  'SU' => 'RU'  # russia
}
ALPHA3_TO_ALPHA2 =
{
  'ABW' => 'AW',
  'AFG' => 'AF',
  'AGO' => 'AO',
  'AIA' => 'AI',
  'ALA' => 'AX',
  'ALB' => 'AL',
  'AND' => 'AD',
  'ANT' => 'AN',
  'ARE' => 'AE',
  'ARG' => 'AR',
  'ARM' => 'AM',
  'ASM' => 'AS',
  'ATA' => 'AQ',
  'ATF' => 'TF',
  'ATG' => 'AG',
  'AUS' => 'AU',
  'AUT' => 'AT',
  'AZE' => 'AZ',
  'BDI' => 'BI',
  'BEL' => 'BE',
  'BEN' => 'BJ',
  'BFA' => 'BF',
  'BGD' => 'BD',
  'BGR' => 'BG',
  'BHR' => 'BH',
  'BHS' => 'BS',
  'BIH' => 'BA',
  'BLM' => 'BL',
  'BLR' => 'BY',
  'BLZ' => 'BZ',
  'BMU' => 'BM',
  'BOL' => 'BO',
  'BRA' => 'BR',
  'BRB' => 'BB',
  'BRN' => 'BN',
  'BTN' => 'BT',
  'BVT' => 'BV',
  'BWA' => 'BW',
  'CAF' => 'CF',
  'CAN' => 'CA',
  'CCK' => 'CC',
  'CHE' => 'CH',
  'CHL' => 'CL',
  'CHN' => 'CN',
  'CIV' => 'CI',
  'CMR' => 'CM',
  'COD' => 'CD',
  'COG' => 'CG',
  'COK' => 'CK',
  'COL' => 'CO',
  'COM' => 'KM',
  'CPV' => 'CV',
  'CRI' => 'CR',
  'CUB' => 'CU',
  'CXR' => 'CX',
  'CYM' => 'KY',
  'CYP' => 'CY',
  'CZE' => 'CZ',
  'DEU' => 'DE',
  'DJI' => 'DJ',
  'DMA' => 'DM',
  'DNK' => 'DK',
  'DOM' => 'DO',
  'DZA' => 'DZ',
  'ECU' => 'EC',
  'EGY' => 'EG',
  'ERI' => 'ER',
  'ESH' => 'EH',
  'ESP' => 'ES',
  'EST' => 'EE',
  'ETH' => 'ET',
  'FIN' => 'FI',
  'FJI' => 'FJ',
  'FLK' => 'FK',
  'FRA' => 'FR',
  'FRO' => 'FO',
  'FSM' => 'FM',
  'GAB' => 'GA',
  'GBR' => 'GB',
  'GEO' => 'GE',
  'GGY' => 'GG',
  'GHA' => 'GH',
  'GIB' => 'GI',
  'GIN' => 'GN',
  'GLP' => 'GP',
  'GMB' => 'GM',
  'GNB' => 'GW',
  'GNQ' => 'GQ',
  'GRC' => 'GR',
  'GRD' => 'GD',
  'GRL' => 'GL',
  'GTM' => 'GT',
  'GUF' => 'GF',
  'GUM' => 'GU',
  'GUY' => 'GY',
  'HKG' => 'HK',
  'HMD' => 'HM',
  'HND' => 'HN',
  'HRV' => 'HR',
  'HTI' => 'HT',
  'HUN' => 'HU',
  'IDN' => 'ID',
  'IMN' => 'IM',
  'IND' => 'IN',
  'IOT' => 'IO',
  'IRL' => 'IE',
  'IRN' => 'IR',
  'IRQ' => 'IQ',
  'ISL' => 'IS',
  'ISR' => 'IL',
  'ITA' => 'IT',
  'JAM' => 'JM',
  'JEY' => 'JE',
  'JOR' => 'JO',
  'JPN' => 'JP',
  'KAZ' => 'KZ',
  'KEN' => 'KE',
  'KGZ' => 'KG',
  'KHM' => 'KH',
  'KIR' => 'KI',
  'KNA' => 'KN',
  'KOR' => 'KR',
  'KWT' => 'KW',
  'LAO' => 'LA',
  'LBN' => 'LB',
  'LBR' => 'LR',
  'LBY' => 'LY',
  'LCA' => 'LC',
  'LIE' => 'LI',
  'LKA' => 'LK',
  'LSO' => 'LS',
  'LTU' => 'LT',
  'LUX' => 'LU',
  'LVA' => 'LV',
  'MAC' => 'MO',
  'MAF' => 'MF',
  'MAR' => 'MA',
  'MCO' => 'MC',
  'MDA' => 'MD',
  'MDG' => 'MG',
  'MDV' => 'MV',
  'MEX' => 'MX',
  'MHL' => 'MH',
  'MKD' => 'MK',
  'MLI' => 'ML',
  'MLT' => 'MT',
  'MMR' => 'MM',
  'MNE' => 'ME',
  'MNG' => 'MN',
  'MNP' => 'MP',
  'MOZ' => 'MZ',
  'MRT' => 'MR',
  'MSR' => 'MS',
  'MTQ' => 'MQ',
  'MUS' => 'MU',
  'MWI' => 'MW',
  'MYS' => 'MY',
  'MYT' => 'YT',
  'NAM' => 'NA',
  'NCL' => 'NC',
  'NER' => 'NE',
  'NFK' => 'NF',
  'NGA' => 'NG',
  'NIC' => 'NI',
  'NIU' => 'NU',
  'NLD' => 'NL',
  'NOR' => 'NO',
  'NPL' => 'NP',
  'NRU' => 'NR',
  'NZL' => 'NZ',
  'OMN' => 'OM',
  'PAK' => 'PK',
  'PAN' => 'PA',
  'PCN' => 'PN',
  'PER' => 'PE',
  'PHL' => 'PH',
  'PLW' => 'PW',
  'PNG' => 'PG',
  'POL' => 'PL',
  'PRI' => 'PR',
  'PRK' => 'KP',
  'PRT' => 'PT',
  'PRY' => 'PY',
  'PSE' => 'PS',
  'PYF' => 'PF',
  'QAT' => 'QA',
  'REU' => 'RE',
  'ROU' => 'RO',
  'RUS' => 'RU',
  'RWA' => 'RW',
  'SAU' => 'SA',
  'SDN' => 'SD',
  'SEN' => 'SN',
  'SGP' => 'SG',
  'SGS' => 'GS',
  'SHN' => 'SH',
  'SJM' => 'SJ',
  'SLB' => 'SB',
  'SLE' => 'SL',
  'SLV' => 'SV',
  'SMR' => 'SM',
  'SOM' => 'SO',
  'SPM' => 'PM',
  'SRB' => 'RS',
  'SSD' => 'SS',
  'STP' => 'ST',
  'SUR' => 'SR',
  'SVK' => 'SK',
  'SVN' => 'SI',
  'SWE' => 'SE',
  'SWZ' => 'SZ',
  'SYC' => 'SC',
  'SYR' => 'SY',
  'TCA' => 'TC',
  'TCD' => 'TD',
  'TGO' => 'TG',
  'THA' => 'TH',
  'TJK' => 'TJ',
  'TKL' => 'TK',
  'TKM' => 'TM',
  'TLS' => 'TL',
  'TON' => 'TO',
  'TTO' => 'TT',
  'TUN' => 'TN',
  'TUR' => 'TR',
  'TUV' => 'TV',
  'TWN' => 'TW',
  'TZA' => 'TZ',
  'UGA' => 'UG',
  'UKR' => 'UA',
  'UMI' => 'UM',
  'URY' => 'UY',
  'USA' => 'US',
  'UZB' => 'UZ',
  'VAT' => 'VA',
  'VCT' => 'VC',
  'VEN' => 'VE',
  'VGB' => 'VG',
  'VIR' => 'VI',
  'VNM' => 'VN',
  'VUT' => 'VU',
  'WLF' => 'WF',
  'WSM' => 'WS',
  'YEM' => 'YE',
  'ZAF' => 'ZA',
  'ZMB' => 'ZM',
  'ZWE' => 'ZW'
}