locations_ng 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,297 @@
1
+ ---
2
+ - minLat: 4.810874
3
+ name: Abia
4
+ capital: Umuahia
5
+ latitude: 5.430892099999999
6
+ minLong: 7.150823
7
+ maxLat: 6.0191921
8
+ longitude: 7.524724300000001
9
+ maxLong: 7.9630091
10
+ - minLat: 7.452592
11
+ name: Adamawa
12
+ capital: Yola
13
+ latitude: 9.3250497
14
+ minLong: 11.392936
15
+ maxLat: 10.943588
16
+ longitude: 12.4380581
17
+ maxLong: 13.6924919
18
+ - minLat: 4.4780049
19
+ name: Akwa Ibom
20
+ capital: Uyo
21
+ latitude: 4.929986899999999
22
+ minLong: 7.4605409
23
+ maxLat: 5.530245
24
+ longitude: 7.872159999999999
25
+ maxLong: 8.340371
26
+ - minLat: 5.692615000000001
27
+ name: Anambra
28
+ capital: Awka
29
+ latitude: 6.2757656
30
+ minLong: 6.613086
31
+ maxLat: 6.7795999
32
+ longitude: 7.0068393
33
+ maxLong: 7.355934
34
+ - minLat: 10.255381
35
+ name: Bauchi
36
+ capital: Bauchi
37
+ latitude: 10.315833
38
+ minLong: 9.779892
39
+ maxLat: 10.3398292
40
+ longitude: 9.844166999999999
41
+ maxLong: 9.864006
42
+ - minLat: 6.4427789
43
+ name: Benue
44
+ capital: Makurdi
45
+ latitude: 7.350825899999999
46
+ minLong: 7.4893301
47
+ maxLat: 8.149299
48
+ longitude: 8.8362755
49
+ maxLong: 9.918301
50
+ - minLat: 10.0291549
51
+ name: Borno
52
+ capital: Maiduguri
53
+ latitude: 11.5097479
54
+ minLong: 11.6286559
55
+ maxLat: 13.7144441
56
+ longitude: 12.9789121
57
+ maxLong: 14.680073
58
+ - minLat: 4.2771439
59
+ name: Bayelsa
60
+ capital: Yenagoa
61
+ latitude: 4.867776699999999
62
+ minLong: 5.370120500000001
63
+ maxLat: 5.3933139
64
+ longitude: 5.898713900000001
65
+ maxLong: 6.724865899999999
66
+ - minLat: 4.690596000000001
67
+ name: Cross River
68
+ capital: Calabar
69
+ latitude: 6.167031499999999
70
+ minLong: 7.863165999999999
71
+ maxLat: 6.899680999999999
72
+ longitude: 8.6600586
73
+ maxLong: 9.472486
74
+ - minLat: 5.024351999999999
75
+ name: Delta
76
+ capital: Asaba
77
+ latitude: 5.5324624
78
+ minLong: 5.000000099999999
79
+ maxLat: 6.5248195
80
+ longitude: 5.898713900000001
81
+ maxLong: 6.7653911
82
+ - minLat: 5.6873539
83
+ name: Ebonyi
84
+ capital: Abakaliki
85
+ latitude: 6.177973
86
+ minLong: 7.5251131
87
+ maxLat: 6.807093
88
+ longitude: 7.959286299999999
89
+ maxLong: 8.4470269
90
+ - minLat: 5.7386799
91
+ name: Edo
92
+ capital: Benin
93
+ latitude: 6.5438101
94
+ minLong: 4.975229
95
+ maxLat: 7.5721479
96
+ longitude: 5.898713900000001
97
+ maxLong: 6.707891000000001
98
+ - minLat: 7.272215999999999
99
+ name: Ekiti
100
+ capital: Ado-Ekiti
101
+ latitude: 7.665581299999999
102
+ minLong: 4.9103081
103
+ maxLat: 8.0674911
104
+ longitude: 5.3102505
105
+ maxLong: 5.8048959
106
+ - minLat: 6.360852
107
+ name: Enugu
108
+ capital: Enugu
109
+ latitude: 6.452667
110
+ minLong: 7.458772700000001
111
+ maxLat: 6.5155669
112
+ longitude: 7.510332999999998
113
+ maxLong: 7.618160199999999
114
+ - minLat: 8.396675
115
+ name: Federal Capital Territory
116
+ capital: Abuja
117
+ latitude: 8.8556838
118
+ minLong: 6.749135
119
+ maxLat: 9.3574219
120
+ longitude: 7.179025999999999
121
+ maxLong: 7.617400000000001
122
+ - minLat: 10.264117
123
+ name: Gombe
124
+ capital: Gombe
125
+ latitude: 10.283333
126
+ minLong: 11.1424112
127
+ maxLat: 10.3128497
128
+ longitude: 11.166667
129
+ maxLong: 11.2147019
130
+ - minLat: 12.5688205
131
+ name: Jigawa
132
+ capital: Dutse
133
+ latitude: 12.5700315
134
+ minLong: 8.9387779
135
+ maxLat: 12.5708993
136
+ longitude: 8.9400589
137
+ maxLong: 8.9410364
138
+ - minLat: 5.179824000000001
139
+ name: Imo
140
+ capital: Owerri
141
+ latitude: 5.5214533
142
+ minLong: 6.622309899999999
143
+ maxLat: 5.928465
144
+ longitude: 6.920913499999999
145
+ maxLong: 7.404109
146
+ - minLat: 10.3971566
147
+ name: Kaduna
148
+ capital: Kaduna
149
+ latitude: 10.516667
150
+ minLong: 7.349789099999999
151
+ maxLat: 10.6169963
152
+ longitude: 7.433332999999999
153
+ maxLong: 7.508812000000001
154
+ - minLat: 10.0931591
155
+ name: Kebbi
156
+ capital: Birnin Kebbi
157
+ latitude: 11.6781241
158
+ minLong: 3.4958741
159
+ maxLat: 13.232542
160
+ longitude: 4.0695454
161
+ maxLong: 6.027123
162
+ - minLat: 11.912873
163
+ name: Kano
164
+ capital: Kano
165
+ latitude: 12.0021794
166
+ minLong: 8.411321599999999
167
+ maxLat: 12.0829016
168
+ longitude: 8.591956099999999
169
+ maxLong: 8.6704765
170
+ - minLat: 6.528274199999999
171
+ name: Kogi
172
+ capital: Lokoja
173
+ latitude: 7.561891
174
+ minLong: 5.340376
175
+ maxLat: 8.7320238
176
+ longitude: 6.5783387
177
+ maxLong: 7.8822179
178
+ - minLat: 6.3936419
179
+ name: Lagos
180
+ capital: Ikeja
181
+ latitude: 6.5243793
182
+ minLong: 3.0982732
183
+ maxLat: 6.7027984
184
+ longitude: 3.3792057
185
+ maxLong: 3.696727799999999
186
+ - minLat: 12.934095
187
+ name: Katsina
188
+ capital: Katsina
189
+ latitude: 12.983333
190
+ minLong: 7.5706298
191
+ maxLat: 13.0357094
192
+ longitude: 7.6
193
+ maxLong: 7.676266000000001
194
+ - minLat: 7.966079000000001
195
+ name: Kwara
196
+ capital: Ilorin
197
+ latitude: 8.9847995
198
+ minLong: 2.728413
199
+ maxLat: 10.152084
200
+ longitude: 4.5624426
201
+ maxLong: 6.2142591
202
+ - minLat: 7.769181
203
+ name: Nasarawa
204
+ capital: Lafia
205
+ latitude: 8.5705151
206
+ minLong: 6.924008
207
+ maxLat: 9.365964000000002
208
+ longitude: 8.3088441
209
+ maxLong: 9.605724
210
+ - minLat: 4.269857099999999
211
+ name: Niger
212
+ capital: Minna
213
+ latitude: 9.081999
214
+ minLong: 2.676932
215
+ maxLat: 13.885645
216
+ longitude: 8.675277
217
+ maxLong: 14.677982
218
+ - minLat: 6.315346099999999
219
+ name: Ogun
220
+ capital: Abeokuta
221
+ latitude: 6.9098333
222
+ minLong: 2.668432
223
+ maxLat: 7.974634999999999
224
+ longitude: 3.2583626
225
+ maxLong: 4.5990951
226
+ - minLat: 7.0529381
227
+ name: Ondo
228
+ capital: Akure
229
+ latitude: 7.083333
230
+ minLong: 4.7963046
231
+ maxLat: 7.1249106
232
+ longitude: 4.833333
233
+ maxLong: 4.871921599999999
234
+ - minLat: 4.347035099999999
235
+ name: Rivers
236
+ capital: Port Harcourt
237
+ latitude: 4.8580767
238
+ minLong: 6.382472000000001
239
+ maxLat: 5.694652899999999
240
+ longitude: 6.920913499999999
241
+ maxLong: 7.591592899999998
242
+ - minLat: 7.790425099999999
243
+ name: Oyo
244
+ capital: Ibadan
245
+ latitude: 7.85
246
+ minLong: 3.8832377
247
+ maxLat: 7.8899933
248
+ longitude: 3.933
249
+ maxLong: 3.9751624
250
+ - minLat: 6.969976
251
+ name: Osun
252
+ capital: Osogbo
253
+ latitude: 7.5875843
254
+ minLong: 4.020612
255
+ maxLat: 8.088640999999999
256
+ longitude: 4.5624426
257
+ maxLong: 5.0647019
258
+ - minLat: 12.9764148
259
+ name: Sokoto
260
+ capital: Sokoto
261
+ latitude: 13.066667
262
+ minLong: 5.1676084
263
+ maxLat: 13.0880893
264
+ longitude: 5.233333
265
+ maxLong: 5.2881144
266
+ - minLat: 8.350639
267
+ name: Plateau
268
+ capital: Jos
269
+ latitude: 9.2350817
270
+ minLong: 8.544271
271
+ maxLat: 10.3447241
272
+ longitude: 9.7232673
273
+ maxLong: 10.6606639
274
+ - minLat: 6.502453999999999
275
+ name: Taraba
276
+ capital: Jalingo
277
+ latitude: 7.9868755
278
+ minLong: 9.1043009
279
+ maxLat: 9.604444899999999
280
+ longitude: 10.9807003
281
+ maxLong: 11.981274
282
+ - minLat: 10.5932052
283
+ name: Yobe
284
+ capital: Damaturu
285
+ latitude: 12.1871412
286
+ minLong: 9.665973100000002
287
+ maxLat: 13.376133
288
+ longitude: 11.7068294
289
+ maxLong: 12.494047
290
+ - minLat: 10.854616
291
+ name: Zamfara
292
+ capital: Gusau
293
+ latitude: 12.1844159
294
+ minLong: 5.021007099999999
295
+ maxLat: 13.207291
296
+ longitude: 6.2375947
297
+ maxLong: 7.245729999999999
@@ -0,0 +1,23 @@
1
+ module LocationsNg
2
+ class State
3
+ attr_accessor :state
4
+
5
+ def initialize(state = 'all')
6
+ @state = state
7
+ end
8
+
9
+ def states
10
+ load_yaml('states').map { |s| {name: s['name'], capital: s['capital']} }
11
+ end
12
+
13
+ private
14
+
15
+ def load_yaml(file)
16
+ YAML.load(File.read(files_location file))
17
+ end
18
+
19
+ def files_location(file)
20
+ File.expand_path("../locations/#{file}.yml", __FILE__)
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,3 @@
1
+ module LocationsNg
2
+ VERSION = '0.0.1'
3
+ end
@@ -0,0 +1,28 @@
1
+ require 'spec_helper'
2
+
3
+ module LocationsNg
4
+ describe State do
5
+ describe '.initialize' do
6
+ context 'when no argument is passed' do
7
+ let(:state) { LocationsNg::State.new }
8
+
9
+ it 'state is "all"' do
10
+ expect(state.state).to eq('all')
11
+ end
12
+ end
13
+ end
14
+
15
+ describe '.states' do
16
+ let(:state) { LocationsNg::State.new }
17
+ let(:state_response) { File.read('spec/responses/canonical_states.json') }
18
+
19
+ it 'returns 37 states' do
20
+ expect(state.states.count).to eq(37)
21
+ end
22
+
23
+ it 'returns all canonical states, with name and capital' do
24
+ expect(state.states).to eq(JSON.parse(state_response, symbolize_names: true))
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,150 @@
1
+ [
2
+ {
3
+ "name":"Abia",
4
+ "capital":"Umuahia"
5
+ },
6
+ {
7
+ "name":"Adamawa",
8
+ "capital":"Yola"
9
+ },
10
+ {
11
+ "name":"Akwa Ibom",
12
+ "capital":"Uyo"
13
+ },
14
+ {
15
+ "name":"Anambra",
16
+ "capital":"Awka"
17
+ },
18
+ {
19
+ "name":"Bauchi",
20
+ "capital":"Bauchi"
21
+ },
22
+ {
23
+ "name":"Benue",
24
+ "capital":"Makurdi"
25
+ },
26
+ {
27
+ "name":"Borno",
28
+ "capital":"Maiduguri"
29
+ },
30
+ {
31
+ "name":"Bayelsa",
32
+ "capital":"Yenagoa"
33
+ },
34
+ {
35
+ "name":"Cross River",
36
+ "capital":"Calabar"
37
+ },
38
+ {
39
+ "name":"Delta",
40
+ "capital":"Asaba"
41
+ },
42
+ {
43
+ "name":"Ebonyi",
44
+ "capital":"Abakaliki"
45
+ },
46
+ {
47
+ "name":"Edo",
48
+ "capital":"Benin"
49
+ },
50
+ {
51
+ "name":"Ekiti",
52
+ "capital":"Ado-Ekiti"
53
+ },
54
+ {
55
+ "name":"Enugu",
56
+ "capital":"Enugu"
57
+ },
58
+ {
59
+ "name":"Federal Capital Territory",
60
+ "capital":"Abuja"
61
+ },
62
+ {
63
+ "name":"Gombe",
64
+ "capital":"Gombe"
65
+ },
66
+ {
67
+ "name":"Jigawa",
68
+ "capital":"Dutse"
69
+ },
70
+ {
71
+ "name":"Imo",
72
+ "capital":"Owerri"
73
+ },
74
+ {
75
+ "name":"Kaduna",
76
+ "capital":"Kaduna"
77
+ },
78
+ {
79
+ "name":"Kebbi",
80
+ "capital":"Birnin Kebbi"
81
+ },
82
+ {
83
+ "name":"Kano",
84
+ "capital":"Kano"
85
+ },
86
+ {
87
+ "name":"Kogi",
88
+ "capital":"Lokoja"
89
+ },
90
+ {
91
+ "name":"Lagos",
92
+ "capital":"Ikeja"
93
+ },
94
+ {
95
+ "name":"Katsina",
96
+ "capital":"Katsina"
97
+ },
98
+ {
99
+ "name":"Kwara",
100
+ "capital":"Ilorin"
101
+ },
102
+ {
103
+ "name":"Nasarawa",
104
+ "capital":"Lafia"
105
+ },
106
+ {
107
+ "name":"Niger",
108
+ "capital":"Minna"
109
+ },
110
+ {
111
+ "name":"Ogun",
112
+ "capital":"Abeokuta"
113
+ },
114
+ {
115
+ "name":"Ondo",
116
+ "capital":"Akure"
117
+ },
118
+ {
119
+ "name":"Rivers",
120
+ "capital":"Port Harcourt"
121
+ },
122
+ {
123
+ "name":"Oyo",
124
+ "capital":"Ibadan"
125
+ },
126
+ {
127
+ "name":"Osun",
128
+ "capital":"Osogbo"
129
+ },
130
+ {
131
+ "name":"Sokoto",
132
+ "capital":"Sokoto"
133
+ },
134
+ {
135
+ "name":"Plateau",
136
+ "capital":"Jos"
137
+ },
138
+ {
139
+ "name":"Taraba",
140
+ "capital":"Jalingo"
141
+ },
142
+ {
143
+ "name":"Yobe",
144
+ "capital":"Damaturu"
145
+ },
146
+ {
147
+ "name":"Zamfara",
148
+ "capital":"Gusau"
149
+ }
150
+ ]