city-state 0.0.10 → 0.0.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dfe91c13079d671f4da2fcd328c848c3dd20ab49
4
- data.tar.gz: 0f541c9110cc637fa777f73cd29c5015cc0cf223
3
+ metadata.gz: 9918b4889cf247b5f6c196c48cffff2316a31a08
4
+ data.tar.gz: 85ae7dd4c6c6eb957f5def645ba13a0d75157234
5
5
  SHA512:
6
- metadata.gz: 4543724c8dc5699064f98073307c643e214851bb74694102b3422567e115a3edfc7c3d3c6c5d208abb4f6a57fcbad669fc9ddabd0d010b63bd63c334f46af560
7
- data.tar.gz: 708a0a204e8236fdd5a048b1c1f924900f8ca8802b94075ef952c0e60957a696cead803c68ea2c687f4a350e60079585af07bb695049e252bb4c0d2cbebc56ae
6
+ metadata.gz: a41284b810528246d5daaf2a6c5b09ae902cbeb75bd174c9f9908e37a85b29e4bc63d8b4419319d4a5a6234fc46fc89594c446f27fb78c03546525cf463c626e
7
+ data.tar.gz: bc3ae7fc67c1963d20662e3bca64aad297e3f282a58d14854d1774ec6b4ea51fee253c76235de775a862035cf680bf1c7d8fa640c3d5a5461e8e347ef64d96fb
data/.gitignore CHANGED
@@ -14,4 +14,5 @@
14
14
  mkmf.log
15
15
  *.gem
16
16
  cities.*
17
- states.*
17
+ states.*
18
+ db/countries.yml
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # city-state ruby gem
2
2
 
3
- **city-state** is a very simple ruby gem that you can use to get a list of states in a country. Also, you can get a list of cities in a state.
3
+ **city-state** is a very simple ruby gem to get a list of states in a country. Also, you can get a list of cities in a state, and a list of all countries of the world.
4
4
 
5
5
  ## Put this gem at your Gemfile:
6
6
  ```ruby
@@ -26,6 +26,25 @@ CS.countries
26
26
  # => {:AD=>"Andorra", :AE=>"United Arab Emirates", :AF=>"Afghanistan", :AG=>"Antigua and Barbuda", :AI=>"Anguilla", :AL=>"Albania", :AM=>"Armenia", :AO=>"Angola", :AQ=>"Antarctica", :AR=>"Argentina", :AS=>"American Samoa", :AT=>"Austria", :AU=>"Australia", :AW=>"Aruba", :AX=>"Åland", :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-Barthélemy", :BM=>"Bermuda", :BN=>"Brunei", :BO=>"Bolivia", :BQ=>"Bonaire", :BR=>"Brazil", :BS=>"Bahamas", :BT=>"Bhutan", :BW=>"Botswana", :BY=>"Belarus", :BZ=>"Belize", :CA=>"Canada", :CC=>"Cocos [Keeling] Islands", :CD=>"Congo", :CF=>"Central African Republic", :CG=>"Republic of the Congo"}
27
27
  ```
28
28
 
