Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Countries data loaded

  • Loading branch information...
commit 3ec2d5afa81cd71ca879dadadb4cc3baf5846a75 1 parent 4a8e5c5
@gferraz gferraz authored
View
11 lib/uncharted.rb
@@ -5,5 +5,14 @@
Country = Uncharted::Country
module Uncharted
-
+ class Config
+
+ def load_path
+ @@load_path ||= []
+ end
+
+ def load_path=(path)
+ @@load_path = path
+ end
+ end
end
View
252 lib/uncharted/countries_data.rb
@@ -0,0 +1,252 @@
+# encoding: utf-8
+COUNTRIES_DATA = [
+ # alpha2, alpha3, currency, phone, name
+ ['AC', 'ASC', 'SHP', '+247', 'Ascension'],
+ ['AD', 'AND', 'EUR', '+376', 'Andorra'],
+ ['AE', 'ARE', 'AED', '+971', 'United Arab Emirates'],
+ ['AF', 'AFG', 'AFN', '+93', 'Afghanistan'],
+ ['AG', 'ATG', 'XCD', '+1-268', 'Antigua and Barbuda'],
+ ['AI', 'AIA', 'XCD', '+1-264', 'Anguilla'],
+ ['AL', 'ALB', 'ALL', '+355', 'Albania'],
+ ['AM', 'ARM', 'AMD', '+374', 'Armenia'],
+ ['AN', 'ANT', 'ANG', '+599', 'Netherlands Antilles'],
+ ['AO', 'AGO', 'AOA', '+244', 'Angola'],
+ ['AQ', 'ATA', nil, nil, 'Antarctica'],
+ ['AR', 'ARG', 'ARS', '+54', 'Argentina'],
+ ['AS', 'ASM', 'USD', '+1-684', 'American Samoa'],
+ ['AT', 'AUT', 'EUR', '+43', 'Austria'],
+ ['AU', 'AUS', 'AUD', '+61', 'Australia'],
+ ['AW', 'ABW', 'AWG', '+297', 'Aruba'],
+ ['AX', 'ALA', 'EUR', '+358-18', 'Aland'],
+ ['AZ', 'AZE', 'AZN', '+994', 'Azerbaijan'],
+ ['BA', 'BIH', 'BAM', '+387', 'Bosnia and Herzegovina'],
+ ['BB', 'BRB', 'BBD', '+1-246', 'Barbados'],
+ ['BD', 'BGD', 'BDT', '+880', 'Bangladesh'],
+ ['BE', 'BEL', 'EUR', '+32', 'Belgium'],
+ ['BF', 'BFA', 'XOF', '+226', 'Burkina Faso'],
+ ['BG', 'BGR', 'BGN', '+359', 'Bulgaria'],
+ ['BH', 'BHR', 'BHD', '+973', 'Bahrain'],
+ ['BI', 'BDI', 'BIF', '+257', 'Burundi'],
+ ['BJ', 'BEN', 'XOF', '+229', 'Benin'],
+ ['BM', 'BMU', 'BMD', '+1-441', 'Bermuda'],
+ ['BN', 'BRN', 'BND', '+673', 'Brunei'],
+ ['BO', 'BOL', 'BOB', '+591', 'Bolivia'],
+ ['BR', 'BRA', 'BRL', '+55', 'Brazil'],
+ ['BS', 'BHS', 'BSD', '+1-242', 'Bahamas, The'],
+ ['BT', 'BTN', 'BTN', '+975', 'Bhutan'],
+ ['BV', 'BVT', nil, nil, 'Bouvet Island'],
+ ['BW', 'BWA', 'BWP', '+267', 'Botswana'],
+ ['BY', 'BLR', 'BYR', '+375', 'Belarus'],
+ ['BZ', 'BLZ', 'BZD', '+501', 'Belize'],
+ ['CA', 'CAN', 'CAD', '+1', 'Canada'],
+ ['CC', 'CCK', 'AUD', '+61', 'Cocos (Keeling) Islands'],
+ ['CD', 'COD', 'CDF', '+243', 'Congo, Democratic Republic of the (Congo ヨ Kinshasa)'],
+ ['CF', 'CAF', 'XAF', '+236', 'Central African Republic'],
+ ['CG', 'COG', 'XAF', '+242', 'Congo, Republic of the (Congo ヨ Brazzaville)'],
+ ['CH', 'CHE', 'CHF', '+41', 'Switzerland'],
+ ['CI', 'CIV', 'XOF', '+225', 'Cote d''Ivoire (Ivory Coast)'],
+ ['CK', 'COK', 'NZD', '+682', 'Cook Islands'],
+ ['CL', 'CHL', 'CLP', '+56', 'Chile'],
+ ['CM', 'CMR', 'XAF', '+237', 'Cameroon'],
+ ['CN', 'CHN', 'CNY', '+86', 'China, People''s Republic of'],
+ ['CO', 'COL', 'COP', '+57', 'Colombia'],
+ ['CR', 'CRI', 'CRC', '+506', 'Costa Rica'],
+ ['CS', 'SCG', 'CSD and EUR', '+381', 'Kosovo'],
+ ['CU', 'CUB', 'CUP', '+53', 'Cuba'],
+ ['CV', 'CPV', 'CVE', '+238', 'Cape Verde'],
+ ['CX', 'CXR', 'AUD', '+61', 'Christmas Island'],
+ ['CY', 'CYP', 'CYP', '+357', 'Cyprus'],
+ ['CZ', 'CZE', 'CZK', '+420', 'Czech Republic'],
+ ['DE', 'DEU', 'EUR', '+49', 'Germany'],
+ ['DJ', 'DJI', 'DJF', '+253', 'Djibouti'],
+ ['DK', 'DNK', 'DKK', '+45', 'Denmark'],
+ ['DM', 'DMA', 'XCD', '+1-767', 'Dominica'],
+ ['DO', 'DOM', 'DOP', '+1', 'Dominican Republic'],
+ ['DZ', 'DZA', 'DZD', '+213', 'Algeria'],
+ ['EC', 'ECU', 'USD', '+593', 'Ecuador'],
+ ['EE', 'EST', 'EEK', '+372', 'Estonia'],
+ ['EG', 'EGY', 'EGP', '+20', 'Egypt'],
+ ['EH', 'ESH', 'MAD', '+212', 'Western Sahara'],
+ ['ER', 'ERI', 'ERN', '+291', 'Eritrea'],
+ ['ES', 'ESP', 'EUR', '+34', 'Spain'],
+ ['ET', 'ETH', 'ETB', '+251', 'Ethiopia'],
+ ['FI', 'FIN', 'EUR', '+358', 'Finland'],
+ ['FJ', 'FJI', 'FJD', '+679', 'Fiji'],
+ ['FK', 'FLK', 'FKP', '+500', 'Falkland Islands (Islas Malvinas)'],
+ ['FM', 'FSM', 'USD', '+691', 'Micronesia'],
+ ['FO', 'FRO', 'DKK', '+298', 'Faroe Islands'],
+ ['FR', 'FRA', 'EUR', '+33', 'France'],
+ ['GA', 'GAB', 'XAF', '+241', 'Gabon'],
+ ['GB', 'GBR', 'GBP', '+44', 'United Kingdom'],
+ ['GD', 'GRD', 'XCD', '+1-473', 'Grenada'],
+ ['GE', 'GEO', 'GEL', '+995', 'Georgia'],
+ ['GF', 'GUF', 'EUR', '+594', 'French Guiana'],
+ ['GG', 'GGY', 'GGP', '+44', 'Guernsey'],
+ ['GH', 'GHA', 'GHS', '+233', 'Ghana'],
+ ['GI', 'GIB', 'GIP', '+350', 'Gibraltar'],
+ ['GL', 'GRL', 'DKK', '+299', 'Greenland'],
+ ['GM', 'GMB', 'GMD', '+220', 'Gambia, The'],
+ ['GN', 'GIN', 'GNF', '+224', 'Guinea'],
+ ['GP', 'GLP', 'EUR', '+590', 'Guadeloupe'],
+ ['GQ', 'GNQ', 'XAF', '+240', 'Equatorial Guinea'],
+ ['GR', 'GRC', 'EUR', '+30', 'Greece'],
+ ['GS', 'SGS', nil, nil, 'South Georgia and the South Sandwich Islands'],
+ ['GT', 'GTM', 'GTQ', '+502', 'Guatemala'],
+ ['GU', 'GUM', 'USD', '+1-671', 'Guam'],
+ ['GW', 'GNB', 'XOF', '+245', 'Guinea-Bissau'],
+ ['GY', 'GUY', 'GYD', '+592', 'Guyana'],
+ ['HK', 'HKG', 'HKD', '+852', 'Hong Kong'],
+ ['HM', 'HMD', nil, nil, 'Heard Island and McDonald Islands'],
+ ['HN', 'HND', 'HNL', '+504', 'Honduras'],
+ ['HR', 'HRV', 'HRK', '+385', 'Croatia'],
+ ['HT', 'HTI', 'HTG', '+509', 'Haiti'],
+ ['HU', 'HUN', 'HUF', '+36', 'Hungary'],
+ ['ID', 'IDN', 'IDR', '+62', 'Indonesia'],
+ ['IE', 'IRL', 'EUR', '+353', 'Ireland'],
+ ['IL', 'ISR', 'ILS', '+972', 'Israel'],
+ ['IM', 'IMN', 'IMP', '+44', 'Isle of Man'],
+ ['IN', 'IND', 'INR', '+91', 'India'],
+ ['IO', 'IOT', nil, '+246', 'British Indian Ocean Territory'],
+ ['IQ', 'IRQ', 'IQD', '+964', 'Iraq'],
+ ['IR', 'IRN', 'IRR', '+98', 'Iran'],
+ ['IS', 'ISL', 'ISK', '+354', 'Iceland'],
+ ['IT', 'ITA', 'EUR', '+39', 'Italy'],
+ ['JE', 'JEY', 'JEP', '+44', 'Jersey'],
+ ['JM', 'JAM', 'JMD', '+1-876', 'Jamaica'],
+ ['JO', 'JOR', 'JOD', '+962', 'Jordan'],
+ ['JP', 'JPN', 'JPY', '+81', 'Japan'],
+ ['KE', 'KEN', 'KES', '+254', 'Kenya'],
+ ['KG', 'KGZ', 'KGS', '+996', 'Kyrgyzstan'],
+ ['KH', 'KHM', 'KHR', '+855', 'Cambodia'],
+ ['KI', 'KIR', 'AUD', '+686', 'Kiribati'],
+ ['KM', 'COM', 'KMF', '+269', 'Comoros'],
+ ['KN', 'KNA', 'XCD', '+1-869', 'Saint Kitts and Nevis'],
+ ['KP', 'PRK', 'KPW', '+850', 'Korea, Democratic People''s Republic of (North Korea)'],
+ ['KR', 'KOR', 'KRW', '+82', 'Korea, Republic of (South Korea)'],
+ ['KW', 'KWT', 'KWD', '+965', 'Kuwait'],
+ ['KY', 'CYM', 'KYD', '+1-345', 'Cayman Islands'],
+ ['KZ', 'KAZ', 'KZT', '+7', 'Kazakhstan'],
+ ['LA', 'LAO', 'LAK', '+856', 'Laos'],
+ ['LB', 'LBN', 'LBP', '+961', 'Lebanon'],
+ ['LC', 'LCA', 'XCD', '+1-758', 'Saint Lucia'],
+ ['LI', 'LIE', 'CHF', '+423', 'Liechtenstein'],
+ ['LK', 'LKA', 'LKR', '+94', 'Sri Lanka'],
+ ['LR', 'LBR', 'LRD', '+231', 'Liberia'],
+ ['LS', 'LSO', 'LSL', '+266', 'Lesotho'],
+ ['LT', 'LTU', 'LTL', '+370', 'Lithuania'],
+ ['LU', 'LUX', 'EUR', '+352', 'Luxembourg'],
+ ['LV', 'LVA', 'LVL', '+371', 'Latvia'],
+ ['LY', 'LBY', 'LYD', '+218', 'Libya'],
+ ['MA', 'MAR', 'MAD', '+212', 'Morocco'],
+ ['MC', 'MCO', 'EUR', '+377', 'Monaco'],
+ ['MD', 'MDA', 'MDL', '+373', 'Moldova'],
+ ['ME', 'MNE', 'EUR', '+382', 'Montenegro'],
+ ['MG', 'MDG', 'MGA', '+261', 'Madagascar'],
+ ['MH', 'MHL', 'USD', '+692', 'Marshall Islands'],
+ ['MK', 'MKD', 'MKD', '+389', 'Macedonia'],
+ ['ML', 'MLI', 'XOF', '+223', 'Mali'],
+ ['MM', 'MMR', 'MMK', '+95', 'Myanmar (Burma)'],
+ ['MN', 'MNG', 'MNT', '+976', 'Mongolia'],
+ ['MO', 'MAC', 'MOP', '+853', 'Macau'],
+ ['MP', 'MNP', 'USD', '+1-670', 'Northern Mariana Islands'],
+ ['MQ', 'MTQ', 'EUR', '+596', 'Martinique'],
+ ['MR', 'MRT', 'MRO', '+222', 'Mauritania'],
+ ['MS', 'MSR', 'XCD', '+1-664', 'Montserrat'],
+ ['MT', 'MLT', 'MTL', '+356', 'Malta'],
+ ['MU', 'MUS', 'MUR', '+230', 'Mauritius'],
+ ['MV', 'MDV', 'MVR', '+960', 'Maldives'],
+ ['MW', 'MWI', 'MWK', '+265', 'Malawi'],
+ ['MX', 'MEX', 'MXN', '+52', 'Mexico'],
+ ['MY', 'MYS', 'MYR', '+60', 'Malaysia'],
+ ['MZ', 'MOZ', 'MZM', '+258', 'Mozambique'],
+ ['NA', 'NAM', 'NAD', '+264', 'Namibia'],
+ ['NC', 'NCL', 'XPF', '+687', 'New Caledonia'],
+ ['NE', 'NER', 'XOF', '+227', 'Niger'],
+ ['NF', 'NFK', 'AUD', '+672', 'Norfolk Island'],
+ ['NG', 'NGA', 'NGN', '+234', 'Nigeria'],
+ ['NI', 'NIC', 'NIO', '+505', 'Nicaragua'],
+ ['NL', 'NLD', 'EUR', '+31', 'Netherlands'],
+ ['NO', 'NOR', 'NOK', '+47', 'Norway'],
+ ['NP', 'NPL', 'NPR', '+977', 'Nepal'],
+ ['NR', 'NRU', 'AUD', '+674', 'Nauru'],
+ ['NU', 'NIU', 'NZD', '+683', 'Niue'],
+ ['NZ', 'NZL', 'NZD', '+64', 'New Zealand'],
+ ['OM', 'OMN', 'OMR', '+968', 'Oman'],
+ ['PA', 'PAN', 'PAB', '+507', 'Panama'],
+ ['PE', 'PER', 'PEN', '+51', 'Peru'],
+ ['PF', 'PYF', 'XPF', '+689', 'French Polynesia'],
+ ['PF', 'PYF', nil, nil, 'Clipperton Island'],
+ ['PG', 'PNG', 'PGK', '+675', 'Papua New Guinea'],
+ ['PH', 'PHL', 'PHP', '+63', 'Philippines'],
+ ['PK', 'PAK', 'PKR', '+92', 'Pakistan'],
+ ['PL', 'POL', 'PLN', '+48', 'Poland'],
+ ['PM', 'SPM', 'EUR', '+508', 'Saint Pierre and Miquelon'],
+ ['PN', 'PCN', 'NZD', nil, 'Pitcairn Islands'],
+ ['PR', 'PRI', 'USD', '+1', 'Puerto Rico'],
+ ['PS', 'PSE', 'ILS', '+970', 'Palestinian Territories (Gaza Strip and West Bank)'],
+ ['PT', 'PRT', 'EUR', '+351', 'Portugal'],
+ ['PW', 'PLW', 'USD', '+680', 'Palau'],
+ ['PY', 'PRY', 'PYG', '+595', 'Paraguay'],
+ ['QA', 'QAT', 'QAR', '+974', 'Qatar'],
+ ['RE', 'REU', 'EUR', '+262', 'Reunion'],
+ ['RO', 'ROU', 'RON', '+40', 'Romania'],
+ ['RS', 'SRB', 'RSD', '+381', 'Serbia'],
+ ['RU', 'RUS', 'RUB', '+7', 'Russia'],
+ ['RW', 'RWA', 'RWF', '+250', 'Rwanda'],
+ ['SA', 'SAU', 'SAR', '+966', 'Saudi Arabia'],
+ ['SB', 'SLB', 'SBD', '+677', 'Solomon Islands'],
+ ['SC', 'SYC', 'SCR', '+248', 'Seychelles'],
+ ['SD', 'SDN', 'SDG', '+249', 'Sudan'],
+ ['SE', 'SWE', 'SEK', '+46', 'Sweden'],
+ ['SG', 'SGP', 'SGD', '+65', 'Singapore'],
+ ['SH', 'SHN', 'SHP', '+290', 'Saint Helena'],
+ ['SI', 'SVN', 'EUR', '+386', 'Slovenia'],
+ ['SJ', 'SJM', 'NOK', '+47', 'Svalbard'],
+ ['SK', 'SVK', 'SKK', '+421', 'Slovakia'],
+ ['SL', 'SLE', 'SLL', '+232', 'Sierra Leone'],
+ ['SM', 'SMR', 'EUR', '+378', 'San Marino'],
+ ['SN', 'SEN', 'XOF', '+221', 'Senegal'],
+ ['SO', 'SOM', 'SOS', '+252', 'Somalia'],
+ ['SR', 'SUR', 'SRD', '+597', 'Suriname'],
+ ['ST', 'STP', 'STD', '+239', 'Sao Tome and Principe'],
+ ['SV', 'SLV', 'USD', '+503', 'El Salvador'],
+ ['SY', 'SYR', 'SYP', '+963', 'Syria'],
+ ['SZ', 'SWZ', 'SZL', '+268', 'Swaziland'],
+ ['TA', 'TAA', 'SHP', '+290', 'Tristan da Cunha'],
+ ['TC', 'TCA', 'USD', '+1-649', 'Turks and Caicos Islands'],
+ ['TD', 'TCD', 'XAF', '+235', 'Chad'],
+ ['TF', 'ATF', nil, nil, 'French Southern and Antarctic Lands'],
+ ['TG', 'TGO', 'XOF', '+228', 'Togo'],
+ ['TH', 'THA', 'THB', '+66', 'Thailand'],
+ ['TJ', 'TJK', 'TJS', '+992', 'Tajikistan'],
+ ['TK', 'TKL', 'NZD', '+690', 'Tokelau'],
+ ['TL', 'TLS', 'USD', '+670', 'Timor-Leste (East Timor)'],
+ ['TM', 'TKM', 'TMM', '+993', 'Turkmenistan'],
+ ['TN', 'TUN', 'TND', '+216', 'Tunisia'],
+ ['TO', 'TON', 'TOP', '+676', 'Tonga'],
+ ['TR', 'TUR', 'TRY', '+90', 'Turkey'],
+ ['TT', 'TTO', 'TTD', '+1-868', 'Trinidad and Tobago'],
+ ['TV', 'TUV', 'AUD', '+688', 'Tuvalu'],
+ ['TW', 'TWN', 'TWD', '+886', 'China, Republic of (Taiwan)'],
+ ['TZ', 'TZA', 'TZS', '+255', 'Tanzania'],
+ ['UA', 'UKR', 'UAH', '+380', 'Ukraine'],
+ ['UG', 'UGA', 'UGX', '+256', 'Uganda'],
+ ['UM', 'UMI', nil, nil, 'Midway Islands'],
+ ['US', 'USA', 'USD', '+1', 'United States'],
+ ['UY', 'URY', 'UYU', '+598', 'Uruguay'],
+ ['UZ', 'UZB', 'UZS', '+998', 'Uzbekistan'],
+ ['VA', 'VAT', 'EUR', '+379', 'Vatican City'],
+ ['VC', 'VCT', 'XCD', '+1-784', 'Saint Vincent and the Grenadines'],
+ ['VE', 'VEN', 'VEB', '+58', 'Venezuela'],
+ ['VG', 'VGB', 'USD', '+1-284', 'British Virgin Islands'],
+ ['VI', 'VIR', 'USD', '+1-340', 'U.S. Virgin Islands'],
+ ['VN', 'VNM', 'VND', '+84', 'Vietnam'],
+ ['VU', 'VUT', 'VUV', '+678', 'Vanuatu'],
+ ['WF', 'WLF', 'XPF', '+681', 'Wallis and Futuna'],
+ ['WS', 'WSM', 'WST', '+685', 'Samoa'],
+ ['YE', 'YEM', 'YER', '+967', 'Yemen'],
+ ['YT', 'MYT', 'EUR', '+262', 'Mayotte'],
+ ['ZA', 'ZAF', 'ZAR', '+27', 'South Africa'],
+ ['ZM', 'ZMB', 'ZMK', '+260', 'Zambia'],
+ ['ZW', 'ZWE', 'ZWD', '+263', 'Zimbabwe']
+]
View
47 lib/uncharted/country.rb
@@ -1,48 +1,45 @@
+
+require 'uncharted/countries_data'
+
module Uncharted
class Country
- attr_reader :alpha2, :alpha3
-
- @countries = {}
+ attr_reader :alpha2, :alpha3, :currency, :phone, :name
- def initialize(params)
- @alpha2 = params[:alpha2]
- @alpha3 = params[:alpha3]
- @name = params[:name]
- @names = params[:names] || {}
- Country.register(self)
- end
-
- def name(language = nil)
- @names[language] || @name
+ def initialize(args)
+ @alpha2, @alpha3, @currency, @phone, @name = args
end
def to_s
@alpha2
end
+
+ def to_sym
+ @sym ||= @alpha2.downcase.to_sym
+ end
def self.count
- @countries.count
+ countries.count
end
def self.find(alpha2)
- @countries[alpha2]
+ countries[alpha2]
end
- def self.load(source)
- if source.is_a? Array
- source.each do |data|
- country = Country.new(data)
- @countries[country.alpha2] = country
- end
- end
- end
protected
- def self.register(country)
- @countries[country.alpha2] = country
+ def self.countries
+ @countries ||= {}
+ end
+
+ def self.load(countries_data)
+ countries_data.each do |data|
+ countries[data.first] = Country.new(data)
+ end
end
+
+ load(COUNTRIES_DATA)
end
end
View
10 lib/uncharted/country_data.rb
@@ -1,10 +0,0 @@
-
-require 'country'
-
-Uncharted::Country.new(alpha2: 'AR', alpha3: 'ARG',
- names: {en: 'Argentina', pt: 'Argentina'},
- territories: {
- 'BA': {names: {en: 'Buenos Aires'}
- }
- )
-Uncharted::Country.new(alpha2: 'BR', alpha3: 'BRA', names: {en: 'Brazil', pt: 'Brasil')
View
253 lib/uncharted/data/countries_data.rb
@@ -0,0 +1,253 @@
+# encoding: utf-8
+
+COUNTRIES_DATA = {
+ # alpha2 => [alpha3, currency, phone, name]
+ 'AC' => ['ASC', 'SHP', '+247', 'Ascension'],
+ 'AD' => ['AND', 'EUR', '+376', 'Andorra'],
+ 'AE' => ['ARE', 'AED', '+971', 'United Arab Emirates'],
+ 'AF' => ['AFG', 'AFN', '+93', 'Afghanistan'],
+ 'AG' => ['ATG', 'XCD', '+1-268', 'Antigua and Barbuda'],
+ 'AI' => ['AIA', 'XCD', '+1-264', 'Anguilla'],
+ 'AL' => ['ALB', 'ALL', '+355', 'Albania'],
+ 'AM' => ['ARM', 'AMD', '+374', 'Armenia'],
+ 'AN' => ['ANT', 'ANG', '+599', 'Netherlands Antilles'],
+ 'AO' => ['AGO', 'AOA', '+244', 'Angola'],
+ 'AQ' => ['ATA', nil, nil, 'Antarctica'],
+ 'AR' => ['ARG', 'ARS', '+54', 'Argentina'],
+ 'AS' => ['ASM', 'USD', '+1-684', 'American Samoa'],
+ 'AT' => ['AUT', 'EUR', '+43', 'Austria'],
+ 'AU' => ['AUS', 'AUD', '+61', 'Australia'],
+ 'AW' => ['ABW', 'AWG', '+297', 'Aruba'],
+ 'AX' => ['ALA', 'EUR', '+358-18', 'Aland'],
+ 'AZ' => ['AZE', 'AZN', '+994', 'Azerbaijan'],
+ 'BA' => ['BIH', 'BAM', '+387', 'Bosnia and Herzegovina'],
+ 'BB' => ['BRB', 'BBD', '+1-246', 'Barbados'],
+ 'BD' => ['BGD', 'BDT', '+880', 'Bangladesh'],
+ 'BE' => ['BEL', 'EUR', '+32', 'Belgium'],
+ 'BF' => ['BFA', 'XOF', '+226', 'Burkina Faso'],
+ 'BG' => ['BGR', 'BGN', '+359', 'Bulgaria'],
+ 'BH' => ['BHR', 'BHD', '+973', 'Bahrain'],
+ 'BI' => ['BDI', 'BIF', '+257', 'Burundi'],
+ 'BJ' => ['BEN', 'XOF', '+229', 'Benin'],
+ 'BM' => ['BMU', 'BMD', '+1-441', 'Bermuda'],
+ 'BN' => ['BRN', 'BND', '+673', 'Brunei'],
+ 'BO' => ['BOL', 'BOB', '+591', 'Bolivia'],
+ 'BR' => ['BRA', 'BRL', '+55', 'Brazil'],
+ 'BS' => ['BHS', 'BSD', '+1-242', 'Bahamas, The'],
+ 'BT' => ['BTN', 'BTN', '+975', 'Bhutan'],
+ 'BV' => ['BVT', nil, nil, 'Bouvet Island'],
+ 'BW' => ['BWA', 'BWP', '+267', 'Botswana'],
+ 'BY' => ['BLR', 'BYR', '+375', 'Belarus'],
+ 'BZ' => ['BLZ', 'BZD', '+501', 'Belize'],
+ 'CA' => ['CAN', 'CAD', '+1', 'Canada'],
+ 'CC' => ['CCK', 'AUD', '+61', 'Cocos (Keeling) Islands'],
+ 'CD' => ['COD', 'CDF', '+243', 'Congo, Democratic Republic of the (Congo ヨ Kinshasa)'],
+ 'CF' => ['CAF', 'XAF', '+236', 'Central African Republic'],
+ 'CG' => ['COG', 'XAF', '+242', 'Congo, Republic of the (Congo ヨ Brazzaville)'],
+ 'CH' => ['CHE', 'CHF', '+41', 'Switzerland'],
+ 'CI' => ['CIV', 'XOF', '+225', 'Cote d''Ivoire (Ivory Coast)'],
+ 'CK' => ['COK', 'NZD', '+682', 'Cook Islands'],
+ 'CL' => ['CHL', 'CLP', '+56', 'Chile'],
+ 'CM' => ['CMR', 'XAF', '+237', 'Cameroon'],
+ 'CN' => ['CHN', 'CNY', '+86', 'China, People''s Republic of'],
+ 'CO' => ['COL', 'COP', '+57', 'Colombia'],
+ 'CR' => ['CRI', 'CRC', '+506', 'Costa Rica'],
+ 'CS' => ['SCG', 'CSD and EUR', '+381', 'Kosovo'],
+ 'CU' => ['CUB', 'CUP', '+53', 'Cuba'],
+ 'CV' => ['CPV', 'CVE', '+238', 'Cape Verde'],
+ 'CX' => ['CXR', 'AUD', '+61', 'Christmas Island'],
+ 'CY' => ['CYP', 'CYP', '+357', 'Cyprus'],
+ 'CZ' => ['CZE', 'CZK', '+420', 'Czech Republic'],
+ 'DE' => ['DEU', 'EUR', '+49', 'Germany'],
+ 'DJ' => ['DJI', 'DJF', '+253', 'Djibouti'],
+ 'DK' => ['DNK', 'DKK', '+45', 'Denmark'],
+ 'DM' => ['DMA', 'XCD', '+1-767', 'Dominica'],
+ 'DO' => ['DOM', 'DOP', '+1', 'Dominican Republic'],
+ 'DZ' => ['DZA', 'DZD', '+213', 'Algeria'],
+ 'EC' => ['ECU', 'USD', '+593', 'Ecuador'],
+ 'EE' => ['EST', 'EEK', '+372', 'Estonia'],
+ 'EG' => ['EGY', 'EGP', '+20', 'Egypt'],
+ 'EH' => ['ESH', 'MAD', '+212', 'Western Sahara'],
+ 'ER' => ['ERI', 'ERN', '+291', 'Eritrea'],
+ 'ES' => ['ESP', 'EUR', '+34', 'Spain'],
+ 'ET' => ['ETH', 'ETB', '+251', 'Ethiopia'],
+ 'FI' => ['FIN', 'EUR', '+358', 'Finland'],
+ 'FJ' => ['FJI', 'FJD', '+679', 'Fiji'],
+ 'FK' => ['FLK', 'FKP', '+500', 'Falkland Islands (Islas Malvinas)'],
+ 'FM' => ['FSM', 'USD', '+691', 'Micronesia'],
+ 'FO' => ['FRO', 'DKK', '+298', 'Faroe Islands'],
+ 'FR' => ['FRA', 'EUR', '+33', 'France'],
+ 'GA' => ['GAB', 'XAF', '+241', 'Gabon'],
+ 'GB' => ['GBR', 'GBP', '+44', 'United Kingdom'],
+ 'GD' => ['GRD', 'XCD', '+1-473', 'Grenada'],
+ 'GE' => ['GEO', 'GEL', '+995', 'Georgia'],
+ 'GF' => ['GUF', 'EUR', '+594', 'French Guiana'],
+ 'GG' => ['GGY', 'GGP', '+44', 'Guernsey'],
+ 'GH' => ['GHA', 'GHS', '+233', 'Ghana'],
+ 'GI' => ['GIB', 'GIP', '+350', 'Gibraltar'],
+ 'GL' => ['GRL', 'DKK', '+299', 'Greenland'],
+ 'GM' => ['GMB', 'GMD', '+220', 'Gambia, The'],
+ 'GN' => ['GIN', 'GNF', '+224', 'Guinea'],
+ 'GP' => ['GLP', 'EUR', '+590', 'Guadeloupe'],
+ 'GQ' => ['GNQ', 'XAF', '+240', 'Equatorial Guinea'],
+ 'GR' => ['GRC', 'EUR', '+30', 'Greece'],
+ 'GS' => ['SGS', nil, nil, 'South Georgia and the South Sandwich Islands'],
+ 'GT' => ['GTM', 'GTQ', '+502', 'Guatemala'],
+ 'GU' => ['GUM', 'USD', '+1-671', 'Guam'],
+ 'GW' => ['GNB', 'XOF', '+245', 'Guinea-Bissau'],
+ 'GY' => ['GUY', 'GYD', '+592', 'Guyana'],
+ 'HK' => ['HKG', 'HKD', '+852', 'Hong Kong'],
+ 'HM' => ['HMD', nil, nil, 'Heard Island and McDonald Islands'],
+ 'HN' => ['HND', 'HNL', '+504', 'Honduras'],
+ 'HR' => ['HRV', 'HRK', '+385', 'Croatia'],
+ 'HT' => ['HTI', 'HTG', '+509', 'Haiti'],
+ 'HU' => ['HUN', 'HUF', '+36', 'Hungary'],
+ 'ID' => ['IDN', 'IDR', '+62', 'Indonesia'],
+ 'IE' => ['IRL', 'EUR', '+353', 'Ireland'],
+ 'IL' => ['ISR', 'ILS', '+972', 'Israel'],
+ 'IM' => ['IMN', 'IMP', '+44', 'Isle of Man'],
+ 'IN' => ['IND', 'INR', '+91', 'India'],
+ 'IO' => ['IOT', nil, '+246', 'British Indian Ocean Territory'],
+ 'IQ' => ['IRQ', 'IQD', '+964', 'Iraq'],
+ 'IR' => ['IRN', 'IRR', '+98', 'Iran'],
+ 'IS' => ['ISL', 'ISK', '+354', 'Iceland'],
+ 'IT' => ['ITA', 'EUR', '+39', 'Italy'],
+ 'JE' => ['JEY', 'JEP', '+44', 'Jersey'],
+ 'JM' => ['JAM', 'JMD', '+1-876', 'Jamaica'],
+ 'JO' => ['JOR', 'JOD', '+962', 'Jordan'],
+ 'JP' => ['JPN', 'JPY', '+81', 'Japan'],
+ 'KE' => ['KEN', 'KES', '+254', 'Kenya'],
+ 'KG' => ['KGZ', 'KGS', '+996', 'Kyrgyzstan'],
+ 'KH' => ['KHM', 'KHR', '+855', 'Cambodia'],
+ 'KI' => ['KIR', 'AUD', '+686', 'Kiribati'],
+ 'KM' => ['COM', 'KMF', '+269', 'Comoros'],
+ 'KN' => ['KNA', 'XCD', '+1-869', 'Saint Kitts and Nevis'],
+ 'KP' => ['PRK', 'KPW', '+850', 'Korea, Democratic People''s Republic of (North Korea)'],
+ 'KR' => ['KOR', 'KRW', '+82', 'Korea, Republic of (South Korea)'],
+ 'KW' => ['KWT', 'KWD', '+965', 'Kuwait'],
+ 'KY' => ['CYM', 'KYD', '+1-345', 'Cayman Islands'],
+ 'KZ' => ['KAZ', 'KZT', '+7', 'Kazakhstan'],
+ 'LA' => ['LAO', 'LAK', '+856', 'Laos'],
+ 'LB' => ['LBN', 'LBP', '+961', 'Lebanon'],
+ 'LC' => ['LCA', 'XCD', '+1-758', 'Saint Lucia'],
+ 'LI' => ['LIE', 'CHF', '+423', 'Liechtenstein'],
+ 'LK' => ['LKA', 'LKR', '+94', 'Sri Lanka'],
+ 'LR' => ['LBR', 'LRD', '+231', 'Liberia'],
+ 'LS' => ['LSO', 'LSL', '+266', 'Lesotho'],
+ 'LT' => ['LTU', 'LTL', '+370', 'Lithuania'],
+ 'LU' => ['LUX', 'EUR', '+352', 'Luxembourg'],
+ 'LV' => ['LVA', 'LVL', '+371', 'Latvia'],
+ 'LY' => ['LBY', 'LYD', '+218', 'Libya'],
+ 'MA' => ['MAR', 'MAD', '+212', 'Morocco'],
+ 'MC' => ['MCO', 'EUR', '+377', 'Monaco'],
+ 'MD' => ['MDA', 'MDL', '+373', 'Moldova'],
+ 'ME' => ['MNE', 'EUR', '+382', 'Montenegro'],
+ 'MG' => ['MDG', 'MGA', '+261', 'Madagascar'],
+ 'MH' => ['MHL', 'USD', '+692', 'Marshall Islands'],
+ 'MK' => ['MKD', 'MKD', '+389', 'Macedonia'],
+ 'ML' => ['MLI', 'XOF', '+223', 'Mali'],
+ 'MM' => ['MMR', 'MMK', '+95', 'Myanmar (Burma)'],
+ 'MN' => ['MNG', 'MNT', '+976', 'Mongolia'],
+ 'MO' => ['MAC', 'MOP', '+853', 'Macau'],
+ 'MP' => ['MNP', 'USD', '+1-670', 'Northern Mariana Islands'],
+ 'MQ' => ['MTQ', 'EUR', '+596', 'Martinique'],
+ 'MR' => ['MRT', 'MRO', '+222', 'Mauritania'],
+ 'MS' => ['MSR', 'XCD', '+1-664', 'Montserrat'],
+ 'MT' => ['MLT', 'MTL', '+356', 'Malta'],
+ 'MU' => ['MUS', 'MUR', '+230', 'Mauritius'],
+ 'MV' => ['MDV', 'MVR', '+960', 'Maldives'],
+ 'MW' => ['MWI', 'MWK', '+265', 'Malawi'],
+ 'MX' => ['MEX', 'MXN', '+52', 'Mexico'],
+ 'MY' => ['MYS', 'MYR', '+60', 'Malaysia'],
+ 'MZ' => ['MOZ', 'MZM', '+258', 'Mozambique'],
+ 'NA' => ['NAM', 'NAD', '+264', 'Namibia'],
+ 'NC' => ['NCL', 'XPF', '+687', 'New Caledonia'],
+ 'NE' => ['NER', 'XOF', '+227', 'Niger'],
+ 'NF' => ['NFK', 'AUD', '+672', 'Norfolk Island'],
+ 'NG' => ['NGA', 'NGN', '+234', 'Nigeria'],
+ 'NI' => ['NIC', 'NIO', '+505', 'Nicaragua'],
+ 'NL' => ['NLD', 'EUR', '+31', 'Netherlands'],
+ 'NO' => ['NOR', 'NOK', '+47', 'Norway'],
+ 'NP' => ['NPL', 'NPR', '+977', 'Nepal'],
+ 'NR' => ['NRU', 'AUD', '+674', 'Nauru'],
+ 'NU' => ['NIU', 'NZD', '+683', 'Niue'],
+ 'NZ' => ['NZL', 'NZD', '+64', 'New Zealand'],
+ 'OM' => ['OMN', 'OMR', '+968', 'Oman'],
+ 'PA' => ['PAN', 'PAB', '+507', 'Panama'],
+ 'PE' => ['PER', 'PEN', '+51', 'Peru'],
+ 'PF' => ['PYF', 'XPF', '+689', 'French Polynesia'],
+ 'PF' => ['PYF', nil, nil, 'Clipperton Island'],
+ 'PG' => ['PNG', 'PGK', '+675', 'Papua New Guinea'],
+ 'PH' => ['PHL', 'PHP', '+63', 'Philippines'],
+ 'PK' => ['PAK', 'PKR', '+92', 'Pakistan'],
+ 'PL' => ['POL', 'PLN', '+48', 'Poland'],
+ 'PM' => ['SPM', 'EUR', '+508', 'Saint Pierre and Miquelon'],
+ 'PN' => ['PCN', 'NZD', nil, 'Pitcairn Islands'],
+ 'PR' => ['PRI', 'USD', '+1', 'Puerto Rico'],
+ 'PS' => ['PSE', 'ILS', '+970', 'Palestinian Territories (Gaza Strip and West Bank)'],
+ 'PT' => ['PRT', 'EUR', '+351', 'Portugal'],
+ 'PW' => ['PLW', 'USD', '+680', 'Palau'],
+ 'PY' => ['PRY', 'PYG', '+595', 'Paraguay'],
+ 'QA' => ['QAT', 'QAR', '+974', 'Qatar'],
+ 'RE' => ['REU', 'EUR', '+262', 'Reunion'],
+ 'RO' => ['ROU', 'RON', '+40', 'Romania'],
+ 'RS' => ['SRB', 'RSD', '+381', 'Serbia'],
+ 'RU' => ['RUS', 'RUB', '+7', 'Russia'],
+ 'RW' => ['RWA', 'RWF', '+250', 'Rwanda'],
+ 'SA' => ['SAU', 'SAR', '+966', 'Saudi Arabia'],
+ 'SB' => ['SLB', 'SBD', '+677', 'Solomon Islands'],
+ 'SC' => ['SYC', 'SCR', '+248', 'Seychelles'],
+ 'SD' => ['SDN', 'SDG', '+249', 'Sudan'],
+ 'SE' => ['SWE', 'SEK', '+46', 'Sweden'],
+ 'SG' => ['SGP', 'SGD', '+65', 'Singapore'],
+ 'SH' => ['SHN', 'SHP', '+290', 'Saint Helena'],
+ 'SI' => ['SVN', 'EUR', '+386', 'Slovenia'],
+ 'SJ' => ['SJM', 'NOK', '+47', 'Svalbard'],
+ 'SK' => ['SVK', 'SKK', '+421', 'Slovakia'],
+ 'SL' => ['SLE', 'SLL', '+232', 'Sierra Leone'],
+ 'SM' => ['SMR', 'EUR', '+378', 'San Marino'],
+ 'SN' => ['SEN', 'XOF', '+221', 'Senegal'],
+ 'SO' => ['SOM', 'SOS', '+252', 'Somalia'],
+ 'SR' => ['SUR', 'SRD', '+597', 'Suriname'],
+ 'ST' => ['STP', 'STD', '+239', 'Sao Tome and Principe'],
+ 'SV' => ['SLV', 'USD', '+503', 'El Salvador'],
+ 'SY' => ['SYR', 'SYP', '+963', 'Syria'],
+ 'SZ' => ['SWZ', 'SZL', '+268', 'Swaziland'],
+ 'TA' => ['TAA', 'SHP', '+290', 'Tristan da Cunha'],
+ 'TC' => ['TCA', 'USD', '+1-649', 'Turks and Caicos Islands'],
+ 'TD' => ['TCD', 'XAF', '+235', 'Chad'],
+ 'TF' => ['ATF', nil, nil, 'French Southern and Antarctic Lands'],
+ 'TG' => ['TGO', 'XOF', '+228', 'Togo'],
+ 'TH' => ['THA', 'THB', '+66', 'Thailand'],
+ 'TJ' => ['TJK', 'TJS', '+992', 'Tajikistan'],
+ 'TK' => ['TKL', 'NZD', '+690', 'Tokelau'],
+ 'TL' => ['TLS', 'USD', '+670', 'Timor-Leste (East Timor)'],
+ 'TM' => ['TKM', 'TMM', '+993', 'Turkmenistan'],
+ 'TN' => ['TUN', 'TND', '+216', 'Tunisia'],
+ 'TO' => ['TON', 'TOP', '+676', 'Tonga'],
+ 'TR' => ['TUR', 'TRY', '+90', 'Turkey'],
+ 'TT' => ['TTO', 'TTD', '+1-868', 'Trinidad and Tobago'],
+ 'TV' => ['TUV', 'AUD', '+688', 'Tuvalu'],
+ 'TW' => ['TWN', 'TWD', '+886', 'China, Republic of (Taiwan)'],
+ 'TZ' => ['TZA', 'TZS', '+255', 'Tanzania'],
+ 'UA' => ['UKR', 'UAH', '+380', 'Ukraine'],
+ 'UG' => ['UGA', 'UGX', '+256', 'Uganda'],
+ 'UM' => ['UMI', nil, nil, 'Midway Islands'],
+ 'US' => ['USA', 'USD', '+1', 'United States'],
+ 'UY' => ['URY', 'UYU', '+598', 'Uruguay'],
+ 'UZ' => ['UZB', 'UZS', '+998', 'Uzbekistan'],
+ 'VA' => ['VAT', 'EUR', '+379', 'Vatican City'],
+ 'VC' => ['VCT', 'XCD', '+1-784', 'Saint Vincent and the Grenadines'],
+ 'VE' => ['VEN', 'VEB', '+58', 'Venezuela'],
+ 'VG' => ['VGB', 'USD', '+1-284', 'British Virgin Islands'],
+ 'VI' => ['VIR', 'USD', '+1-340', 'U.S. Virgin Islands'],
+ 'VN' => ['VNM', 'VND', '+84', 'Vietnam'],
+ 'VU' => ['VUT', 'VUV', '+678', 'Vanuatu'],
+ 'WF' => ['WLF', 'XPF', '+681', 'Wallis and Futuna'],
+ 'WS' => ['WSM', 'WST', '+685', 'Samoa'],
+ 'YE' => ['YEM', 'YER', '+967', 'Yemen'],
+ 'YT' => ['MYT', 'EUR', '+262', 'Mayotte'],
+ 'ZA' => ['ZAF', 'ZAR', '+27', 'South Africa'],
+ 'ZM' => ['ZMB', 'ZMK', '+260', 'Zambia'],
+ 'ZW' => ['ZWE', 'ZWD', '+263', 'Zimbabwe']
+}
View
254 lib/uncharted/locale/countries.rb
@@ -0,0 +1,254 @@
+# encoding: utf-8
+
+COUNTRIES_DATA = {
+ # alpha2 => [alpha3, currency, phone, name]
+ 'AC' => ['ASC', 'SHP', '+247', 'Ascension'],
+ 'AD' => ['AND', 'EUR', '+376', 'Andorra'],
+ 'AE' => ['ARE', 'AED', '+971', 'United Arab Emirates'],
+ 'AF' => ['AFG', 'AFN', '+93', 'Afghanistan'],
+ 'AG' => ['ATG', 'XCD', '+1-268', 'Antigua and Barbuda'],
+ 'AI' => ['AIA', 'XCD', '+1-264', 'Anguilla'],
+ 'AL' => ['ALB', 'ALL', '+355', 'Albania'],
+ 'AM' => ['ARM', 'AMD', '+374', 'Armenia'],
+ 'AN' => ['ANT', 'ANG', '+599', 'Netherlands Antilles'],
+ 'AO' => ['AGO', 'AOA', '+244', 'Angola'],
+ 'AQ' => ['ATA', nil, nil, 'Antarctica'],
+ 'AR' => ['ARG', 'ARS', '+54', 'Argentina'],
+ 'AS' => ['ASM', 'USD', '+1-684', 'American Samoa'],
+ 'AT' => ['AUT', 'EUR', '+43', 'Austria'],
+ 'AU' => ['AUS', 'AUD', '+61', 'Australia'],
+ 'AW' => ['ABW', 'AWG', '+297', 'Aruba'],
+ 'AX' => ['ALA', 'EUR', '+358-18', 'Aland'],
+ 'AZ' => ['AZE', 'AZN', '+994', 'Azerbaijan'],
+ 'BA' => ['BIH', 'BAM', '+387', 'Bosnia and Herzegovina'],
+ 'BB' => ['BRB', 'BBD', '+1-246', 'Barbados'],
+ 'BD' => ['BGD', 'BDT', '+880', 'Bangladesh'],
+ 'BE' => ['BEL', 'EUR', '+32', 'Belgium'],
+ 'BF' => ['BFA', 'XOF', '+226', 'Burkina Faso'],
+ 'BG' => ['BGR', 'BGN', '+359', 'Bulgaria'],
+ 'BH' => ['BHR', 'BHD', '+973', 'Bahrain'],
+ 'BI' => ['BDI', 'BIF', '+257', 'Burundi'],
+ 'BJ' => ['BEN', 'XOF', '+229', 'Benin'],
+ 'BM' => ['BMU', 'BMD', '+1-441', 'Bermuda'],
+ 'BN' => ['BRN', 'BND', '+673', 'Brunei'],
+ 'BO' => ['BOL', 'BOB', '+591', 'Bolivia'],
+ 'BR' => ['BRA', 'BRL', '+55', 'Brazil'],
+ 'BS' => ['BHS', 'BSD', '+1-242', 'Bahamas, The'],
+ 'BT' => ['BTN', 'BTN', '+975', 'Bhutan'],
+ 'BV' => ['BVT', nil, nil, 'Bouvet Island'],
+ 'BW' => ['BWA', 'BWP', '+267', 'Botswana'],
+ 'BY' => ['BLR', 'BYR', '+375', 'Belarus'],
+ 'BZ' => ['BLZ', 'BZD', '+501', 'Belize'],
+ 'CA' => ['CAN', 'CAD', '+1', 'Canada'],
+ 'CC' => ['CCK', 'AUD', '+61', 'Cocos (Keeling) Islands'],
+ 'CD' => ['COD', 'CDF', '+243', 'Congo, Democratic Republic of the (Congo ヨ Kinshasa)'],
+ 'CF' => ['CAF', 'XAF', '+236', 'Central African Republic'],
+ 'CG' => ['COG', 'XAF', '+242', 'Congo, Republic of the (Congo ヨ Brazzaville)'],
+ 'CH' => ['CHE', 'CHF', '+41', 'Switzerland'],
+ 'CI' => ['CIV', 'XOF', '+225', 'Cote d''Ivoire (Ivory Coast)'],
+ 'CK' => ['COK', 'NZD', '+682', 'Cook Islands'],
+ 'CL' => ['CHL', 'CLP', '+56', 'Chile'],
+ 'CM' => ['CMR', 'XAF', '+237', 'Cameroon'],
+ 'CN' => ['CHN', 'CNY', '+86', 'China, People''s Republic of'],
+ 'CO' => ['COL', 'COP', '+57', 'Colombia'],
+ 'CR' => ['CRI', 'CRC', '+506', 'Costa Rica'],
+ 'CS' => ['SCG', 'CSD and EUR', '+381', 'Kosovo'],
+ 'CU' => ['CUB', 'CUP', '+53', 'Cuba'],
+ 'CV' => ['CPV', 'CVE', '+238', 'Cape Verde'],
+ 'CX' => ['CXR', 'AUD', '+61', 'Christmas Island'],
+ 'CY' => ['CYP', 'CYP', '+357', 'Cyprus'],
+ 'CZ' => ['CZE', 'CZK', '+420', 'Czech Republic'],
+ 'DE' => ['DEU', 'EUR', '+49', 'Germany'],
+ 'DJ' => ['DJI', 'DJF', '+253', 'Djibouti'],
+ 'DK' => ['DNK', 'DKK', '+45', 'Denmark'],
+ 'DM' => ['DMA', 'XCD', '+1-767', 'Dominica'],
+ 'DO' => ['DOM', 'DOP', '+1', 'Dominican Republic'],
+ 'DZ' => ['DZA', 'DZD', '+213', 'Algeria'],
+ 'EC' => ['ECU', 'USD', '+593', 'Ecuador'],
+ 'EE' => ['EST', 'EEK', '+372', 'Estonia'],
+ 'EG' => ['EGY', 'EGP', '+20', 'Egypt'],
+ 'EH' => ['ESH', 'MAD', '+212', 'Western Sahara'],
+ 'ER' => ['ERI', 'ERN', '+291', 'Eritrea'],
+ 'ES' => ['ESP', 'EUR', '+34', 'Spain'],
+ 'ET' => ['ETH', 'ETB', '+251', 'Ethiopia'],
+ 'FI' => ['FIN', 'EUR', '+358', 'Finland'],
+ 'FJ' => ['FJI', 'FJD', '+679', 'Fiji'],
+ 'FK' => ['FLK', 'FKP', '+500', 'Falkland Islands (Islas Malvinas)'],
+ 'FM' => ['FSM', 'USD', '+691', 'Micronesia'],
+ 'FO' => ['FRO', 'DKK', '+298', 'Faroe Islands'],
+ 'FR' => ['FRA', 'EUR', '+33', 'France'],
+ 'GA' => ['GAB', 'XAF', '+241', 'Gabon'],
+ 'GB' => ['GBR', 'GBP', '+44', 'United Kingdom'],
+ 'GD' => ['GRD', 'XCD', '+1-473', 'Grenada'],
+ 'GE' => ['GEO', 'GEL', '+995', 'Georgia'],
+ 'GF' => ['GUF', 'EUR', '+594', 'French Guiana'],
+ 'GG' => ['GGY', 'GGP', '+44', 'Guernsey'],
+ 'GH' => ['GHA', 'GHS', '+233', 'Ghana'],
+ 'GI' => ['GIB', 'GIP', '+350', 'Gibraltar'],
+ 'GL' => ['GRL', 'DKK', '+299', 'Greenland'],
+ 'GM' => ['GMB', 'GMD', '+220', 'Gambia, The'],
+ 'GN' => ['GIN', 'GNF', '+224', 'Guinea'],
+ 'GP' => ['GLP', 'EUR', '+590', 'Guadeloupe'],
+ 'GQ' => ['GNQ', 'XAF', '+240', 'Equatorial Guinea'],
+ 'GR' => ['GRC', 'EUR', '+30', 'Greece'],
+ 'GS' => ['SGS', nil, nil, 'South Georgia and the South Sandwich Islands'],
+ 'GT' => ['GTM', 'GTQ', '+502', 'Guatemala'],
+ 'GU' => ['GUM', 'USD', '+1-671', 'Guam'],
+ 'GW' => ['GNB', 'XOF', '+245', 'Guinea-Bissau'],
+ 'GY' => ['GUY', 'GYD', '+592', 'Guyana'],
+ 'HK' => ['HKG', 'HKD', '+852', 'Hong Kong'],
+ 'HM' => ['HMD', nil, nil, 'Heard Island and McDonald Islands'],
+ 'HN' => ['HND', 'HNL', '+504', 'Honduras'],
+ 'HR' => ['HRV', 'HRK', '+385', 'Croatia'],
+ 'HT' => ['HTI', 'HTG', '+509', 'Haiti'],
+ 'HU' => ['HUN', 'HUF', '+36', 'Hungary'],
+ 'ID' => ['IDN', 'IDR', '+62', 'Indonesia'],
+ 'IE' => ['IRL', 'EUR', '+353', 'Ireland'],
+ 'IL' => ['ISR', 'ILS', '+972', 'Israel'],
+ 'IM' => ['IMN', 'IMP', '+44', 'Isle of Man'],
+ 'IN' => ['IND', 'INR', '+91', 'India'],
+ 'IO' => ['IOT', nil, '+246', 'British Indian Ocean Territory'],
+ 'IQ' => ['IRQ', 'IQD', '+964', 'Iraq'],
+ 'IR' => ['IRN', 'IRR', '+98', 'Iran'],
+ 'IS' => ['ISL', 'ISK', '+354', 'Iceland'],
+ 'IT' => ['ITA', 'EUR', '+39', 'Italy'],
+ 'JE' => ['JEY', 'JEP', '+44', 'Jersey'],
+ 'JM' => ['JAM', 'JMD', '+1-876', 'Jamaica'],
+ 'JO' => ['JOR', 'JOD', '+962', 'Jordan'],
+ 'JP' => ['JPN', 'JPY', '+81', 'Japan'],
+ 'KE' => ['KEN', 'KES', '+254', 'Kenya'],
+ 'KG' => ['KGZ', 'KGS', '+996', 'Kyrgyzstan'],
+ 'KH' => ['KHM', 'KHR', '+855', 'Cambodia'],
+ 'KI' => ['KIR', 'AUD', '+686', 'Kiribati'],
+ 'KM' => ['COM', 'KMF', '+269', 'Comoros'],
+ 'KN' => ['KNA', 'XCD', '+1-869', 'Saint Kitts and Nevis'],
+ 'KP' => ['PRK', 'KPW', '+850', 'Korea, Democratic People''s Republic of (North Korea)'],
+ 'KR' => ['KOR', 'KRW', '+82', 'Korea, Republic of (South Korea)'],
+ 'KW' => ['KWT', 'KWD', '+965', 'Kuwait'],
+ 'KY' => ['CYM', 'KYD', '+1-345', 'Cayman Islands'],
+ 'KZ' => ['KAZ', 'KZT', '+7', 'Kazakhstan'],
+ 'LA' => ['LAO', 'LAK', '+856', 'Laos'],
+ 'LB' => ['LBN', 'LBP', '+961', 'Lebanon'],
+ 'LC' => ['LCA', 'XCD', '+1-758', 'Saint Lucia'],
+ 'LI' => ['LIE', 'CHF', '+423', 'Liechtenstein'],
+ 'LK' => ['LKA', 'LKR', '+94', 'Sri Lanka'],
+ 'LR' => ['LBR', 'LRD', '+231', 'Liberia'],
+ 'LS' => ['LSO', 'LSL', '+266', 'Lesotho'],
+ 'LT' => ['LTU', 'LTL', '+370', 'Lithuania'],
+ 'LU' => ['LUX', 'EUR', '+352', 'Luxembourg'],
+ 'LV' => ['LVA', 'LVL', '+371', 'Latvia'],
+ 'LY' => ['LBY', 'LYD', '+218', 'Libya'],
+ 'MA' => ['MAR', 'MAD', '+212', 'Morocco'],
+ 'MC' => ['MCO', 'EUR', '+377', 'Monaco'],
+ 'MD' => ['MDA', 'MDL', '+373', 'Moldova'],
+ 'ME' => ['MNE', 'EUR', '+382', 'Montenegro'],
+ 'MG' => ['MDG', 'MGA', '+261', 'Madagascar'],
+ 'MH' => ['MHL', 'USD', '+692', 'Marshall Islands'],
+ 'MK' => ['MKD', 'MKD', '+389', 'Macedonia'],
+ 'ML' => ['MLI', 'XOF', '+223', 'Mali'],
+ 'MM' => ['MMR', 'MMK', '+95', 'Myanmar (Burma)'],
+ 'MN' => ['MNG', 'MNT', '+976', 'Mongolia'],
+ 'MO' => ['MAC', 'MOP', '+853', 'Macau'],
+ 'MP' => ['MNP', 'USD', '+1-670', 'Northern Mariana Islands'],
+ 'MQ' => ['MTQ', 'EUR', '+596', 'Martinique'],
+ 'MR' => ['MRT', 'MRO', '+222', 'Mauritania'],
+ 'MS' => ['MSR', 'XCD', '+1-664', 'Montserrat'],
+ 'MT' => ['MLT', 'MTL', '+356', 'Malta'],
+ 'MU' => ['MUS', 'MUR', '+230', 'Mauritius'],
+ 'MV' => ['MDV', 'MVR', '+960', 'Maldives'],
+ 'MW' => ['MWI', 'MWK', '+265', 'Malawi'],
+ 'MX' => ['MEX', 'MXN', '+52', 'Mexico'],
+ 'MY' => ['MYS', 'MYR', '+60', 'Malaysia'],
+ 'MZ' => ['MOZ', 'MZM', '+258', 'Mozambique'],
+ 'NA' => ['NAM', 'NAD', '+264', 'Namibia'],
+ 'NC' => ['NCL', 'XPF', '+687', 'New Caledonia'],
+ 'NE' => ['NER', 'XOF', '+227', 'Niger'],
+ 'NF' => ['NFK', 'AUD', '+672', 'Norfolk Island'],
+ 'NG' => ['NGA', 'NGN', '+234', 'Nigeria'],
+ 'NI' => ['NIC', 'NIO', '+505', 'Nicaragua'],
+ 'NL' => ['NLD', 'EUR', '+31', 'Netherlands'],
+ 'NO' => ['NOR', 'NOK', '+47', 'Norway'],
+ 'NP' => ['NPL', 'NPR', '+977', 'Nepal'],
+ 'NR' => ['NRU', 'AUD', '+674', 'Nauru'],
+ 'NU' => ['NIU', 'NZD', '+683', 'Niue'],
+ 'NZ' => ['NZL', 'NZD', '+64', 'New Zealand'],
+ 'OM' => ['OMN', 'OMR', '+968', 'Oman'],
+ 'PA' => ['PAN', 'PAB', '+507', 'Panama'],
+ 'PE' => ['PER', 'PEN', '+51', 'Peru'],
+ 'PF' => ['PYF', 'XPF', '+689', 'French Polynesia'],
+ 'PF' => ['PYF', nil, nil, 'Clipperton Island'],
+ 'PG' => ['PNG', 'PGK', '+675', 'Papua New Guinea'],
+ 'PH' => ['PHL', 'PHP', '+63', 'Philippines'],
+ 'PK' => ['PAK', 'PKR', '+92', 'Pakistan'],
+ 'PL' => ['POL', 'PLN', '+48', 'Poland'],
+ 'PM' => ['SPM', 'EUR', '+508', 'Saint Pierre and Miquelon'],
+ 'PN' => ['PCN', 'NZD', nil, 'Pitcairn Islands'],
+ 'PR' => ['PRI', 'USD', '+1', 'Puerto Rico'],
+ 'PS' => ['PSE', 'ILS', '+970', 'Palestinian Territories (Gaza Strip and West Bank)'],
+ 'PT' => ['PRT', 'EUR', '+351', 'Portugal'],
+ 'PW' => ['PLW', 'USD', '+680', 'Palau'],
+ 'PY' => ['PRY', 'PYG', '+595', 'Paraguay'],
+ 'QA' => ['QAT', 'QAR', '+974', 'Qatar'],
+ 'RE' => ['REU', 'EUR', '+262', 'Reunion'],
+ 'RO' => ['ROU', 'RON', '+40', 'Romania'],
+ 'RS' => ['SRB', 'RSD', '+381', 'Serbia'],
+ 'RU' => ['RUS', 'RUB', '+7', 'Russia'],
+ 'RW' => ['RWA', 'RWF', '+250', 'Rwanda'],
+ 'SA' => ['SAU', 'SAR', '+966', 'Saudi Arabia'],
+ 'SB' => ['SLB', 'SBD', '+677', 'Solomon Islands'],
+ 'SC' => ['SYC', 'SCR', '+248', 'Seychelles'],
+ 'SD' => ['SDN', 'SDG', '+249', 'Sudan'],
+ 'SE' => ['SWE', 'SEK', '+46', 'Sweden'],
+ 'SG' => ['SGP', 'SGD', '+65', 'Singapore'],
+ 'SH' => ['SHN', 'SHP', '+290', 'Saint Helena'],
+ 'SI' => ['SVN', 'EUR', '+386', 'Slovenia'],
+ 'SJ' => ['SJM', 'NOK', '+47', 'Svalbard'],
+ 'SK' => ['SVK', 'SKK', '+421', 'Slovakia'],
+ 'SL' => ['SLE', 'SLL', '+232', 'Sierra Leone'],
+ 'SM' => ['SMR', 'EUR', '+378', 'San Marino'],
+ 'SN' => ['SEN', 'XOF', '+221', 'Senegal'],
+ 'SO' => ['SOM', 'SOS', '+252', 'Somalia'],
+ 'SR' => ['SUR', 'SRD', '+597', 'Suriname'],
+ 'ST' => ['STP', 'STD', '+239', 'Sao Tome and Principe'],
+ 'SV' => ['SLV', 'USD', '+503', 'El Salvador'],
+ 'SY' => ['SYR', 'SYP', '+963', 'Syria'],
+ 'SZ' => ['SWZ', 'SZL', '+268', 'Swaziland'],
+ 'TA' => ['TAA', 'SHP', '+290', 'Tristan da Cunha'],
+ 'TC' => ['TCA', 'USD', '+1-649', 'Turks and Caicos Islands'],
+ 'TD' => ['TCD', 'XAF', '+235', 'Chad'],
+ 'TF' => ['ATF', nil, nil, 'French Southern and Antarctic Lands'],
+ 'TG' => ['TGO', 'XOF', '+228', 'Togo'],
+ 'TH' => ['THA', 'THB', '+66', 'Thailand'],
+ 'TJ' => ['TJK', 'TJS', '+992', 'Tajikistan'],
+ 'TK' => ['TKL', 'NZD', '+690', 'Tokelau'],
+ 'TL' => ['TLS', 'USD', '+670', 'Timor-Leste (East Timor)'],
+ 'TM' => ['TKM', 'TMM', '+993', 'Turkmenistan'],
+ 'TN' => ['TUN', 'TND', '+216', 'Tunisia'],
+ 'TO' => ['TON', 'TOP', '+676', 'Tonga'],
+ 'TR' => ['TUR', 'TRY', '+90', 'Turkey'],
+ 'TT' => ['TTO', 'TTD', '+1-868', 'Trinidad and Tobago'],
+ 'TV' => ['TUV', 'AUD', '+688', 'Tuvalu'],
+ 'TW' => ['TWN', 'TWD', '+886', 'China, Republic of (Taiwan)'],
+ 'TZ' => ['TZA', 'TZS', '+255', 'Tanzania'],
+ 'UA' => ['UKR', 'UAH', '+380', 'Ukraine'],
+ 'UG' => ['UGA', 'UGX', '+256', 'Uganda'],
+ 'UM' => ['UMI', nil, nil, 'Midway Islands'],
+ 'US' => ['USA', 'USD', '+1', 'United States'],
+ 'UY' => ['URY', 'UYU', '+598', 'Uruguay'],
+ 'UZ' => ['UZB', 'UZS', '+998', 'Uzbekistan'],
+ 'VA' => ['VAT', 'EUR', '+379', 'Vatican City'],
+ 'VC' => ['VCT', 'XCD', '+1-784', 'Saint Vincent and the Grenadines'],
+ 'VE' => ['VEN', 'VEB', '+58', 'Venezuela'],
+ 'VG' => ['VGB', 'USD', '+1-284', 'British Virgin Islands'],
+ 'VI' => ['VIR', 'USD', '+1-340', 'U.S. Virgin Islands'],
+ 'VN' => ['VNM', 'VND', '+84', 'Vietnam'],
+ 'VU' => ['VUT', 'VUV', '+678', 'Vanuatu'],
+ 'WF' => ['WLF', 'XPF', '+681', 'Wallis and Futuna'],
+ 'WS' => ['WSM', 'WST', '+685', 'Samoa'],
+ 'YE' => ['YEM', 'YER', '+967', 'Yemen'],
+ 'YT' => ['MYT', 'EUR', '+262', 'Mayotte'],
+ 'ZA' => ['ZAF', 'ZAR', '+27', 'South Africa'],
+ 'ZM' => ['ZMB', 'ZMK', '+260', 'Zambia'],
+ 'ZW' => ['ZWE', 'ZWD', '+263', 'Zimbabwe']
+}
+
View
5,556 lib/uncharted/locale/countries.yml
5,556 additions, 0 deletions not shown
View
34 test/country_test.rb
@@ -5,36 +5,22 @@
class TestCountry < MiniTest::Unit::TestCase
- def test_country_addition
- br = Country.new(alpha2: 'BR', alpha3: 'BRA', names: {pt: 'Brasil'})
- assert br, "Country BR not added"
+ def test_country_lookup
+ br = Country.find('BR')
+ assert br, "Country BR not found"
assert_equal 'BR', br.alpha2
assert_equal 'BRA', br.alpha3
- assert_equal 'Brasil', br.name(:pt)
- end
-
- COUNTRY_DATA = [
- {alpha2: 'AR', alpha3: 'ARG', name: 'Argentina'},
- {alpha2: 'BR', alpha3: 'BRA', name: 'Brasil', names: {fr: 'Brésil', pt: 'Brasil'}},
- {alpha2: 'US', alpha3: 'USA', name: 'United States', names: {en: 'United States', pt: 'Estados Unidos'}}
- ]
-
- def test_load
- Country.load(COUNTRY_DATA)
- assert_equal 3, Country.count
- assert_equal 'ARG', Country.find('AR').alpha3
- assert_equal 'BRA', Country.find('BR').alpha3
- assert_equal 'USA', Country.find('US').alpha3
+ assert_equal 'Brazil', br.name
end
- def test_reloading_existing_data
- Country.load(COUNTRY_DATA)
- assert_equal 3, Country.count
+ def test_to_s
+ br = Country.find('BR')
+ assert_equal 'BR', br.to_s
end
- def test_to_s
- Country.load(COUNTRY_DATA)
- assert_equal 'AR', Country.find('AR').to_s
+ def test_to_sym
+ br = Country.find('BR')
+ assert_equal :br, br.to_sym
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.