city-state 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +46 -0
- data/LICENSE.txt +1 -1
- data/README.md +63 -64
- data/city-state.gemspec +13 -6
- data/lib/city-state/version.rb +1 -1
- data/lib/city-state.rb +10 -9
- data/lib/db/GeoLite2-City-Locations-en.csv +47537 -51899
- data/lib/db/cities.us +22186 -0
- data/lib/db/countries.yml +14 -11
- data/lib/db/states.us +52 -0
- data/spec/city_state_spec.rb +31 -0
- data/spec/spec_helper.rb +1 -0
- metadata +31 -11
- data/.gitignore +0 -18
- data/Gemfile +0 -4
data/lib/db/countries.yml
CHANGED
@@ -13,7 +13,7 @@
|
|
13
13
|
:AT: Austria
|
14
14
|
:AU: Australia
|
15
15
|
:AW: Aruba
|
16
|
-
:AX:
|
16
|
+
:AX: Åland
|
17
17
|
:AZ: Azerbaijan
|
18
18
|
:BA: Bosnia and Herzegovina
|
19
19
|
:BB: Barbados
|
@@ -24,7 +24,7 @@
|
|
24
24
|
:BH: Bahrain
|
25
25
|
:BI: Burundi
|
26
26
|
:BJ: Benin
|
27
|
-
:BL: Saint
|
27
|
+
:BL: Saint Barthélemy
|
28
28
|
:BM: Bermuda
|
29
29
|
:BN: Brunei
|
30
30
|
:BO: Bolivia
|
@@ -32,14 +32,15 @@
|
|
32
32
|
:BR: Brazil
|
33
33
|
:BS: Bahamas
|
34
34
|
:BT: Bhutan
|
35
|
+
:BV: Bouvet Island
|
35
36
|
:BW: Botswana
|
36
37
|
:BY: Belarus
|
37
38
|
:BZ: Belize
|
38
39
|
:CA: Canada
|
39
40
|
:CC: Cocos [Keeling] Islands
|
40
|
-
:CD: Congo
|
41
|
+
:CD: DR Congo
|
41
42
|
:CF: Central African Republic
|
42
|
-
:CG: Republic
|
43
|
+
:CG: Congo Republic
|
43
44
|
:CH: Switzerland
|
44
45
|
:CI: Ivory Coast
|
45
46
|
:CK: Cook Islands
|
@@ -50,11 +51,11 @@
|
|
50
51
|
:COUNTRY_ISO_CODE: country_name
|
51
52
|
:CR: Costa Rica
|
52
53
|
:CU: Cuba
|
53
|
-
:CV:
|
54
|
+
:CV: Cabo Verde
|
54
55
|
:CW: Curaçao
|
55
56
|
:CX: Christmas Island
|
56
57
|
:CY: Cyprus
|
57
|
-
:CZ:
|
58
|
+
:CZ: Czechia
|
58
59
|
:DE: Germany
|
59
60
|
:DJ: Djibouti
|
60
61
|
:DK: Denmark
|
@@ -64,6 +65,7 @@
|
|
64
65
|
:EC: Ecuador
|
65
66
|
:EE: Estonia
|
66
67
|
:EG: Egypt
|
68
|
+
:EH: Western Sahara
|
67
69
|
:ER: Eritrea
|
68
70
|
:ES: Spain
|
69
71
|
:ET: Ethiopia
|
@@ -93,6 +95,7 @@
|
|
93
95
|
:GW: Guinea-Bissau
|
94
96
|
:GY: Guyana
|
95
97
|
:HK: Hong Kong
|
98
|
+
:HM: Heard Island and McDonald Islands
|
96
99
|
:HN: Honduras
|
97
100
|
:HR: Croatia
|
98
101
|
:HT: Haiti
|
@@ -116,9 +119,9 @@
|
|
116
119
|
:KH: Cambodia
|
117
120
|
:KI: Kiribati
|
118
121
|
:KM: Comoros
|
119
|
-
:KN:
|
122
|
+
:KN: St Kitts and Nevis
|
120
123
|
:KP: North Korea
|
121
|
-
:KR:
|
124
|
+
:KR: South Korea
|
122
125
|
:KW: Kuwait
|
123
126
|
:KY: Cayman Islands
|
124
127
|
:KZ: Kazakhstan
|
@@ -140,9 +143,9 @@
|
|
140
143
|
:MF: Saint Martin
|
141
144
|
:MG: Madagascar
|
142
145
|
:MH: Marshall Islands
|
143
|
-
:MK: Macedonia
|
146
|
+
:MK: North Macedonia
|
144
147
|
:ML: Mali
|
145
|
-
:MM: Myanmar
|
148
|
+
:MM: Myanmar
|
146
149
|
:MN: Mongolia
|
147
150
|
:MO: Macao
|
148
151
|
:MP: Northern Mariana Islands
|
@@ -209,7 +212,7 @@
|
|
209
212
|
:SV: El Salvador
|
210
213
|
:SX: Sint Maarten
|
211
214
|
:SY: Syria
|
212
|
-
:SZ:
|
215
|
+
:SZ: Eswatini
|
213
216
|
:TC: Turks and Caicos Islands
|
214
217
|
:TD: Chad
|
215
218
|
:TF: French Southern Territories
|
data/lib/db/states.us
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
---
|
2
|
+
:AK: Alaska
|
3
|
+
:AL: Alabama
|
4
|
+
:AR: Arkansas
|
5
|
+
:AZ: Arizona
|
6
|
+
:CA: California
|
7
|
+
:CO: Colorado
|
8
|
+
:CT: Connecticut
|
9
|
+
:DC: District of Columbia
|
10
|
+
:DE: Delaware
|
11
|
+
:FL: Florida
|
12
|
+
:GA: Georgia
|
13
|
+
:HI: Hawaii
|
14
|
+
:IA: Iowa
|
15
|
+
:ID: Idaho
|
16
|
+
:IL: Illinois
|
17
|
+
:IN: Indiana
|
18
|
+
:KS: Kansas
|
19
|
+
:KY: Kentucky
|
20
|
+
:LA: Louisiana
|
21
|
+
:MA: Massachusetts
|
22
|
+
:MD: Maryland
|
23
|
+
:ME: Maine
|
24
|
+
:MI: Michigan
|
25
|
+
:MN: Minnesota
|
26
|
+
:MO: Missouri
|
27
|
+
:MS: Mississippi
|
28
|
+
:MT: Montana
|
29
|
+
:NC: North Carolina
|
30
|
+
:ND: North Dakota
|
31
|
+
:NE: Nebraska
|
32
|
+
:NH: New Hampshire
|
33
|
+
:NJ: New Jersey
|
34
|
+
:NM: New Mexico
|
35
|
+
:NV: Nevada
|
36
|
+
:NY: New York
|
37
|
+
:OH: Ohio
|
38
|
+
:OK: Oklahoma
|
39
|
+
:OR: Oregon
|
40
|
+
:PA: Pennsylvania
|
41
|
+
:RI: Rhode Island
|
42
|
+
:SC: South Carolina
|
43
|
+
:SD: South Dakota
|
44
|
+
:TN: Tennessee
|
45
|
+
:TX: Texas
|
46
|
+
:UT: Utah
|
47
|
+
:VA: Virginia
|
48
|
+
:VT: Vermont
|
49
|
+
:WA: Washington
|
50
|
+
:WI: Wisconsin
|
51
|
+
:WV: West Virginia
|
52
|
+
:WY: Wyoming
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe CS do
|
4
|
+
# Testing the countries method
|
5
|
+
it 'returns a list of countries' do
|
6
|
+
countries = CS.countries
|
7
|
+
expect(countries).to be_an(Hash)
|
8
|
+
expect(countries).not_to be_empty
|
9
|
+
end
|
10
|
+
|
11
|
+
# Testing the states method for a given country
|
12
|
+
it 'returns states for a given country' do
|
13
|
+
states = CS.states(:US)
|
14
|
+
expect(states).to be_an(Hash)
|
15
|
+
expect(states).not_to be_empty
|
16
|
+
end
|
17
|
+
|
18
|
+
# Testing the cities method for a given state and country
|
19
|
+
it 'returns cities for a given state and country' do
|
20
|
+
cities = CS.cities(:CA, :US)
|
21
|
+
expect(cities).to be_an(Array)
|
22
|
+
expect(cities).not_to be_empty
|
23
|
+
end
|
24
|
+
|
25
|
+
# Testing the get method
|
26
|
+
it 'returns countries, states, or cities based on parameters' do
|
27
|
+
expect(CS.get).to eq(CS.countries)
|
28
|
+
expect(CS.get(:US)).to eq(CS.states(:US))
|
29
|
+
expect(CS.get(:US, :CA)).to eq(CS.cities(:CA, :US))
|
30
|
+
end
|
31
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'city-state'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: city-state
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Loureiro
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-08-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -30,28 +30,42 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '11.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '11.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rubyzip
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '2.3'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '2.3'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.10'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3.10'
|
55
69
|
description: Useful to make forms and validations. It uses MaxMind database.
|
56
70
|
email:
|
57
71
|
- loureirorg@gmail.com
|
@@ -59,8 +73,7 @@ executables: []
|
|
59
73
|
extensions: []
|
60
74
|
extra_rdoc_files: []
|
61
75
|
files:
|
62
|
-
-
|
63
|
-
- Gemfile
|
76
|
+
- CHANGELOG.md
|
64
77
|
- LICENSE.txt
|
65
78
|
- README.md
|
66
79
|
- Rakefile
|
@@ -68,9 +81,13 @@ files:
|
|
68
81
|
- lib/city-state.rb
|
69
82
|
- lib/city-state/version.rb
|
70
83
|
- lib/db/GeoLite2-City-Locations-en.csv
|
84
|
+
- lib/db/cities.us
|
71
85
|
- lib/db/countries.yml
|
72
86
|
- lib/db/states-replace.yml
|
73
|
-
|
87
|
+
- lib/db/states.us
|
88
|
+
- spec/city_state_spec.rb
|
89
|
+
- spec/spec_helper.rb
|
90
|
+
homepage: https://github.com/thecodecrate/city-state
|
74
91
|
licenses:
|
75
92
|
- MIT
|
76
93
|
metadata: {}
|
@@ -82,14 +99,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
82
99
|
requirements:
|
83
100
|
- - ">="
|
84
101
|
- !ruby/object:Gem::Version
|
85
|
-
version:
|
102
|
+
version: 2.0.0
|
103
|
+
- - "<"
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: 3.0.0
|
86
106
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
107
|
requirements:
|
88
108
|
- - ">="
|
89
109
|
- !ruby/object:Gem::Version
|
90
110
|
version: '0'
|
91
111
|
requirements: []
|
92
|
-
rubygems_version: 3.
|
112
|
+
rubygems_version: 3.1.6
|
93
113
|
signing_key:
|
94
114
|
specification_version: 4
|
95
115
|
summary: Simple list of cities and states of the world
|
data/.gitignore
DELETED
data/Gemfile
DELETED