29
+ ## Simplified syntax with *get* method:
30
+ * _CS.get_: list of countries (equivalent to `CS.countries`)
31
+ * _CS.get(country)_: list of states (equivalent to `CS.states(country)`)
32
+ * _CS.get(country, state)_: list of cities (equivalent to `CS.cities(state, country)`)
33
+
34
+ Example:
35
+ ```ruby
36
+ CS.get
37
+ # => {:AD=>"Andorra", :AE=>"United Arab Emirates", :AF=>"Afghanistan", :AG=>"Antigua and Barbuda", :AI=>"Anguilla", :AL=>"Albania", :AM=>"Armenia", :AO=>"Angola", :AQ=>"Antarctica", :AR=>"Argentina", :AS=>"American Samoa", :AT=>"Austria", :AU=>"Australia", :AW=>"Aruba", :AX=>"Åland", :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-Barthélemy", :BM=>"Bermuda", :BN=>"Brunei", :BO=>"Bolivia", :BQ=>"Bonaire", :BR=>"Brazil", :BS=>"Bahamas", :BT=>"Bhutan", :BW=>"Botswana", :BY=>"Belarus", :BZ=>"Belize", :CA=>"Canada", :CC=>"Cocos [Keeling] Islands", :CD=>"Congo", :CF=>"Central African Republic", :CG=>"Republic of the Congo"}
38
+ ```
39
+ ```ruby
40
+ CS.get :us
41
+ # => {:AK=>"Alaska", :AL=>"Alabama", :AR=>"Arkansas", :AZ=>"Arizona", :CA=>"California", :CO=>"Colorado", :CT=>"Connecticut", :DC=>"District of Columbia", :DE=>"Delaware", :FL=>"Florida", :GA=>"Georgia", :HI=>"Hawaii", :IA=>"Iowa", :ID=>"Idaho", :IL=>"Illinois", :IN=>"Indiana", :KS=>"Kansas", :KY=>"Kentucky", :LA=>"Louisiana", :MA=>"Massachusetts", :MD=>"Maryland", :ME=>"Maine", :MI=>"Michigan", :MN=>"Minnesota", :MO=>"Missouri", :MS=>"Mississippi", :MT=>"Montana", :NC=>"North Carolina", :ND=>"North Dakota", :NE=>"Nebraska", :NH=>"New Hampshire", :NJ=>"New Jersey", :NM=>"New Mexico", :NV=>"Nevada", :NY=>"New York", :OH=>"Ohio", :OK=>"Oklahoma", :OR=>"Oregon", :PA=>"Pennsylvania", :RI=>"Rhode Island", :SC=>"South Carolina", :SD=>"South Dakota", :TN=>"Tennessee", :TX=>"Texas", :UT=>"Utah", :VA=>"Virginia", :VT=>"Vermont", :WA=>"Washington", :WI=>"Wisconsin", :WV=>"West Virginia", :WY=>"Wyoming"}
42
+ ```
43
+ ```ruby
44
+ CS.get :us, :ak
45
+ # => ["Adak", "Akhiok", "Akiachak", "Akiak", "Akutan", "Alakanuk", "Ambler", "Anchor Point", "Anchorage", "Angoon", "Atqasuk", "Barrow", "Bell Island Hot Springs", "Bethel", "Big Lake", "Buckland", "Chefornak", "Chevak", "Chicken", "Chugiak", "Coffman Cove", "Cooper Landing", "Copper Center", "Cordova", "Craig", "Deltana", "Dillingham", "Douglas", "Dutch Harbor", "Eagle River", "Eielson Air Force Base", "Fairbanks", "Fairbanks North Star Borough", "Fort Greely", "Fort Richardson", "Galena", "Girdwood", "Goodnews Bay", "Haines", "Homer", "Hooper Bay", "Juneau", "Kake", "Kaktovik", "Kalskag", "Kenai", "Ketchikan", "Kiana", "King Cove", "King Salmon", "Kipnuk", "Klawock", "Kodiak", "Kongiganak", "Kotlik", "Koyuk", "Kwethluk", "Levelock", "Manokotak", "May Creek", "Mekoryuk", "Metlakatla", "Mountain Village", "Nabesna", "Naknek", "Nazan Village", "Nenana", "New Stuyahok", "Nikiski", "Ninilchik", "Noatak", "Nome", "Nondalton", "Noorvik", "North Pole", "Northway", "Old Kotzebue", "Palmer", "Pedro Bay", "Petersburg", "Pilot Station", "Point Hope", "Point Lay", "Prudhoe Bay", "Russian Mission", "Sand Point", "Scammon Bay", "Selawik", "Seward", "Shungnak", "Sitka", "Skaguay", "Soldotna", "Stebbins", "Sterling", "Sutton", "Talkeetna", "Teller", "Thorne Bay", "Togiak", "Tok", "Toksook Bay", "Tuntutuliak", "Two Rivers", "Unalakleet", "Unalaska", "Valdez", "Wainwright", "Wasilla"]
46
+ ```
47
+
29
48
  ## Update the database from MaxMind:
30
49
  MaxMind update their databases weekly on tuesdays. To get a new and updated version, you can update with:
