simple-countries 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,6 @@
1
1
  require "simple/countries/version"
2
2
  require 'yaml'
3
+ require 'city-state'
3
4
 
4
5
  module Simple
5
6
  module Countries
@@ -1499,3 +1500,1542 @@ module Simple
1499
1500
  end
1500
1501
  end
1501
1502
  end
1503
+
1504
+ class Countries
1505
+ def self.all
1506
+ @countries = YAML.load_file(File.join(__dir__, 'countries.yml'))
1507
+ end
1508
+
1509
+ def self.find(id)
1510
+ @countries = YAML.load_file(File.join(__dir__, 'countries.yml'))
1511
+ @countries[id] rescue nil
1512
+ end
1513
+
1514
+ def self.first
1515
+ @countries = YAML.load_file(File.join(__dir__, 'countries.yml'))
1516
+ @countries.first
1517
+ end
1518
+
1519
+ def self.last
1520
+ @countries = YAML.load_file(File.join(__dir__, 'countries.yml'))
1521
+ @countries.last
1522
+ end
1523
+
1524
+ def self.find_by_alias(a)
1525
+ {
1526
+ 'AF' => 'Afghanistan',
1527
+ 'AL' => 'Albania',
1528
+ 'DZ' => 'Algeria',
1529
+ 'AS' => 'American Samoa',
1530
+ 'AD' => 'Andorra',
1531
+ 'AO' => 'Angola',
1532
+ 'AI' => 'Anguilla',
1533
+ 'AQ' => 'Antarctica',
1534
+ 'AG' => 'Antigua And Barbuda',
1535
+ 'AR' => 'Argentina',
1536
+ 'AM' => 'Armenia',
1537
+ 'AW' => 'Aruba',
1538
+ 'AU' => 'Australia',
1539
+ 'AT' => 'Austria',
1540
+ 'AZ' => 'Azerbaijan',
1541
+ 'BS' => 'Bahamas',
1542
+ 'BH' => 'Bahrain',
1543
+ 'BD' => 'Bangladesh',
1544
+ 'BB' => 'Barbados',
1545
+ 'BY' => 'Belarus',
1546
+ 'BE' => 'Belgium',
1547
+ 'BZ' => 'Belize',
1548
+ 'BJ' => 'Benin',
1549
+ 'BM' => 'Bermuda',
1550
+ 'BT' => 'Bhutan',
1551
+ 'BO' => 'Bolivia',
1552
+ 'BA' => 'Bosnia And Herzegovina',
1553
+ 'BW' => 'Botswana',
1554
+ 'BV' => 'Bouvet Island',
1555
+ 'BR' => 'Brazil',
1556
+ 'IO' => 'British Indian Ocean Territory',
1557
+ 'BN' => 'Brunei Darussalam',
1558
+ 'BG' => 'Bulgaria',
1559
+ 'BF' => 'Burkina Faso',
1560
+ 'BI' => 'Burundi',
1561
+ 'KH' => 'Cambodia',
1562
+ 'CM' => 'Cameroon',
1563
+ 'CA' => 'Canada',
1564
+ 'CV' => 'Cape Verde',
1565
+ 'KY' => 'Cayman Islands',
1566
+ 'CF' => 'Central African Republic',
1567
+ 'TD' => 'Chad',
1568
+ 'CL' => 'Chile',
1569
+ 'CN' => 'China',
1570
+ 'CX' => 'Christmas Island',
1571
+ 'CC' => 'Cocos (keeling) Islands',
1572
+ 'CO' => 'Colombia',
1573
+ 'KM' => 'Comoros',
1574
+ 'CG' => 'Congo',
1575
+ 'CD' => 'Congo, The Democratic Republic Of The',
1576
+ 'CK' => 'Cook Islands',
1577
+ 'CR' => 'Costa Rica',
1578
+ 'CI' => 'Cote D\'ivoire',
1579
+ 'HR' => 'Croatia',
1580
+ 'CU' => 'Cuba',
1581
+ 'CY' => 'Cyprus',
1582
+ 'CZ' => 'Czech Republic',
1583
+ 'DK' => 'Denmark',
1584
+ 'DJ' => 'Djibouti',
1585
+ 'DM' => 'Dominica',
1586
+ 'DO' => 'Dominican Republic',
1587
+ 'TP' => 'East Timor',
1588
+ 'EC' => 'Ecuador',
1589
+ 'EG' => 'Egypt',
1590
+ 'SV' => 'El Salvador',
1591
+ 'GQ' => 'Equatorial Guinea',
1592
+ 'ER' => 'Eritrea',
1593
+ 'EE' => 'Estonia',
1594
+ 'ET' => 'Ethiopia',
1595
+ 'FK' => 'Falkland Islands (malvinas)',
1596
+ 'FO' => 'Faroe Islands',
1597
+ 'FJ' => 'Fiji',
1598
+ 'FI' => 'Finland',
1599
+ 'FR' => 'France',
1600
+ 'GF' => 'French Guiana',
1601
+ 'PF' => 'French Polynesia',
1602
+ 'TF' => 'French Southern Territories',
1603
+ 'GA' => 'Gabon',
1604
+ 'GM' => 'Gambia',
1605
+ 'GE' => 'Georgia',
1606
+ 'DE' => 'Germany',
1607
+ 'GH' => 'Ghana',
1608
+ 'GI' => 'Gibraltar',
1609
+ 'GR' => 'Greece',
1610
+ 'GL' => 'Greenland',
1611
+ 'GD' => 'Grenada',
1612
+ 'GP' => 'Guadeloupe',
1613
+ 'GU' => 'Guam',
1614
+ 'GT' => 'Guatemala',
1615
+ 'GN' => 'Guinea',
1616
+ 'GW' => 'Guinea-bissau',
1617
+ 'GY' => 'Guyana',
1618
+ 'HT' => 'Haiti',
1619
+ 'HM' => 'Heard Island And Mcdonald Islands',
1620
+ 'VA' => 'Holy See (vatican City State)',
1621
+ 'HN' => 'Honduras',
1622
+ 'HK' => 'Hong Kong',
1623
+ 'HU' => 'Hungary',
1624
+ 'IS' => 'Iceland',
1625
+ 'IN' => 'India',
1626
+ 'ID' => 'Indonesia',
1627
+ 'IR' => 'Iran, Islamic Republic Of',
1628
+ 'IQ' => 'Iraq',
1629
+ 'IE' => 'Ireland',
1630
+ 'IL' => 'Israel',
1631
+ 'IT' => 'Italy',
1632
+ 'JM' => 'Jamaica',
1633
+ 'JP' => 'Japan',
1634
+ 'JO' => 'Jordan',
1635
+ 'KZ' => 'Kazakstan',
1636
+ 'KE' => 'Kenya',
1637
+ 'KI' => 'Kiribati',
1638
+ 'KP' => 'Korea, Democratic People\'s Republic Of',
1639
+ 'KR' => 'Korea, Republic Of',
1640
+ 'KV' => 'Kosovo',
1641
+ 'KW' => 'Kuwait',
1642
+ 'KG' => 'Kyrgyzstan',
1643
+ 'LA' => 'Lao People\'s Democratic Republic',
1644
+ 'LV' => 'Latvia',
1645
+ 'LB' => 'Lebanon',
1646
+ 'LS' => 'Lesotho',
1647
+ 'LR' => 'Liberia',
1648
+ 'LY' => 'Libyan Arab Jamahiriya',
1649
+ 'LI' => 'Liechtenstein',
1650
+ 'LT' => 'Lithuania',
1651
+ 'LU' => 'Luxembourg',
1652
+ 'MO' => 'Macau',
1653
+ 'MK' => 'Macedonia, The Former Yugoslav Republic Of',
1654
+ 'MG' => 'Madagascar',
1655
+ 'MW' => 'Malawi',
1656
+ 'MY' => 'Malaysia',
1657
+ 'MV' => 'Maldives',
1658
+ 'ML' => 'Mali',
1659
+ 'MT' => 'Malta',
1660
+ 'MH' => 'Marshall Islands',
1661
+ 'MQ' => 'Martinique',
1662
+ 'MR' => 'Mauritania',
1663
+ 'MU' => 'Mauritius',
1664
+ 'YT' => 'Mayotte',
1665
+ 'MX' => 'Mexico',
1666
+ 'FM' => 'Micronesia, Federated States Of',
1667
+ 'MD' => 'Moldova, Republic Of',
1668
+ 'MC' => 'Monaco',
1669
+ 'MN' => 'Mongolia',
1670
+ 'MS' => 'Montserrat',
1671
+ 'ME' => 'Montenegro',
1672
+ 'MA' => 'Morocco',
1673
+ 'MZ' => 'Mozambique',
1674
+ 'MM' => 'Myanmar',
1675
+ 'NA' => 'Namibia',
1676
+ 'NR' => 'Nauru',
1677
+ 'NP' => 'Nepal',
1678
+ 'NL' => 'Netherlands',
1679
+ 'AN' => 'Netherlands Antilles',
1680
+ 'NC' => 'New Caledonia',
1681
+ 'NZ' => 'New Zealand',
1682
+ 'NI' => 'Nicaragua',
1683
+ 'NE' => 'Niger',
1684
+ 'NG' => 'Nigeria',
1685
+ 'NU' => 'Niue',
1686
+ 'NF' => 'Norfolk Island',
1687
+ 'MP' => 'Northern Mariana Islands',
1688
+ 'NO' => 'Norway',
1689
+ 'OM' => 'Oman',
1690
+ 'PK' => 'Pakistan',
1691
+ 'PW' => 'Palau',
1692
+ 'PS' => 'Palestinian Territory, Occupied',
1693
+ 'PA' => 'Panama',
1694
+ 'PG' => 'Papua New Guinea',
1695
+ 'PY' => 'Paraguay',
1696
+ 'PE' => 'Peru',
1697
+ 'PH' => 'Philippines',
1698
+ 'PN' => 'Pitcairn',
1699
+ 'PL' => 'Poland',
1700
+ 'PT' => 'Portugal',
1701
+ 'PR' => 'Puerto Rico',
1702
+ 'QA' => 'Qatar',
1703
+ 'RE' => 'Reunion',
1704
+ 'RO' => 'Romania',
1705
+ 'RU' => 'Russian Federation',
1706
+ 'RW' => 'Rwanda',
1707
+ 'SH' => 'Saint Helena',
1708
+ 'KN' => 'Saint Kitts And Nevis',
1709
+ 'LC' => 'Saint Lucia',
1710
+ 'PM' => 'Saint Pierre And Miquelon',
1711
+ 'VC' => 'Saint Vincent And The Grenadines',
1712
+ 'WS' => 'Samoa',
1713
+ 'SM' => 'San Marino',
1714
+ 'ST' => 'Sao Tome And Principe',
1715
+ 'SA' => 'Saudi Arabia',
1716
+ 'SN' => 'Senegal',
1717
+ 'RS' => 'Serbia',
1718
+ 'SC' => 'Seychelles',
1719
+ 'SL' => 'Sierra Leone',
1720
+ 'SG' => 'Singapore',
1721
+ 'SK' => 'Slovakia',
1722
+ 'SI' => 'Slovenia',
1723
+ 'SB' => 'Solomon Islands',
1724
+ 'SO' => 'Somalia',
1725
+ 'ZA' => 'South Africa',
1726
+ 'GS' => 'South Georgia And The South Sandwich Islands',
1727
+ 'ES' => 'Spain',
1728
+ 'LK' => 'Sri Lanka',
1729
+ 'SD' => 'Sudan',
1730
+ 'SR' => 'Suriname',
1731
+ 'SJ' => 'Svalbard And Jan Mayen',
1732
+ 'SZ' => 'Swaziland',
1733
+ 'SE' => 'Sweden',
1734
+ 'CH' => 'Switzerland',
1735
+ 'SY' => 'Syrian Arab Republic',
1736
+ 'TW' => 'Taiwan, Province Of China',
1737
+ 'TJ' => 'Tajikistan',
1738
+ 'TZ' => 'Tanzania, United Republic Of',
1739
+ 'TH' => 'Thailand',
1740
+ 'TG' => 'Togo',
1741
+ 'TK' => 'Tokelau',
1742
+ 'TO' => 'Tonga',
1743
+ 'TT' => 'Trinidad And Tobago',
1744
+ 'TN' => 'Tunisia',
1745
+ 'TR' => 'Turkey',
1746
+ 'TM' => 'Turkmenistan',
1747
+ 'TC' => 'Turks And Caicos Islands',
1748
+ 'TV' => 'Tuvalu',
1749
+ 'UG' => 'Uganda',
1750
+ 'UA' => 'Ukraine',
1751
+ 'AE' => 'United Arab Emirates',
1752
+ 'GB' => 'United Kingdom',
1753
+ 'US' => 'United States',
1754
+ 'UM' => 'United States Minor Outlying Islands',
1755
+ 'UY' => 'Uruguay',
1756
+ 'UZ' => 'Uzbekistan',
1757
+ 'VU' => 'Vanuatu',
1758
+ 'VE' => 'Venezuela',
1759
+ 'VN' => 'Viet Nam',
1760
+ 'VG' => 'Virgin Islands, British',
1761
+ 'VI' => 'Virgin Islands, U.s.',
1762
+ 'WF' => 'Wallis And Futuna',
1763
+ 'EH' => 'Western Sahara',
1764
+ 'YE' => 'Yemen',
1765
+ 'ZM' => 'Zambia',
1766
+ 'ZW' => 'Zimbabwe'
1767
+ }[a.upcase] rescue nil
1768
+ end
1769
+
1770
+ def self.search(keyword)
1771
+ {
1772
+ 'AF' => 'Afghanistan',
1773
+ 'AL' => 'Albania',
1774
+ 'DZ' => 'Algeria',
1775
+ 'AS' => 'American Samoa',
1776
+ 'AD' => 'Andorra',
1777
+ 'AO' => 'Angola',
1778
+ 'AI' => 'Anguilla',
1779
+ 'AQ' => 'Antarctica',
1780
+ 'AG' => 'Antigua And Barbuda',
1781
+ 'AR' => 'Argentina',
1782
+ 'AM' => 'Armenia',
1783
+ 'AW' => 'Aruba',
1784
+ 'AU' => 'Australia',
1785
+ 'AT' => 'Austria',
1786
+ 'AZ' => 'Azerbaijan',
1787
+ 'BS' => 'Bahamas',
1788
+ 'BH' => 'Bahrain',
1789
+ 'BD' => 'Bangladesh',
1790
+ 'BB' => 'Barbados',
1791
+ 'BY' => 'Belarus',
1792
+ 'BE' => 'Belgium',
1793
+ 'BZ' => 'Belize',
1794
+ 'BJ' => 'Benin',
1795
+ 'BM' => 'Bermuda',
1796
+ 'BT' => 'Bhutan',
1797
+ 'BO' => 'Bolivia',
1798
+ 'BA' => 'Bosnia And Herzegovina',
1799
+ 'BW' => 'Botswana',
1800
+ 'BV' => 'Bouvet Island',
1801
+ 'BR' => 'Brazil',
1802
+ 'IO' => 'British Indian Ocean Territory',
1803
+ 'BN' => 'Brunei Darussalam',
1804
+ 'BG' => 'Bulgaria',
1805
+ 'BF' => 'Burkina Faso',
1806
+ 'BI' => 'Burundi',
1807
+ 'KH' => 'Cambodia',
1808
+ 'CM' => 'Cameroon',
1809
+ 'CA' => 'Canada',
1810
+ 'CV' => 'Cape Verde',
1811
+ 'KY' => 'Cayman Islands',
1812
+ 'CF' => 'Central African Republic',
1813
+ 'TD' => 'Chad',
1814
+ 'CL' => 'Chile',
1815
+ 'CN' => 'China',
1816
+ 'CX' => 'Christmas Island',
1817
+ 'CC' => 'Cocos (keeling) Islands',
1818
+ 'CO' => 'Colombia',
1819
+ 'KM' => 'Comoros',
1820
+ 'CG' => 'Congo',
1821
+ 'CD' => 'Congo, The Democratic Republic Of The',
1822
+ 'CK' => 'Cook Islands',
1823
+ 'CR' => 'Costa Rica',
1824
+ 'CI' => 'Cote D\'ivoire',
1825
+ 'HR' => 'Croatia',
1826
+ 'CU' => 'Cuba',
1827
+ 'CY' => 'Cyprus',
1828
+ 'CZ' => 'Czech Republic',
1829
+ 'DK' => 'Denmark',
1830
+ 'DJ' => 'Djibouti',
1831
+ 'DM' => 'Dominica',
1832
+ 'DO' => 'Dominican Republic',
1833
+ 'TP' => 'East Timor',
1834
+ 'EC' => 'Ecuador',
1835
+ 'EG' => 'Egypt',
1836
+ 'SV' => 'El Salvador',
1837
+ 'GQ' => 'Equatorial Guinea',
1838
+ 'ER' => 'Eritrea',
1839
+ 'EE' => 'Estonia',
1840
+ 'ET' => 'Ethiopia',
1841
+ 'FK' => 'Falkland Islands (malvinas)',
1842
+ 'FO' => 'Faroe Islands',
1843
+ 'FJ' => 'Fiji',
1844
+ 'FI' => 'Finland',
1845
+ 'FR' => 'France',
1846
+ 'GF' => 'French Guiana',
1847
+ 'PF' => 'French Polynesia',
1848
+ 'TF' => 'French Southern Territories',
1849
+ 'GA' => 'Gabon',
1850
+ 'GM' => 'Gambia',
1851
+ 'GE' => 'Georgia',
1852
+ 'DE' => 'Germany',
1853
+ 'GH' => 'Ghana',
1854
+ 'GI' => 'Gibraltar',
1855
+ 'GR' => 'Greece',
1856
+ 'GL' => 'Greenland',
1857
+ 'GD' => 'Grenada',
1858
+ 'GP' => 'Guadeloupe',
1859
+ 'GU' => 'Guam',
1860
+ 'GT' => 'Guatemala',
1861
+ 'GN' => 'Guinea',
1862
+ 'GW' => 'Guinea-bissau',
1863
+ 'GY' => 'Guyana',
1864
+ 'HT' => 'Haiti',
1865
+ 'HM' => 'Heard Island And Mcdonald Islands',
1866
+ 'VA' => 'Holy See (vatican City State)',
1867
+ 'HN' => 'Honduras',
1868
+ 'HK' => 'Hong Kong',
1869
+ 'HU' => 'Hungary',
1870
+ 'IS' => 'Iceland',
1871
+ 'IN' => 'India',
1872
+ 'ID' => 'Indonesia',
1873
+ 'IR' => 'Iran, Islamic Republic Of',
1874
+ 'IQ' => 'Iraq',
1875
+ 'IE' => 'Ireland',
1876
+ 'IL' => 'Israel',
1877
+ 'IT' => 'Italy',
1878
+ 'JM' => 'Jamaica',
1879
+ 'JP' => 'Japan',
1880
+ 'JO' => 'Jordan',
1881
+ 'KZ' => 'Kazakstan',
1882
+ 'KE' => 'Kenya',
1883
+ 'KI' => 'Kiribati',
1884
+ 'KP' => 'Korea, Democratic People\'s Republic Of',
1885
+ 'KR' => 'Korea, Republic Of',
1886
+ 'KV' => 'Kosovo',
1887
+ 'KW' => 'Kuwait',
1888
+ 'KG' => 'Kyrgyzstan',
1889
+ 'LA' => 'Lao People\'s Democratic Republic',
1890
+ 'LV' => 'Latvia',
1891
+ 'LB' => 'Lebanon',
1892
+ 'LS' => 'Lesotho',
1893
+ 'LR' => 'Liberia',
1894
+ 'LY' => 'Libyan Arab Jamahiriya',
1895
+ 'LI' => 'Liechtenstein',
1896
+ 'LT' => 'Lithuania',
1897
+ 'LU' => 'Luxembourg',
1898
+ 'MO' => 'Macau',
1899
+ 'MK' => 'Macedonia, The Former Yugoslav Republic Of',
1900
+ 'MG' => 'Madagascar',
1901
+ 'MW' => 'Malawi',
1902
+ 'MY' => 'Malaysia',
1903
+ 'MV' => 'Maldives',
1904
+ 'ML' => 'Mali',
1905
+ 'MT' => 'Malta',
1906
+ 'MH' => 'Marshall Islands',
1907
+ 'MQ' => 'Martinique',
1908
+ 'MR' => 'Mauritania',
1909
+ 'MU' => 'Mauritius',
1910
+ 'YT' => 'Mayotte',
1911
+ 'MX' => 'Mexico',
1912
+ 'FM' => 'Micronesia, Federated States Of',
1913
+ 'MD' => 'Moldova, Republic Of',
1914
+ 'MC' => 'Monaco',
1915
+ 'MN' => 'Mongolia',
1916
+ 'MS' => 'Montserrat',
1917
+ 'ME' => 'Montenegro',
1918
+ 'MA' => 'Morocco',
1919
+ 'MZ' => 'Mozambique',
1920
+ 'MM' => 'Myanmar',
1921
+ 'NA' => 'Namibia',
1922
+ 'NR' => 'Nauru',
1923
+ 'NP' => 'Nepal',
1924
+ 'NL' => 'Netherlands',
1925
+ 'AN' => 'Netherlands Antilles',
1926
+ 'NC' => 'New Caledonia',
1927
+ 'NZ' => 'New Zealand',
1928
+ 'NI' => 'Nicaragua',
1929
+ 'NE' => 'Niger',
1930
+ 'NG' => 'Nigeria',
1931
+ 'NU' => 'Niue',
1932
+ 'NF' => 'Norfolk Island',
1933
+ 'MP' => 'Northern Mariana Islands',
1934
+ 'NO' => 'Norway',
1935
+ 'OM' => 'Oman',
1936
+ 'PK' => 'Pakistan',
1937
+ 'PW' => 'Palau',
1938
+ 'PS' => 'Palestinian Territory, Occupied',
1939
+ 'PA' => 'Panama',
1940
+ 'PG' => 'Papua New Guinea',
1941
+ 'PY' => 'Paraguay',
1942
+ 'PE' => 'Peru',
1943
+ 'PH' => 'Philippines',
1944
+ 'PN' => 'Pitcairn',
1945
+ 'PL' => 'Poland',
1946
+ 'PT' => 'Portugal',
1947
+ 'PR' => 'Puerto Rico',
1948
+ 'QA' => 'Qatar',
1949
+ 'RE' => 'Reunion',
1950
+ 'RO' => 'Romania',
1951
+ 'RU' => 'Russian Federation',
1952
+ 'RW' => 'Rwanda',
1953
+ 'SH' => 'Saint Helena',
1954
+ 'KN' => 'Saint Kitts And Nevis',
1955
+ 'LC' => 'Saint Lucia',
1956
+ 'PM' => 'Saint Pierre And Miquelon',
1957
+ 'VC' => 'Saint Vincent And The Grenadines',
1958
+ 'WS' => 'Samoa',
1959
+ 'SM' => 'San Marino',
1960
+ 'ST' => 'Sao Tome And Principe',
1961
+ 'SA' => 'Saudi Arabia',
1962
+ 'SN' => 'Senegal',
1963
+ 'RS' => 'Serbia',
1964
+ 'SC' => 'Seychelles',
1965
+ 'SL' => 'Sierra Leone',
1966
+ 'SG' => 'Singapore',
1967
+ 'SK' => 'Slovakia',
1968
+ 'SI' => 'Slovenia',
1969
+ 'SB' => 'Solomon Islands',
1970
+ 'SO' => 'Somalia',
1971
+ 'ZA' => 'South Africa',
1972
+ 'GS' => 'South Georgia And The South Sandwich Islands',
1973
+ 'ES' => 'Spain',
1974
+ 'LK' => 'Sri Lanka',
1975
+ 'SD' => 'Sudan',
1976
+ 'SR' => 'Suriname',
1977
+ 'SJ' => 'Svalbard And Jan Mayen',
1978
+ 'SZ' => 'Swaziland',
1979
+ 'SE' => 'Sweden',
1980
+ 'CH' => 'Switzerland',
1981
+ 'SY' => 'Syrian Arab Republic',
1982
+ 'TW' => 'Taiwan, Province Of China',
1983
+ 'TJ' => 'Tajikistan',
1984
+ 'TZ' => 'Tanzania, United Republic Of',
1985
+ 'TH' => 'Thailand',
1986
+ 'TG' => 'Togo',
1987
+ 'TK' => 'Tokelau',
1988
+ 'TO' => 'Tonga',
1989
+ 'TT' => 'Trinidad And Tobago',
1990
+ 'TN' => 'Tunisia',
1991
+ 'TR' => 'Turkey',
1992
+ 'TM' => 'Turkmenistan',
1993
+ 'TC' => 'Turks And Caicos Islands',
1994
+ 'TV' => 'Tuvalu',
1995
+ 'UG' => 'Uganda',
1996
+ 'UA' => 'Ukraine',
1997
+ 'AE' => 'United Arab Emirates',
1998
+ 'GB' => 'United Kingdom',
1999
+ 'US' => 'United States',
2000
+ 'UM' => 'United States Minor Outlying Islands',
2001
+ 'UY' => 'Uruguay',
2002
+ 'UZ' => 'Uzbekistan',
2003
+ 'VU' => 'Vanuatu',
2004
+ 'VE' => 'Venezuela',
2005
+ 'VN' => 'Viet Nam',
2006
+ 'VG' => 'Virgin Islands, British',
2007
+ 'VI' => 'Virgin Islands, U.s.',
2008
+ 'WF' => 'Wallis And Futuna',
2009
+ 'EH' => 'Western Sahara',
2010
+ 'YE' => 'Yemen',
2011
+ 'ZM' => 'Zambia',
2012
+ 'ZW' => 'Zimbabwe'
2013
+ }.inject([]) { |res, kv| res << kv if kv[1] =~ /#{keyword}/; res } rescue nil
2014
+ end
2015
+
2016
+ def self.search_by_key(key)
2017
+ {
2018
+ 'AF' => 'Afghanistan',
2019
+ 'AL' => 'Albania',
2020
+ 'DZ' => 'Algeria',
2021
+ 'AS' => 'American Samoa',
2022
+ 'AD' => 'Andorra',
2023
+ 'AO' => 'Angola',
2024
+ 'AI' => 'Anguilla',
2025
+ 'AQ' => 'Antarctica',
2026
+ 'AG' => 'Antigua And Barbuda',
2027
+ 'AR' => 'Argentina',
2028
+ 'AM' => 'Armenia',
2029
+ 'AW' => 'Aruba',
2030
+ 'AU' => 'Australia',
2031
+ 'AT' => 'Austria',
2032
+ 'AZ' => 'Azerbaijan',
2033
+ 'BS' => 'Bahamas',
2034
+ 'BH' => 'Bahrain',
2035
+ 'BD' => 'Bangladesh',
2036
+ 'BB' => 'Barbados',
2037
+ 'BY' => 'Belarus',
2038
+ 'BE' => 'Belgium',
2039
+ 'BZ' => 'Belize',
2040
+ 'BJ' => 'Benin',
2041
+ 'BM' => 'Bermuda',
2042
+ 'BT' => 'Bhutan',
2043
+ 'BO' => 'Bolivia',
2044
+ 'BA' => 'Bosnia And Herzegovina',
2045
+ 'BW' => 'Botswana',
2046
+ 'BV' => 'Bouvet Island',
2047
+ 'BR' => 'Brazil',
2048
+ 'IO' => 'British Indian Ocean Territory',
2049
+ 'BN' => 'Brunei Darussalam',
2050
+ 'BG' => 'Bulgaria',
2051
+ 'BF' => 'Burkina Faso',
2052
+ 'BI' => 'Burundi',
2053
+ 'KH' => 'Cambodia',
2054
+ 'CM' => 'Cameroon',
2055
+ 'CA' => 'Canada',
2056
+ 'CV' => 'Cape Verde',
2057
+ 'KY' => 'Cayman Islands',
2058
+ 'CF' => 'Central African Republic',
2059
+ 'TD' => 'Chad',
2060
+ 'CL' => 'Chile',
2061
+ 'CN' => 'China',
2062
+ 'CX' => 'Christmas Island',
2063
+ 'CC' => 'Cocos (keeling) Islands',
2064
+ 'CO' => 'Colombia',
2065
+ 'KM' => 'Comoros',
2066
+ 'CG' => 'Congo',
2067
+ 'CD' => 'Congo, The Democratic Republic Of The',
2068
+ 'CK' => 'Cook Islands',
2069
+ 'CR' => 'Costa Rica',
2070
+ 'CI' => 'Cote D\'ivoire',
2071
+ 'HR' => 'Croatia',
2072
+ 'CU' => 'Cuba',
2073
+ 'CY' => 'Cyprus',
2074
+ 'CZ' => 'Czech Republic',
2075
+ 'DK' => 'Denmark',
2076
+ 'DJ' => 'Djibouti',
2077
+ 'DM' => 'Dominica',
2078
+ 'DO' => 'Dominican Republic',
2079
+ 'TP' => 'East Timor',
2080
+ 'EC' => 'Ecuador',
2081
+ 'EG' => 'Egypt',
2082
+ 'SV' => 'El Salvador',
2083
+ 'GQ' => 'Equatorial Guinea',
2084
+ 'ER' => 'Eritrea',
2085
+ 'EE' => 'Estonia',
2086
+ 'ET' => 'Ethiopia',
2087
+ 'FK' => 'Falkland Islands (malvinas)',
2088
+ 'FO' => 'Faroe Islands',
2089
+ 'FJ' => 'Fiji',
2090
+ 'FI' => 'Finland',
2091
+ 'FR' => 'France',
2092
+ 'GF' => 'French Guiana',
2093
+ 'PF' => 'French Polynesia',
2094
+ 'TF' => 'French Southern Territories',
2095
+ 'GA' => 'Gabon',
2096
+ 'GM' => 'Gambia',
2097
+ 'GE' => 'Georgia',
2098
+ 'DE' => 'Germany',
2099
+ 'GH' => 'Ghana',
2100
+ 'GI' => 'Gibraltar',
2101
+ 'GR' => 'Greece',
2102
+ 'GL' => 'Greenland',
2103
+ 'GD' => 'Grenada',
2104
+ 'GP' => 'Guadeloupe',
2105
+ 'GU' => 'Guam',
2106
+ 'GT' => 'Guatemala',
2107
+ 'GN' => 'Guinea',
2108
+ 'GW' => 'Guinea-bissau',
2109
+ 'GY' => 'Guyana',
2110
+ 'HT' => 'Haiti',
2111
+ 'HM' => 'Heard Island And Mcdonald Islands',
2112
+ 'VA' => 'Holy See (vatican City State)',
2113
+ 'HN' => 'Honduras',
2114
+ 'HK' => 'Hong Kong',
2115
+ 'HU' => 'Hungary',
2116
+ 'IS' => 'Iceland',
2117
+ 'IN' => 'India',
2118
+ 'ID' => 'Indonesia',
2119
+ 'IR' => 'Iran, Islamic Republic Of',
2120
+ 'IQ' => 'Iraq',
2121
+ 'IE' => 'Ireland',
2122
+ 'IL' => 'Israel',
2123
+ 'IT' => 'Italy',
2124
+ 'JM' => 'Jamaica',
2125
+ 'JP' => 'Japan',
2126
+ 'JO' => 'Jordan',
2127
+ 'KZ' => 'Kazakstan',
2128
+ 'KE' => 'Kenya',
2129
+ 'KI' => 'Kiribati',
2130
+ 'KP' => 'Korea, Democratic People\'s Republic Of',
2131
+ 'KR' => 'Korea, Republic Of',
2132
+ 'KV' => 'Kosovo',
2133
+ 'KW' => 'Kuwait',
2134
+ 'KG' => 'Kyrgyzstan',
2135
+ 'LA' => 'Lao People\'s Democratic Republic',
2136
+ 'LV' => 'Latvia',
2137
+ 'LB' => 'Lebanon',
2138
+ 'LS' => 'Lesotho',
2139
+ 'LR' => 'Liberia',
2140
+ 'LY' => 'Libyan Arab Jamahiriya',
2141
+ 'LI' => 'Liechtenstein',
2142
+ 'LT' => 'Lithuania',
2143
+ 'LU' => 'Luxembourg',
2144
+ 'MO' => 'Macau',
2145
+ 'MK' => 'Macedonia, The Former Yugoslav Republic Of',
2146
+ 'MG' => 'Madagascar',
2147
+ 'MW' => 'Malawi',
2148
+ 'MY' => 'Malaysia',
2149
+ 'MV' => 'Maldives',
2150
+ 'ML' => 'Mali',
2151
+ 'MT' => 'Malta',
2152
+ 'MH' => 'Marshall Islands',
2153
+ 'MQ' => 'Martinique',
2154
+ 'MR' => 'Mauritania',
2155
+ 'MU' => 'Mauritius',
2156
+ 'YT' => 'Mayotte',
2157
+ 'MX' => 'Mexico',
2158
+ 'FM' => 'Micronesia, Federated States Of',
2159
+ 'MD' => 'Moldova, Republic Of',
2160
+ 'MC' => 'Monaco',
2161
+ 'MN' => 'Mongolia',
2162
+ 'MS' => 'Montserrat',
2163
+ 'ME' => 'Montenegro',
2164
+ 'MA' => 'Morocco',
2165
+ 'MZ' => 'Mozambique',
2166
+ 'MM' => 'Myanmar',
2167
+ 'NA' => 'Namibia',
2168
+ 'NR' => 'Nauru',
2169
+ 'NP' => 'Nepal',
2170
+ 'NL' => 'Netherlands',
2171
+ 'AN' => 'Netherlands Antilles',
2172
+ 'NC' => 'New Caledonia',
2173
+ 'NZ' => 'New Zealand',
2174
+ 'NI' => 'Nicaragua',
2175
+ 'NE' => 'Niger',
2176
+ 'NG' => 'Nigeria',
2177
+ 'NU' => 'Niue',
2178
+ 'NF' => 'Norfolk Island',
2179
+ 'MP' => 'Northern Mariana Islands',
2180
+ 'NO' => 'Norway',
2181
+ 'OM' => 'Oman',
2182
+ 'PK' => 'Pakistan',
2183
+ 'PW' => 'Palau',
2184
+ 'PS' => 'Palestinian Territory, Occupied',
2185
+ 'PA' => 'Panama',
2186
+ 'PG' => 'Papua New Guinea',
2187
+ 'PY' => 'Paraguay',
2188
+ 'PE' => 'Peru',
2189
+ 'PH' => 'Philippines',
2190
+ 'PN' => 'Pitcairn',
2191
+ 'PL' => 'Poland',
2192
+ 'PT' => 'Portugal',
2193
+ 'PR' => 'Puerto Rico',
2194
+ 'QA' => 'Qatar',
2195
+ 'RE' => 'Reunion',
2196
+ 'RO' => 'Romania',
2197
+ 'RU' => 'Russian Federation',
2198
+ 'RW' => 'Rwanda',
2199
+ 'SH' => 'Saint Helena',
2200
+ 'KN' => 'Saint Kitts And Nevis',
2201
+ 'LC' => 'Saint Lucia',
2202
+ 'PM' => 'Saint Pierre And Miquelon',
2203
+ 'VC' => 'Saint Vincent And The Grenadines',
2204
+ 'WS' => 'Samoa',
2205
+ 'SM' => 'San Marino',
2206
+ 'ST' => 'Sao Tome And Principe',
2207
+ 'SA' => 'Saudi Arabia',
2208
+ 'SN' => 'Senegal',
2209
+ 'RS' => 'Serbia',
2210
+ 'SC' => 'Seychelles',
2211
+ 'SL' => 'Sierra Leone',
2212
+ 'SG' => 'Singapore',
2213
+ 'SK' => 'Slovakia',
2214
+ 'SI' => 'Slovenia',
2215
+ 'SB' => 'Solomon Islands',
2216
+ 'SO' => 'Somalia',
2217
+ 'ZA' => 'South Africa',
2218
+ 'GS' => 'South Georgia And The South Sandwich Islands',
2219
+ 'ES' => 'Spain',
2220
+ 'LK' => 'Sri Lanka',
2221
+ 'SD' => 'Sudan',
2222
+ 'SR' => 'Suriname',
2223
+ 'SJ' => 'Svalbard And Jan Mayen',
2224
+ 'SZ' => 'Swaziland',
2225
+ 'SE' => 'Sweden',
2226
+ 'CH' => 'Switzerland',
2227
+ 'SY' => 'Syrian Arab Republic',
2228
+ 'TW' => 'Taiwan, Province Of China',
2229
+ 'TJ' => 'Tajikistan',
2230
+ 'TZ' => 'Tanzania, United Republic Of',
2231
+ 'TH' => 'Thailand',
2232
+ 'TG' => 'Togo',
2233
+ 'TK' => 'Tokelau',
2234
+ 'TO' => 'Tonga',
2235
+ 'TT' => 'Trinidad And Tobago',
2236
+ 'TN' => 'Tunisia',
2237
+ 'TR' => 'Turkey',
2238
+ 'TM' => 'Turkmenistan',
2239
+ 'TC' => 'Turks And Caicos Islands',
2240
+ 'TV' => 'Tuvalu',
2241
+ 'UG' => 'Uganda',
2242
+ 'UA' => 'Ukraine',
2243
+ 'AE' => 'United Arab Emirates',
2244
+ 'GB' => 'United Kingdom',
2245
+ 'US' => 'United States',
2246
+ 'UM' => 'United States Minor Outlying Islands',
2247
+ 'UY' => 'Uruguay',
2248
+ 'UZ' => 'Uzbekistan',
2249
+ 'VU' => 'Vanuatu',
2250
+ 'VE' => 'Venezuela',
2251
+ 'VN' => 'Viet Nam',
2252
+ 'VG' => 'Virgin Islands, British',
2253
+ 'VI' => 'Virgin Islands, U.s.',
2254
+ 'WF' => 'Wallis And Futuna',
2255
+ 'EH' => 'Western Sahara',
2256
+ 'YE' => 'Yemen',
2257
+ 'ZM' => 'Zambia',
2258
+ 'ZW' => 'Zimbabwe'
2259
+ }.keys.grep(/#{key}/)
2260
+ end
2261
+
2262
+ def self.has_key?(key)
2263
+ {
2264
+ 'AF' => 'Afghanistan',
2265
+ 'AL' => 'Albania',
2266
+ 'DZ' => 'Algeria',
2267
+ 'AS' => 'American Samoa',
2268
+ 'AD' => 'Andorra',
2269
+ 'AO' => 'Angola',
2270
+ 'AI' => 'Anguilla',
2271
+ 'AQ' => 'Antarctica',
2272
+ 'AG' => 'Antigua And Barbuda',
2273
+ 'AR' => 'Argentina',
2274
+ 'AM' => 'Armenia',
2275
+ 'AW' => 'Aruba',
2276
+ 'AU' => 'Australia',
2277
+ 'AT' => 'Austria',
2278
+ 'AZ' => 'Azerbaijan',
2279
+ 'BS' => 'Bahamas',
2280
+ 'BH' => 'Bahrain',
2281
+ 'BD' => 'Bangladesh',
2282
+ 'BB' => 'Barbados',
2283
+ 'BY' => 'Belarus',
2284
+ 'BE' => 'Belgium',
2285
+ 'BZ' => 'Belize',
2286
+ 'BJ' => 'Benin',
2287
+ 'BM' => 'Bermuda',
2288
+ 'BT' => 'Bhutan',
2289
+ 'BO' => 'Bolivia',
2290
+ 'BA' => 'Bosnia And Herzegovina',
2291
+ 'BW' => 'Botswana',
2292
+ 'BV' => 'Bouvet Island',
2293
+ 'BR' => 'Brazil',
2294
+ 'IO' => 'British Indian Ocean Territory',
2295
+ 'BN' => 'Brunei Darussalam',
2296
+ 'BG' => 'Bulgaria',
2297
+ 'BF' => 'Burkina Faso',
2298
+ 'BI' => 'Burundi',
2299
+ 'KH' => 'Cambodia',
2300
+ 'CM' => 'Cameroon',
2301
+ 'CA' => 'Canada',
2302
+ 'CV' => 'Cape Verde',
2303
+ 'KY' => 'Cayman Islands',
2304
+ 'CF' => 'Central African Republic',
2305
+ 'TD' => 'Chad',
2306
+ 'CL' => 'Chile',
2307
+ 'CN' => 'China',
2308
+ 'CX' => 'Christmas Island',
2309
+ 'CC' => 'Cocos (keeling) Islands',
2310
+ 'CO' => 'Colombia',
2311
+ 'KM' => 'Comoros',
2312
+ 'CG' => 'Congo',
2313
+ 'CD' => 'Congo, The Democratic Republic Of The',
2314
+ 'CK' => 'Cook Islands',
2315
+ 'CR' => 'Costa Rica',
2316
+ 'CI' => 'Cote D\'ivoire',
2317
+ 'HR' => 'Croatia',
2318
+ 'CU' => 'Cuba',
2319
+ 'CY' => 'Cyprus',
2320
+ 'CZ' => 'Czech Republic',
2321
+ 'DK' => 'Denmark',
2322
+ 'DJ' => 'Djibouti',
2323
+ 'DM' => 'Dominica',
2324
+ 'DO' => 'Dominican Republic',
2325
+ 'TP' => 'East Timor',
2326
+ 'EC' => 'Ecuador',
2327
+ 'EG' => 'Egypt',
2328
+ 'SV' => 'El Salvador',
2329
+ 'GQ' => 'Equatorial Guinea',
2330
+ 'ER' => 'Eritrea',
2331
+ 'EE' => 'Estonia',
2332
+ 'ET' => 'Ethiopia',
2333
+ 'FK' => 'Falkland Islands (malvinas)',
2334
+ 'FO' => 'Faroe Islands',
2335
+ 'FJ' => 'Fiji',
2336
+ 'FI' => 'Finland',
2337
+ 'FR' => 'France',
2338
+ 'GF' => 'French Guiana',
2339
+ 'PF' => 'French Polynesia',
2340
+ 'TF' => 'French Southern Territories',
2341
+ 'GA' => 'Gabon',
2342
+ 'GM' => 'Gambia',
2343
+ 'GE' => 'Georgia',
2344
+ 'DE' => 'Germany',
2345
+ 'GH' => 'Ghana',
2346
+ 'GI' => 'Gibraltar',
2347
+ 'GR' => 'Greece',
2348
+ 'GL' => 'Greenland',
2349
+ 'GD' => 'Grenada',
2350
+ 'GP' => 'Guadeloupe',
2351
+ 'GU' => 'Guam',
2352
+ 'GT' => 'Guatemala',
2353
+ 'GN' => 'Guinea',
2354
+ 'GW' => 'Guinea-bissau',
2355
+ 'GY' => 'Guyana',
2356
+ 'HT' => 'Haiti',
2357
+ 'HM' => 'Heard Island And Mcdonald Islands',
2358
+ 'VA' => 'Holy See (vatican City State)',
2359
+ 'HN' => 'Honduras',
2360
+ 'HK' => 'Hong Kong',
2361
+ 'HU' => 'Hungary',
2362
+ 'IS' => 'Iceland',
2363
+ 'IN' => 'India',
2364
+ 'ID' => 'Indonesia',
2365
+ 'IR' => 'Iran, Islamic Republic Of',
2366
+ 'IQ' => 'Iraq',
2367
+ 'IE' => 'Ireland',
2368
+ 'IL' => 'Israel',
2369
+ 'IT' => 'Italy',
2370
+ 'JM' => 'Jamaica',
2371
+ 'JP' => 'Japan',
2372
+ 'JO' => 'Jordan',
2373
+ 'KZ' => 'Kazakstan',
2374
+ 'KE' => 'Kenya',
2375
+ 'KI' => 'Kiribati',
2376
+ 'KP' => 'Korea, Democratic People\'s Republic Of',
2377
+ 'KR' => 'Korea, Republic Of',
2378
+ 'KV' => 'Kosovo',
2379
+ 'KW' => 'Kuwait',
2380
+ 'KG' => 'Kyrgyzstan',
2381
+ 'LA' => 'Lao People\'s Democratic Republic',
2382
+ 'LV' => 'Latvia',
2383
+ 'LB' => 'Lebanon',
2384
+ 'LS' => 'Lesotho',
2385
+ 'LR' => 'Liberia',
2386
+ 'LY' => 'Libyan Arab Jamahiriya',
2387
+ 'LI' => 'Liechtenstein',
2388
+ 'LT' => 'Lithuania',
2389
+ 'LU' => 'Luxembourg',
2390
+ 'MO' => 'Macau',
2391
+ 'MK' => 'Macedonia, The Former Yugoslav Republic Of',
2392
+ 'MG' => 'Madagascar',
2393
+ 'MW' => 'Malawi',
2394
+ 'MY' => 'Malaysia',
2395
+ 'MV' => 'Maldives',
2396
+ 'ML' => 'Mali',
2397
+ 'MT' => 'Malta',
2398
+ 'MH' => 'Marshall Islands',
2399
+ 'MQ' => 'Martinique',
2400
+ 'MR' => 'Mauritania',
2401
+ 'MU' => 'Mauritius',
2402
+ 'YT' => 'Mayotte',
2403
+ 'MX' => 'Mexico',
2404
+ 'FM' => 'Micronesia, Federated States Of',
2405
+ 'MD' => 'Moldova, Republic Of',
2406
+ 'MC' => 'Monaco',
2407
+ 'MN' => 'Mongolia',
2408
+ 'MS' => 'Montserrat',
2409
+ 'ME' => 'Montenegro',
2410
+ 'MA' => 'Morocco',
2411
+ 'MZ' => 'Mozambique',
2412
+ 'MM' => 'Myanmar',
2413
+ 'NA' => 'Namibia',
2414
+ 'NR' => 'Nauru',
2415
+ 'NP' => 'Nepal',
2416
+ 'NL' => 'Netherlands',
2417
+ 'AN' => 'Netherlands Antilles',
2418
+ 'NC' => 'New Caledonia',
2419
+ 'NZ' => 'New Zealand',
2420
+ 'NI' => 'Nicaragua',
2421
+ 'NE' => 'Niger',
2422
+ 'NG' => 'Nigeria',
2423
+ 'NU' => 'Niue',
2424
+ 'NF' => 'Norfolk Island',
2425
+ 'MP' => 'Northern Mariana Islands',
2426
+ 'NO' => 'Norway',
2427
+ 'OM' => 'Oman',
2428
+ 'PK' => 'Pakistan',
2429
+ 'PW' => 'Palau',
2430
+ 'PS' => 'Palestinian Territory, Occupied',
2431
+ 'PA' => 'Panama',
2432
+ 'PG' => 'Papua New Guinea',
2433
+ 'PY' => 'Paraguay',
2434
+ 'PE' => 'Peru',
2435
+ 'PH' => 'Philippines',
2436
+ 'PN' => 'Pitcairn',
2437
+ 'PL' => 'Poland',
2438
+ 'PT' => 'Portugal',
2439
+ 'PR' => 'Puerto Rico',
2440
+ 'QA' => 'Qatar',
2441
+ 'RE' => 'Reunion',
2442
+ 'RO' => 'Romania',
2443
+ 'RU' => 'Russian Federation',
2444
+ 'RW' => 'Rwanda',
2445
+ 'SH' => 'Saint Helena',
2446
+ 'KN' => 'Saint Kitts And Nevis',
2447
+ 'LC' => 'Saint Lucia',
2448
+ 'PM' => 'Saint Pierre And Miquelon',
2449
+ 'VC' => 'Saint Vincent And The Grenadines',
2450
+ 'WS' => 'Samoa',
2451
+ 'SM' => 'San Marino',
2452
+ 'ST' => 'Sao Tome And Principe',
2453
+ 'SA' => 'Saudi Arabia',
2454
+ 'SN' => 'Senegal',
2455
+ 'RS' => 'Serbia',
2456
+ 'SC' => 'Seychelles',
2457
+ 'SL' => 'Sierra Leone',
2458
+ 'SG' => 'Singapore',
2459
+ 'SK' => 'Slovakia',
2460
+ 'SI' => 'Slovenia',
2461
+ 'SB' => 'Solomon Islands',
2462
+ 'SO' => 'Somalia',
2463
+ 'ZA' => 'South Africa',
2464
+ 'GS' => 'South Georgia And The South Sandwich Islands',
2465
+ 'ES' => 'Spain',
2466
+ 'LK' => 'Sri Lanka',
2467
+ 'SD' => 'Sudan',
2468
+ 'SR' => 'Suriname',
2469
+ 'SJ' => 'Svalbard And Jan Mayen',
2470
+ 'SZ' => 'Swaziland',
2471
+ 'SE' => 'Sweden',
2472
+ 'CH' => 'Switzerland',
2473
+ 'SY' => 'Syrian Arab Republic',
2474
+ 'TW' => 'Taiwan, Province Of China',
2475
+ 'TJ' => 'Tajikistan',
2476
+ 'TZ' => 'Tanzania, United Republic Of',
2477
+ 'TH' => 'Thailand',
2478
+ 'TG' => 'Togo',
2479
+ 'TK' => 'Tokelau',
2480
+ 'TO' => 'Tonga',
2481
+ 'TT' => 'Trinidad And Tobago',
2482
+ 'TN' => 'Tunisia',
2483
+ 'TR' => 'Turkey',
2484
+ 'TM' => 'Turkmenistan',
2485
+ 'TC' => 'Turks And Caicos Islands',
2486
+ 'TV' => 'Tuvalu',
2487
+ 'UG' => 'Uganda',
2488
+ 'UA' => 'Ukraine',
2489
+ 'AE' => 'United Arab Emirates',
2490
+ 'GB' => 'United Kingdom',
2491
+ 'US' => 'United States',
2492
+ 'UM' => 'United States Minor Outlying Islands',
2493
+ 'UY' => 'Uruguay',
2494
+ 'UZ' => 'Uzbekistan',
2495
+ 'VU' => 'Vanuatu',
2496
+ 'VE' => 'Venezuela',
2497
+ 'VN' => 'Viet Nam',
2498
+ 'VG' => 'Virgin Islands, British',
2499
+ 'VI' => 'Virgin Islands, U.s.',
2500
+ 'WF' => 'Wallis And Futuna',
2501
+ 'EH' => 'Western Sahara',
2502
+ 'YE' => 'Yemen',
2503
+ 'ZM' => 'Zambia',
2504
+ 'ZW' => 'Zimbabwe'
2505
+ }[key].nil? ? false : true
2506
+ end
2507
+
2508
+ def self.alias
2509
+ {
2510
+ 'AF' => 'Afghanistan',
2511
+ 'AL' => 'Albania',
2512
+ 'DZ' => 'Algeria',
2513
+ 'AS' => 'American Samoa',
2514
+ 'AD' => 'Andorra',
2515
+ 'AO' => 'Angola',
2516
+ 'AI' => 'Anguilla',
2517
+ 'AQ' => 'Antarctica',
2518
+ 'AG' => 'Antigua And Barbuda',
2519
+ 'AR' => 'Argentina',
2520
+ 'AM' => 'Armenia',
2521
+ 'AW' => 'Aruba',
2522
+ 'AU' => 'Australia',
2523
+ 'AT' => 'Austria',
2524
+ 'AZ' => 'Azerbaijan',
2525
+ 'BS' => 'Bahamas',
2526
+ 'BH' => 'Bahrain',
2527
+ 'BD' => 'Bangladesh',
2528
+ 'BB' => 'Barbados',
2529
+ 'BY' => 'Belarus',
2530
+ 'BE' => 'Belgium',
2531
+ 'BZ' => 'Belize',
2532
+ 'BJ' => 'Benin',
2533
+ 'BM' => 'Bermuda',
2534
+ 'BT' => 'Bhutan',
2535
+ 'BO' => 'Bolivia',
2536
+ 'BA' => 'Bosnia And Herzegovina',
2537
+ 'BW' => 'Botswana',
2538
+ 'BV' => 'Bouvet Island',
2539
+ 'BR' => 'Brazil',
2540
+ 'IO' => 'British Indian Ocean Territory',
2541
+ 'BN' => 'Brunei Darussalam',
2542
+ 'BG' => 'Bulgaria',
2543
+ 'BF' => 'Burkina Faso',
2544
+ 'BI' => 'Burundi',
2545
+ 'KH' => 'Cambodia',
2546
+ 'CM' => 'Cameroon',
2547
+ 'CA' => 'Canada',
2548
+ 'CV' => 'Cape Verde',
2549
+ 'KY' => 'Cayman Islands',
2550
+ 'CF' => 'Central African Republic',
2551
+ 'TD' => 'Chad',
2552
+ 'CL' => 'Chile',
2553
+ 'CN' => 'China',
2554
+ 'CX' => 'Christmas Island',
2555
+ 'CC' => 'Cocos (keeling) Islands',
2556
+ 'CO' => 'Colombia',
2557
+ 'KM' => 'Comoros',
2558
+ 'CG' => 'Congo',
2559
+ 'CD' => 'Congo, The Democratic Republic Of The',
2560
+ 'CK' => 'Cook Islands',
2561
+ 'CR' => 'Costa Rica',
2562
+ 'CI' => 'Cote D\'ivoire',
2563
+ 'HR' => 'Croatia',
2564
+ 'CU' => 'Cuba',
2565
+ 'CY' => 'Cyprus',
2566
+ 'CZ' => 'Czech Republic',
2567
+ 'DK' => 'Denmark',
2568
+ 'DJ' => 'Djibouti',
2569
+ 'DM' => 'Dominica',
2570
+ 'DO' => 'Dominican Republic',
2571
+ 'TP' => 'East Timor',
2572
+ 'EC' => 'Ecuador',
2573
+ 'EG' => 'Egypt',
2574
+ 'SV' => 'El Salvador',
2575
+ 'GQ' => 'Equatorial Guinea',
2576
+ 'ER' => 'Eritrea',
2577
+ 'EE' => 'Estonia',
2578
+ 'ET' => 'Ethiopia',
2579
+ 'FK' => 'Falkland Islands (malvinas)',
2580
+ 'FO' => 'Faroe Islands',
2581
+ 'FJ' => 'Fiji',
2582
+ 'FI' => 'Finland',
2583
+ 'FR' => 'France',
2584
+ 'GF' => 'French Guiana',
2585
+ 'PF' => 'French Polynesia',
2586
+ 'TF' => 'French Southern Territories',
2587
+ 'GA' => 'Gabon',
2588
+ 'GM' => 'Gambia',
2589
+ 'GE' => 'Georgia',
2590
+ 'DE' => 'Germany',
2591
+ 'GH' => 'Ghana',
2592
+ 'GI' => 'Gibraltar',
2593
+ 'GR' => 'Greece',
2594
+ 'GL' => 'Greenland',
2595
+ 'GD' => 'Grenada',
2596
+ 'GP' => 'Guadeloupe',
2597
+ 'GU' => 'Guam',
2598
+ 'GT' => 'Guatemala',
2599
+ 'GN' => 'Guinea',
2600
+ 'GW' => 'Guinea-bissau',
2601
+ 'GY' => 'Guyana',
2602
+ 'HT' => 'Haiti',
2603
+ 'HM' => 'Heard Island And Mcdonald Islands',
2604
+ 'VA' => 'Holy See (vatican City State)',
2605
+ 'HN' => 'Honduras',
2606
+ 'HK' => 'Hong Kong',
2607
+ 'HU' => 'Hungary',
2608
+ 'IS' => 'Iceland',
2609
+ 'IN' => 'India',
2610
+ 'ID' => 'Indonesia',
2611
+ 'IR' => 'Iran, Islamic Republic Of',
2612
+ 'IQ' => 'Iraq',
2613
+ 'IE' => 'Ireland',
2614
+ 'IL' => 'Israel',
2615
+ 'IT' => 'Italy',
2616
+ 'JM' => 'Jamaica',
2617
+ 'JP' => 'Japan',
2618
+ 'JO' => 'Jordan',
2619
+ 'KZ' => 'Kazakstan',
2620
+ 'KE' => 'Kenya',
2621
+ 'KI' => 'Kiribati',
2622
+ 'KP' => 'Korea, Democratic People\'s Republic Of',
2623
+ 'KR' => 'Korea, Republic Of',
2624
+ 'KV' => 'Kosovo',
2625
+ 'KW' => 'Kuwait',
2626
+ 'KG' => 'Kyrgyzstan',
2627
+ 'LA' => 'Lao People\'s Democratic Republic',
2628
+ 'LV' => 'Latvia',
2629
+ 'LB' => 'Lebanon',
2630
+ 'LS' => 'Lesotho',
2631
+ 'LR' => 'Liberia',
2632
+ 'LY' => 'Libyan Arab Jamahiriya',
2633
+ 'LI' => 'Liechtenstein',
2634
+ 'LT' => 'Lithuania',
2635
+ 'LU' => 'Luxembourg',
2636
+ 'MO' => 'Macau',
2637
+ 'MK' => 'Macedonia, The Former Yugoslav Republic Of',
2638
+ 'MG' => 'Madagascar',
2639
+ 'MW' => 'Malawi',
2640
+ 'MY' => 'Malaysia',
2641
+ 'MV' => 'Maldives',
2642
+ 'ML' => 'Mali',
2643
+ 'MT' => 'Malta',
2644
+ 'MH' => 'Marshall Islands',
2645
+ 'MQ' => 'Martinique',
2646
+ 'MR' => 'Mauritania',
2647
+ 'MU' => 'Mauritius',
2648
+ 'YT' => 'Mayotte',
2649
+ 'MX' => 'Mexico',
2650
+ 'FM' => 'Micronesia, Federated States Of',
2651
+ 'MD' => 'Moldova, Republic Of',
2652
+ 'MC' => 'Monaco',
2653
+ 'MN' => 'Mongolia',
2654
+ 'MS' => 'Montserrat',
2655
+ 'ME' => 'Montenegro',
2656
+ 'MA' => 'Morocco',
2657
+ 'MZ' => 'Mozambique',
2658
+ 'MM' => 'Myanmar',
2659
+ 'NA' => 'Namibia',
2660
+ 'NR' => 'Nauru',
2661
+ 'NP' => 'Nepal',
2662
+ 'NL' => 'Netherlands',
2663
+ 'AN' => 'Netherlands Antilles',
2664
+ 'NC' => 'New Caledonia',
2665
+ 'NZ' => 'New Zealand',
2666
+ 'NI' => 'Nicaragua',
2667
+ 'NE' => 'Niger',
2668
+ 'NG' => 'Nigeria',
2669
+ 'NU' => 'Niue',
2670
+ 'NF' => 'Norfolk Island',
2671
+ 'MP' => 'Northern Mariana Islands',
2672
+ 'NO' => 'Norway',
2673
+ 'OM' => 'Oman',
2674
+ 'PK' => 'Pakistan',
2675
+ 'PW' => 'Palau',
2676
+ 'PS' => 'Palestinian Territory, Occupied',
2677
+ 'PA' => 'Panama',
2678
+ 'PG' => 'Papua New Guinea',
2679
+ 'PY' => 'Paraguay',
2680
+ 'PE' => 'Peru',
2681
+ 'PH' => 'Philippines',
2682
+ 'PN' => 'Pitcairn',
2683
+ 'PL' => 'Poland',
2684
+ 'PT' => 'Portugal',
2685
+ 'PR' => 'Puerto Rico',
2686
+ 'QA' => 'Qatar',
2687
+ 'RE' => 'Reunion',
2688
+ 'RO' => 'Romania',
2689
+ 'RU' => 'Russian Federation',
2690
+ 'RW' => 'Rwanda',
2691
+ 'SH' => 'Saint Helena',
2692
+ 'KN' => 'Saint Kitts And Nevis',
2693
+ 'LC' => 'Saint Lucia',
2694
+ 'PM' => 'Saint Pierre And Miquelon',
2695
+ 'VC' => 'Saint Vincent And The Grenadines',
2696
+ 'WS' => 'Samoa',
2697
+ 'SM' => 'San Marino',
2698
+ 'ST' => 'Sao Tome And Principe',
2699
+ 'SA' => 'Saudi Arabia',
2700
+ 'SN' => 'Senegal',
2701
+ 'RS' => 'Serbia',
2702
+ 'SC' => 'Seychelles',
2703
+ 'SL' => 'Sierra Leone',
2704
+ 'SG' => 'Singapore',
2705
+ 'SK' => 'Slovakia',
2706
+ 'SI' => 'Slovenia',
2707
+ 'SB' => 'Solomon Islands',
2708
+ 'SO' => 'Somalia',
2709
+ 'ZA' => 'South Africa',
2710
+ 'GS' => 'South Georgia And The South Sandwich Islands',
2711
+ 'ES' => 'Spain',
2712
+ 'LK' => 'Sri Lanka',
2713
+ 'SD' => 'Sudan',
2714
+ 'SR' => 'Suriname',
2715
+ 'SJ' => 'Svalbard And Jan Mayen',
2716
+ 'SZ' => 'Swaziland',
2717
+ 'SE' => 'Sweden',
2718
+ 'CH' => 'Switzerland',
2719
+ 'SY' => 'Syrian Arab Republic',
2720
+ 'TW' => 'Taiwan, Province Of China',
2721
+ 'TJ' => 'Tajikistan',
2722
+ 'TZ' => 'Tanzania, United Republic Of',
2723
+ 'TH' => 'Thailand',
2724
+ 'TG' => 'Togo',
2725
+ 'TK' => 'Tokelau',
2726
+ 'TO' => 'Tonga',
2727
+ 'TT' => 'Trinidad And Tobago',
2728
+ 'TN' => 'Tunisia',
2729
+ 'TR' => 'Turkey',
2730
+ 'TM' => 'Turkmenistan',
2731
+ 'TC' => 'Turks And Caicos Islands',
2732
+ 'TV' => 'Tuvalu',
2733
+ 'UG' => 'Uganda',
2734
+ 'UA' => 'Ukraine',
2735
+ 'AE' => 'United Arab Emirates',
2736
+ 'GB' => 'United Kingdom',
2737
+ 'US' => 'United States',
2738
+ 'UM' => 'United States Minor Outlying Islands',
2739
+ 'UY' => 'Uruguay',
2740
+ 'UZ' => 'Uzbekistan',
2741
+ 'VU' => 'Vanuatu',
2742
+ 'VE' => 'Venezuela',
2743
+ 'VN' => 'Viet Nam',
2744
+ 'VG' => 'Virgin Islands, British',
2745
+ 'VI' => 'Virgin Islands, U.s.',
2746
+ 'WF' => 'Wallis And Futuna',
2747
+ 'EH' => 'Western Sahara',
2748
+ 'YE' => 'Yemen',
2749
+ 'ZM' => 'Zambia',
2750
+ 'ZW' => 'Zimbabwe'
2751
+ }.keys
2752
+ end
2753
+
2754
+ def self.name
2755
+ {
2756
+ 'AF' => 'Afghanistan',
2757
+ 'AL' => 'Albania',
2758
+ 'DZ' => 'Algeria',
2759
+ 'AS' => 'American Samoa',
2760
+ 'AD' => 'Andorra',
2761
+ 'AO' => 'Angola',
2762
+ 'AI' => 'Anguilla',
2763
+ 'AQ' => 'Antarctica',
2764
+ 'AG' => 'Antigua And Barbuda',
2765
+ 'AR' => 'Argentina',
2766
+ 'AM' => 'Armenia',
2767
+ 'AW' => 'Aruba',
2768
+ 'AU' => 'Australia',
2769
+ 'AT' => 'Austria',
2770
+ 'AZ' => 'Azerbaijan',
2771
+ 'BS' => 'Bahamas',
2772
+ 'BH' => 'Bahrain',
2773
+ 'BD' => 'Bangladesh',
2774
+ 'BB' => 'Barbados',
2775
+ 'BY' => 'Belarus',
2776
+ 'BE' => 'Belgium',
2777
+ 'BZ' => 'Belize',
2778
+ 'BJ' => 'Benin',
2779
+ 'BM' => 'Bermuda',
2780
+ 'BT' => 'Bhutan',
2781
+ 'BO' => 'Bolivia',
2782
+ 'BA' => 'Bosnia And Herzegovina',
2783
+ 'BW' => 'Botswana',
2784
+ 'BV' => 'Bouvet Island',
2785
+ 'BR' => 'Brazil',
2786
+ 'IO' => 'British Indian Ocean Territory',
2787
+ 'BN' => 'Brunei Darussalam',
2788
+ 'BG' => 'Bulgaria',
2789
+ 'BF' => 'Burkina Faso',
2790
+ 'BI' => 'Burundi',
2791
+ 'KH' => 'Cambodia',
2792
+ 'CM' => 'Cameroon',
2793
+ 'CA' => 'Canada',
2794
+ 'CV' => 'Cape Verde',
2795
+ 'KY' => 'Cayman Islands',
2796
+ 'CF' => 'Central African Republic',
2797
+ 'TD' => 'Chad',
2798
+ 'CL' => 'Chile',
2799
+ 'CN' => 'China',
2800
+ 'CX' => 'Christmas Island',
2801
+ 'CC' => 'Cocos (keeling) Islands',
2802
+ 'CO' => 'Colombia',
2803
+ 'KM' => 'Comoros',
2804
+ 'CG' => 'Congo',
2805
+ 'CD' => 'Congo, The Democratic Republic Of The',
2806
+ 'CK' => 'Cook Islands',
2807
+ 'CR' => 'Costa Rica',
2808
+ 'CI' => 'Cote D\'ivoire',
2809
+ 'HR' => 'Croatia',
2810
+ 'CU' => 'Cuba',
2811
+ 'CY' => 'Cyprus',
2812
+ 'CZ' => 'Czech Republic',
2813
+ 'DK' => 'Denmark',
2814
+ 'DJ' => 'Djibouti',
2815
+ 'DM' => 'Dominica',
2816
+ 'DO' => 'Dominican Republic',
2817
+ 'TP' => 'East Timor',
2818
+ 'EC' => 'Ecuador',
2819
+ 'EG' => 'Egypt',
2820
+ 'SV' => 'El Salvador',
2821
+ 'GQ' => 'Equatorial Guinea',
2822
+ 'ER' => 'Eritrea',
2823
+ 'EE' => 'Estonia',
2824
+ 'ET' => 'Ethiopia',
2825
+ 'FK' => 'Falkland Islands (malvinas)',
2826
+ 'FO' => 'Faroe Islands',
2827
+ 'FJ' => 'Fiji',
2828
+ 'FI' => 'Finland',
2829
+ 'FR' => 'France',
2830
+ 'GF' => 'French Guiana',
2831
+ 'PF' => 'French Polynesia',
2832
+ 'TF' => 'French Southern Territories',
2833
+ 'GA' => 'Gabon',
2834
+ 'GM' => 'Gambia',
2835
+ 'GE' => 'Georgia',
2836
+ 'DE' => 'Germany',
2837
+ 'GH' => 'Ghana',
2838
+ 'GI' => 'Gibraltar',
2839
+ 'GR' => 'Greece',
2840
+ 'GL' => 'Greenland',
2841
+ 'GD' => 'Grenada',
2842
+ 'GP' => 'Guadeloupe',
2843
+ 'GU' => 'Guam',
2844
+ 'GT' => 'Guatemala',
2845
+ 'GN' => 'Guinea',
2846
+ 'GW' => 'Guinea-bissau',
2847
+ 'GY' => 'Guyana',
2848
+ 'HT' => 'Haiti',
2849
+ 'HM' => 'Heard Island And Mcdonald Islands',
2850
+ 'VA' => 'Holy See (vatican City State)',
2851
+ 'HN' => 'Honduras',
2852
+ 'HK' => 'Hong Kong',
2853
+ 'HU' => 'Hungary',
2854
+ 'IS' => 'Iceland',
2855
+ 'IN' => 'India',
2856
+ 'ID' => 'Indonesia',
2857
+ 'IR' => 'Iran, Islamic Republic Of',
2858
+ 'IQ' => 'Iraq',
2859
+ 'IE' => 'Ireland',
2860
+ 'IL' => 'Israel',
2861
+ 'IT' => 'Italy',
2862
+ 'JM' => 'Jamaica',
2863
+ 'JP' => 'Japan',
2864
+ 'JO' => 'Jordan',
2865
+ 'KZ' => 'Kazakstan',
2866
+ 'KE' => 'Kenya',
2867
+ 'KI' => 'Kiribati',
2868
+ 'KP' => 'Korea, Democratic People\'s Republic Of',
2869
+ 'KR' => 'Korea, Republic Of',
2870
+ 'KV' => 'Kosovo',
2871
+ 'KW' => 'Kuwait',
2872
+ 'KG' => 'Kyrgyzstan',
2873
+ 'LA' => 'Lao People\'s Democratic Republic',
2874
+ 'LV' => 'Latvia',
2875
+ 'LB' => 'Lebanon',
2876
+ 'LS' => 'Lesotho',
2877
+ 'LR' => 'Liberia',
2878
+ 'LY' => 'Libyan Arab Jamahiriya',
2879
+ 'LI' => 'Liechtenstein',
2880
+ 'LT' => 'Lithuania',
2881
+ 'LU' => 'Luxembourg',
2882
+ 'MO' => 'Macau',
2883
+ 'MK' => 'Macedonia, The Former Yugoslav Republic Of',
2884
+ 'MG' => 'Madagascar',
2885
+ 'MW' => 'Malawi',
2886
+ 'MY' => 'Malaysia',
2887
+ 'MV' => 'Maldives',
2888
+ 'ML' => 'Mali',
2889
+ 'MT' => 'Malta',
2890
+ 'MH' => 'Marshall Islands',
2891
+ 'MQ' => 'Martinique',
2892
+ 'MR' => 'Mauritania',
2893
+ 'MU' => 'Mauritius',
2894
+ 'YT' => 'Mayotte',
2895
+ 'MX' => 'Mexico',
2896
+ 'FM' => 'Micronesia, Federated States Of',
2897
+ 'MD' => 'Moldova, Republic Of',
2898
+ 'MC' => 'Monaco',
2899
+ 'MN' => 'Mongolia',
2900
+ 'MS' => 'Montserrat',
2901
+ 'ME' => 'Montenegro',
2902
+ 'MA' => 'Morocco',
2903
+ 'MZ' => 'Mozambique',
2904
+ 'MM' => 'Myanmar',
2905
+ 'NA' => 'Namibia',
2906
+ 'NR' => 'Nauru',
2907
+ 'NP' => 'Nepal',
2908
+ 'NL' => 'Netherlands',
2909
+ 'AN' => 'Netherlands Antilles',
2910
+ 'NC' => 'New Caledonia',
2911
+ 'NZ' => 'New Zealand',
2912
+ 'NI' => 'Nicaragua',
2913
+ 'NE' => 'Niger',
2914
+ 'NG' => 'Nigeria',
2915
+ 'NU' => 'Niue',
2916
+ 'NF' => 'Norfolk Island',
2917
+ 'MP' => 'Northern Mariana Islands',
2918
+ 'NO' => 'Norway',
2919
+ 'OM' => 'Oman',
2920
+ 'PK' => 'Pakistan',
2921
+ 'PW' => 'Palau',
2922
+ 'PS' => 'Palestinian Territory, Occupied',
2923
+ 'PA' => 'Panama',
2924
+ 'PG' => 'Papua New Guinea',
2925
+ 'PY' => 'Paraguay',
2926
+ 'PE' => 'Peru',
2927
+ 'PH' => 'Philippines',
2928
+ 'PN' => 'Pitcairn',
2929
+ 'PL' => 'Poland',
2930
+ 'PT' => 'Portugal',
2931
+ 'PR' => 'Puerto Rico',
2932
+ 'QA' => 'Qatar',
2933
+ 'RE' => 'Reunion',
2934
+ 'RO' => 'Romania',
2935
+ 'RU' => 'Russian Federation',
2936
+ 'RW' => 'Rwanda',
2937
+ 'SH' => 'Saint Helena',
2938
+ 'KN' => 'Saint Kitts And Nevis',
2939
+ 'LC' => 'Saint Lucia',
2940
+ 'PM' => 'Saint Pierre And Miquelon',
2941
+ 'VC' => 'Saint Vincent And The Grenadines',
2942
+ 'WS' => 'Samoa',
2943
+ 'SM' => 'San Marino',
2944
+ 'ST' => 'Sao Tome And Principe',
2945
+ 'SA' => 'Saudi Arabia',
2946
+ 'SN' => 'Senegal',
2947
+ 'RS' => 'Serbia',
2948
+ 'SC' => 'Seychelles',
2949
+ 'SL' => 'Sierra Leone',
2950
+ 'SG' => 'Singapore',
2951
+ 'SK' => 'Slovakia',
2952
+ 'SI' => 'Slovenia',
2953
+ 'SB' => 'Solomon Islands',
2954
+ 'SO' => 'Somalia',
2955
+ 'ZA' => 'South Africa',
2956
+ 'GS' => 'South Georgia And The South Sandwich Islands',
2957
+ 'ES' => 'Spain',
2958
+ 'LK' => 'Sri Lanka',
2959
+ 'SD' => 'Sudan',
2960
+ 'SR' => 'Suriname',
2961
+ 'SJ' => 'Svalbard And Jan Mayen',
2962
+ 'SZ' => 'Swaziland',
2963
+ 'SE' => 'Sweden',
2964
+ 'CH' => 'Switzerland',
2965
+ 'SY' => 'Syrian Arab Republic',
2966
+ 'TW' => 'Taiwan, Province Of China',
2967
+ 'TJ' => 'Tajikistan',
2968
+ 'TZ' => 'Tanzania, United Republic Of',
2969
+ 'TH' => 'Thailand',
2970
+ 'TG' => 'Togo',
2971
+ 'TK' => 'Tokelau',
2972
+ 'TO' => 'Tonga',
2973
+ 'TT' => 'Trinidad And Tobago',
2974
+ 'TN' => 'Tunisia',
2975
+ 'TR' => 'Turkey',
2976
+ 'TM' => 'Turkmenistan',
2977
+ 'TC' => 'Turks And Caicos Islands',
2978
+ 'TV' => 'Tuvalu',
2979
+ 'UG' => 'Uganda',
2980
+ 'UA' => 'Ukraine',
2981
+ 'AE' => 'United Arab Emirates',
2982
+ 'GB' => 'United Kingdom',
2983
+ 'US' => 'United States',
2984
+ 'UM' => 'United States Minor Outlying Islands',
2985
+ 'UY' => 'Uruguay',
2986
+ 'UZ' => 'Uzbekistan',
2987
+ 'VU' => 'Vanuatu',
2988
+ 'VE' => 'Venezuela',
2989
+ 'VN' => 'Viet Nam',
2990
+ 'VG' => 'Virgin Islands, British',
2991
+ 'VI' => 'Virgin Islands, U.s.',
2992
+ 'WF' => 'Wallis And Futuna',
2993
+ 'EH' => 'Western Sahara',
2994
+ 'YE' => 'Yemen',
2995
+ 'ZM' => 'Zambia',
2996
+ 'ZW' => 'Zimbabwe'
2997
+ }.values
2998
+ end
2999
+
3000
+ def self.states(country)
3001
+ CS.states(country)
3002
+ end
3003
+
3004
+ def self.cities(state, country)
3005
+ CS.cities(state, country)
3006
+ end
3007
+
3008
+ def self.custom_states(array = [])
3009
+ states = {}
3010
+ # array = ["us", "br"]
3011
+ array.each do |country|
3012
+ states = states.merge(CS.states(country))
3013
+ end
3014
+ states
3015
+ end
3016
+
3017
+ def self.custom_cities(array = {})
3018
+ cities = []
3019
+ # array = {
3020
+ # "us" => ["ak", "al"],
3021
+ # "br" => ["ac"]
3022
+ # }
3023
+ array.each do |k, v|
3024
+ v.each do |m|
3025
+ cities.concat(CS.cities(m, k))
3026
+ end
3027
+ end
3028
+ cities
3029
+ end
3030
+
3031
+ def self.cities_in_country(country = "US")
3032
+ states = CS.states(country)
3033
+ cities = []
3034
+ if states.count > 0
3035
+ states.each do |k, v|
3036
+ cities.concat(CS.cities(k, country))
3037
+ end
3038
+ end
3039
+ cities
3040
+ end
3041
+ end