31
50
  ```ruby
@@ -184,4 +184,12 @@ module CS
184
184
  end
185
185
  @countries
186
186
  end
187
+
188
+ # get is a method to simplify the use of city-state
189
+ # get = countries, get(country) = states(country), get(country, state) = cities(state, country)
190
+ def self.get(country = nil, state = nil)
191
+ return self.countries if country.nil?
192
+ return self.states(country) if state.nil?
193
+ return self.cities(state, country)
194
+ end
187
195
  end
@@ -1,3 +1,3 @@
1
1
  module CS
2
- VERSION = "0.0.10"
2
+ VERSION = "0.0.11"
3
3
  end
@@ -0,0 +1,249 @@
1
+ ---
2
+ :AD: Andorra
3
+ :AE: United Arab Emirates
4
+ :AF: Afghanistan
5
+ :AG: Antigua and Barbuda
6
+ :AI: Anguilla
7
+ :AL: Albania
8
+ :AM: Armenia
9
+ :AO: Angola
10
+ :AQ: Antarctica
11
+ :AR: Argentina
12
+ :AS: American Samoa
13
+ :AT: Austria
14
+ :AU: Australia
15
+ :AW: Aruba
16
+ :AX: "Åland"
17
+ :AZ: Azerbaijan
18
+ :BA: Bosnia and Herzegovina
19
+ :BB: Barbados
20
+ :BD: Bangladesh
21
+ :BE: Belgium
22
+ :BF: Burkina Faso
23
+ :BG: Bulgaria
24
+ :BH: Bahrain
25
+ :BI: Burundi
26
+ :BJ: Benin
27
+ :BL: Saint-Barthélemy
28
+ :BM: Bermuda
29
+ :BN: Brunei
30
+ :BO: Bolivia
31
+ :BQ: Bonaire
32
+ :BR: Brazil
33
+ :BS: Bahamas
34
+ :BT: Bhutan
35
+ :BW: Botswana
36
+ :BY: Belarus
37
+ :BZ: Belize
38
+ :CA: Canada
39
+ :CC: Cocos [Keeling] Islands
40
+ :CD: Congo
41
+ :CF: Central African Republic
42
+ :CG: Republic of the Congo
43
+ :CH: Switzerland
44
+ :CI: Ivory Coast
45
+ :CK: Cook Islands
46
+ :CL: Chile
47
+ :CM: Cameroon
48
+ :CN: China
49
+ :CO: Colombia
50
+ :COUNTRY_ISO_CODE: country_name
51
+ :CR: Costa Rica
52
+ :CU: Cuba
53
+ :CV: Cape Verde
54
+ :CW: Curaçao
55
+ :CX: Christmas Island
56
+ :CY: Cyprus
57
+ :CZ: Czech Republic
58
+ :DE: Germany
59
+ :DJ: Djibouti
60
+ :DK: Denmark
61
+ :DM: Dominica
62
+ :DO: Dominican Republic
63
+ :DZ: Algeria
64
+ :EC: Ecuador
65
+ :EE: Estonia
66
+ :EG: Egypt
67
+ :ER: Eritrea
68
+ :ES: Spain
69
+ :ET: Ethiopia
70
+ :FI: Finland
71
+ :FJ: Fiji
72
+ :FK: Falkland Islands
73
+ :FM: Federated States of Micronesia
74
+ :FO: Faroe Islands
75
+ :FR: France
76
+ :GA: Gabon
77
+ :GB: United Kingdom
78
+ :GD: Grenada
79
+ :GE: Georgia
80
+ :GF: French Guiana
81
+ :GG: Guernsey
82
+ :GH: Ghana
83
+ :GI: Gibraltar
84
+ :GL: Greenland
85
+ :GM: Gambia
86
+ :GN: Guinea
87
+ :GP: Guadeloupe
88
+ :GQ: Equatorial Guinea
89
+ :GR: Greece
90
+ :GS: South Georgia and the South Sandwich Islands
91
+ :GT: Guatemala
92
+ :GU: Guam
93
+ :GW: Guinea-Bissau
94
+ :GY: Guyana
95
+ :HK: Hong Kong
96
+ :HN: Honduras
97
+ :HR: Croatia
98
+ :HT: Haiti
99
+ :HU: Hungary
100
+ :ID: Indonesia
101
+ :IE: Ireland
102
+ :IL: Israel
103
+ :IM: Isle of Man
104
+ :IN: India
105
+ :IO: British Indian Ocean Territory
106
+ :IQ: Iraq
107
+ :IR: Iran
108
+ :IS: Iceland
109
+ :IT: Italy
110
+ :JE: Jersey
111
+ :JM: Jamaica
112
+ :JO: Hashemite Kingdom of Jordan
113
+ :JP: Japan
114
+ :KE: Kenya
115
+ :KG: Kyrgyzstan
116
+ :KH: Cambodia
117
+ :KI: Kiribati
118
+ :KM: Comoros
119
+ :KN: Saint Kitts and Nevis
120
+ :KP: North Korea
121
+ :KR: Republic of Korea
122
+ :KW: Kuwait
123
+ :KY: Cayman Islands
124
+ :KZ: Kazakhstan
125
+ :LA: Laos
126
+ :LB: Lebanon
127
+ :LC: Saint Lucia
128
+ :LI: Liechtenstein
129
+ :LK: Sri Lanka
130
+ :LR: Liberia
131
+ :LS: Lesotho
132
+ :LT: Republic of Lithuania
133
+ :LU: Luxembourg
134
+ :LV: Latvia
135
+ :LY: Libya
136
+ :MA: Morocco
137
+ :MC: Monaco
138
+ :MD: Republic of Moldova
139
+ :ME: Montenegro
140
+ :MF: Saint Martin
141
+ :MG: Madagascar
142
+ :MH: Marshall Islands
143
+ :MK: Macedonia
144
+ :ML: Mali
145
+ :MM: Myanmar [Burma]
146
+ :MN: Mongolia
147
+ :MO: Macao
148
+ :MP: Northern Mariana Islands
149
+ :MQ: Martinique
150
+ :MR: Mauritania
151
+ :MS: Montserrat
152
+ :MT: Malta
153
+ :MU: Mauritius
154
+ :MV: Maldives
155
+ :MW: Malawi
156
+ :MX: Mexico
157
+ :MY: Malaysia
158
+ :MZ: Mozambique
159
+ :NA: Namibia
160
+ :NC: New Caledonia
161
+ :NE: Niger
162
+ :NF: Norfolk Island
163
+ :NG: Nigeria
164
+ :NI: Nicaragua
165
+ :NL: Netherlands
166
+ :NO: Norway
167
+ :NP: Nepal
168
+ :NR: Nauru
169
+ :NU: Niue
170
+ :NZ: New Zealand
171
+ :OM: Oman
172
+ :PA: Panama
173
+ :PE: Peru
174
+ :PF: French Polynesia
175
+ :PG: Papua New Guinea
176
+ :PH: Philippines
177
+ :PK: Pakistan
178
+ :PL: Poland
179
+ :PM: Saint Pierre and Miquelon
180
+ :PN: Pitcairn Islands
181
+ :PR: Puerto Rico
182
+ :PS: Palestine
183
+ :PT: Portugal
184
+ :PW: Palau
185
+ :PY: Paraguay
186
+ :QA: Qatar
187
+ :RE: Réunion
188
+ :RO: Romania
189
+ :RS: Serbia
190
+ :RU: Russia
191
+ :RW: Rwanda
192
+ :SA: Saudi Arabia
193
+ :SB: Solomon Islands
194
+ :SC: Seychelles
195
+ :SD: Sudan
196
+ :SE: Sweden
197
+ :SG: Singapore
198
+ :SH: Saint Helena
199
+ :SI: Slovenia
200
+ :SJ: Svalbard and Jan Mayen
201
+ :SK: Slovakia
202
+ :SL: Sierra Leone
203
+ :SM: San Marino
204
+ :SN: Senegal
205
+ :SO: Somalia
206
+ :SR: Suriname
207
+ :SS: South Sudan
208
+ :ST: São Tomé and Príncipe
209
+ :SV: El Salvador
210
+ :SX: Sint Maarten
211
+ :SY: Syria
212
+ :SZ: Swaziland
213
+ :TC: Turks and Caicos Islands
214
+ :TD: Chad
215
+ :TF: French Southern Territories
216
+ :TG: Togo
217
+ :TH: Thailand
218
+ :TJ: Tajikistan
219
+ :TK: Tokelau
220
+ :TL: East Timor
221
+ :TM: Turkmenistan
222
+ :TN: Tunisia
223
+ :TO: Tonga
224
+ :TR: Turkey
225
+ :TT: Trinidad and Tobago
226
+ :TV: Tuvalu
227
+ :TW: Taiwan
228
+ :TZ: Tanzania
229
+ :UA: Ukraine
230
+ :UG: Uganda
231
+ :UM: U.S. Minor Outlying Islands
232
+ :US: United States
233
+ :UY: Uruguay
234
+ :UZ: Uzbekistan
235
+ :VA: Vatican City
236
+ :VC: Saint Vincent and the Grenadines
237
+ :VE: Venezuela
238
+ :VG: British Virgin Islands
239
+ :VI: U.S. Virgin Islands
240
+ :VN: Vietnam
241
+ :VU: Vanuatu
242
+ :WF: Wallis and Futuna
243
+ :WS: Samoa
244
+ :XK: Kosovo
245
+ :YE: Yemen
246
+ :YT: Mayotte
247
+ :ZA: South Africa
248
+ :ZM: Zambia
249
+ :ZW: Zimbabwe
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: city-state
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Loureiro
@@ -68,6 +68,7 @@ files:
68
68
  - lib/city-state.rb
69
69
  - lib/city-state/version.rb
70
70
  - lib/db/GeoLite2-City-Locations-en.csv
71
+ - lib/db/countries.yml
71
72
  - lib/db/states-replace.yml
72
73
  homepage: https://github.com/loureirorg/city-state
73
74
  licenses: