geolookup 0.6.1 → 0.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.rdoc +3 -0
- data/README.md +4 -0
- data/lib/data/COUNTRY_TO_PHONE_CODE.yml +217 -0
- data/lib/geolookup.rb +1 -0
- data/lib/geolookup/country_phone_codes.rb +20 -0
- data/lib/geolookup/version.rb +1 -1
- data/spec/lib/country_spec.rb +11 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 46ae92eca6934c5c93d7507741b0064f65b81157
|
4
|
+
data.tar.gz: 59881c0780b02a53d5f0bc0e38f3b8262dea624c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e607715087e52aac9deb6c39db1e36acb5ef1695287753bf91d152bb0c202f84f0d1560e3ee0ef090e93734a21cf3bffb1e5a7b304b6641b805df89098714f27
|
7
|
+
data.tar.gz: 3bb0c3762db66561c1805d3b3a810ad258c1c46aaa77d23523613424d40e6b8c716e72888d8a4c2d3bfa76c05e45cfa1d4a0eea4356bf08f44c45b892ebdb223
|
data/CHANGELOG.rdoc
CHANGED
data/README.md
CHANGED
@@ -116,8 +116,12 @@ Geolookup::USA::AreaCodes.find('202')
|
|
116
116
|
|
117
117
|
Geolookup::USA::Zipcodes.lat_long('90012')
|
118
118
|
# => {:lat_int=>39715698, :long_int=>-104814319}
|
119
|
+
|
120
|
+
Geolookup::Country::PhoneCodes.country_to_phone_code("US")
|
121
|
+
# => 1
|
119
122
|
```
|
120
123
|
|
124
|
+
|
121
125
|
For additional functions and documentation please look in geolookup/fips.rb and geolookup/country.rb.
|
122
126
|
|
123
127
|
## Contributing
|
@@ -0,0 +1,217 @@
|
|
1
|
+
---
|
2
|
+
US: 1
|
3
|
+
EG: 20
|
4
|
+
SS: 211
|
5
|
+
MA: 212
|
6
|
+
DZ: 213
|
7
|
+
TN: 216
|
8
|
+
LY: 218
|
9
|
+
GM: 220
|
10
|
+
SN: 221
|
11
|
+
MR: 222
|
12
|
+
ML: 223
|
13
|
+
GN: 224
|
14
|
+
CI: 225
|
15
|
+
BF: 226
|
16
|
+
NE: 227
|
17
|
+
TG: 228
|
18
|
+
BJ: 229
|
19
|
+
MU: 230
|
20
|
+
LR: 231
|
21
|
+
SL: 232
|
22
|
+
GH: 233
|
23
|
+
NG: 234
|
24
|
+
TD: 235
|
25
|
+
CF: 236
|
26
|
+
CM: 237
|
27
|
+
CV: 238
|
28
|
+
ST: 239
|
29
|
+
GQ: 240
|
30
|
+
GA: 241
|
31
|
+
CG: 242
|
32
|
+
CD: 243
|
33
|
+
AO: 244
|
34
|
+
GW: 245
|
35
|
+
IO: 246
|
36
|
+
AC: 247
|
37
|
+
SC: 248
|
38
|
+
SD: 249
|
39
|
+
RW: 250
|
40
|
+
ET: 251
|
41
|
+
SO: 252
|
42
|
+
DJ: 253
|
43
|
+
KE: 254
|
44
|
+
TZ: 255
|
45
|
+
UG: 256
|
46
|
+
BI: 257
|
47
|
+
MZ: 258
|
48
|
+
ZM: 260
|
49
|
+
MG: 261
|
50
|
+
RE: 262
|
51
|
+
ZW: 263
|
52
|
+
NA: 264
|
53
|
+
MW: 265
|
54
|
+
LS: 266
|
55
|
+
BW: 267
|
56
|
+
SZ: 268
|
57
|
+
KM: 269
|
58
|
+
ZA: 27
|
59
|
+
SH: 290
|
60
|
+
TA: 290
|
61
|
+
ER: 291
|
62
|
+
AW: 297
|
63
|
+
FO: 298
|
64
|
+
GL: 299
|
65
|
+
GR: 30
|
66
|
+
NL: 31
|
67
|
+
BE: 32
|
68
|
+
FR: 33
|
69
|
+
ES: 34
|
70
|
+
GI: 350
|
71
|
+
PT: 351
|
72
|
+
LU: 352
|
73
|
+
IE: 353
|
74
|
+
IS: 354
|
75
|
+
AL: 355
|
76
|
+
MT: 356
|
77
|
+
CY: 357
|
78
|
+
FI: 358
|
79
|
+
BG: 359
|
80
|
+
HU: 36
|
81
|
+
LT: 370
|
82
|
+
LV: 371
|
83
|
+
EE: 372
|
84
|
+
MD: 373
|
85
|
+
AM: 374
|
86
|
+
BY: 375
|
87
|
+
AD: 376
|
88
|
+
MC: 377
|
89
|
+
SM: 378
|
90
|
+
VA: 379
|
91
|
+
UA: 380
|
92
|
+
RS: 381
|
93
|
+
ME: 382
|
94
|
+
HR: 385
|
95
|
+
SI: 386
|
96
|
+
BA: 387
|
97
|
+
MK: 389
|
98
|
+
IT: 39
|
99
|
+
RO: 40
|
100
|
+
CH: 41
|
101
|
+
CZ: 420
|
102
|
+
SK: 421
|
103
|
+
LI: 423
|
104
|
+
AT: 43
|
105
|
+
GB: 44
|
106
|
+
UK: 44
|
107
|
+
GG: 44
|
108
|
+
IM: 44
|
109
|
+
JE: 44
|
110
|
+
DK: 45
|
111
|
+
SE: 46
|
112
|
+
'NO': 47
|
113
|
+
PL: 48
|
114
|
+
DE: 49
|
115
|
+
FK: 500
|
116
|
+
GS: 500
|
117
|
+
BZ: 501
|
118
|
+
GT: 502
|
119
|
+
SV: 503
|
120
|
+
HN: 504
|
121
|
+
NI: 505
|
122
|
+
CR: 506
|
123
|
+
PA: 507
|
124
|
+
PM: 508
|
125
|
+
HT: 509
|
126
|
+
PE: 51
|
127
|
+
MX: 52
|
128
|
+
CU: 53
|
129
|
+
AR: 54
|
130
|
+
BR: 55
|
131
|
+
CL: 56
|
132
|
+
CO: 57
|
133
|
+
VE: 58
|
134
|
+
GP: 590
|
135
|
+
BO: 591
|
136
|
+
GY: 592
|
137
|
+
EC: 593
|
138
|
+
GF: 594
|
139
|
+
PY: 595
|
140
|
+
MQ: 596
|
141
|
+
SR: 597
|
142
|
+
UY: 598
|
143
|
+
MY: 60
|
144
|
+
AU: 61
|
145
|
+
CX: 61
|
146
|
+
CC: 61
|
147
|
+
ID: 62
|
148
|
+
PH: 63
|
149
|
+
NZ: 64
|
150
|
+
PN: 64
|
151
|
+
SG: 65
|
152
|
+
TH: 66
|
153
|
+
TL: 670
|
154
|
+
NF: 672
|
155
|
+
AQ: 672
|
156
|
+
BN: 673
|
157
|
+
NR: 674
|
158
|
+
PG: 675
|
159
|
+
TO: 676
|
160
|
+
SB: 677
|
161
|
+
VU: 678
|
162
|
+
FJ: 679
|
163
|
+
PW: 680
|
164
|
+
WF: 681
|
165
|
+
CK: 682
|
166
|
+
NU: 683
|
167
|
+
WS: 685
|
168
|
+
KI: 686
|
169
|
+
NC: 687
|
170
|
+
TV: 688
|
171
|
+
PF: 689
|
172
|
+
TK: 690
|
173
|
+
FM: 691
|
174
|
+
MH: 692
|
175
|
+
RU: 7
|
176
|
+
KZ: 7
|
177
|
+
JP: 81
|
178
|
+
KR: 82
|
179
|
+
VN: 84
|
180
|
+
KP: 850
|
181
|
+
HK: 852
|
182
|
+
MO: 853
|
183
|
+
KH: 855
|
184
|
+
LA: 856
|
185
|
+
CN: 86
|
186
|
+
BD: 880
|
187
|
+
TW: 886
|
188
|
+
TR: 90
|
189
|
+
IN: 91
|
190
|
+
PK: 92
|
191
|
+
AF: 93
|
192
|
+
LK: 94
|
193
|
+
MM: 95
|
194
|
+
MV: 960
|
195
|
+
LB: 961
|
196
|
+
JO: 962
|
197
|
+
SY: 963
|
198
|
+
IQ: 964
|
199
|
+
KW: 965
|
200
|
+
SA: 966
|
201
|
+
YE: 967
|
202
|
+
OM: 968
|
203
|
+
PS: 970
|
204
|
+
AE: 971
|
205
|
+
IL: 972
|
206
|
+
BH: 973
|
207
|
+
QA: 974
|
208
|
+
BT: 975
|
209
|
+
MN: 976
|
210
|
+
NP: 977
|
211
|
+
IR: 98
|
212
|
+
TJ: 992
|
213
|
+
TM: 993
|
214
|
+
AZ: 994
|
215
|
+
GE: 995
|
216
|
+
KG: 996
|
217
|
+
UZ: 998
|
data/lib/geolookup.rb
CHANGED
@@ -0,0 +1,20 @@
|
|
1
|
+
module Geolookup
|
2
|
+
module Country
|
3
|
+
module PhoneCodes
|
4
|
+
|
5
|
+
COUNTRY_TO_PHONE_CODE_FILE = 'COUNTRY_TO_PHONE_CODE.yml'
|
6
|
+
|
7
|
+
@country_to_phone_code
|
8
|
+
|
9
|
+
def self.country_to_phone_code(country_code)
|
10
|
+
@country_to_phone_code ||= Geolookup.load_hash_from_file(COUNTRY_TO_PHONE_CODE_FILE)
|
11
|
+
@country_to_phone_code[country_code]
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.country_phone_codes
|
15
|
+
@country_to_phone_code ||= Geolookup.load_hash_from_file(COUNTRY_TO_PHONE_CODE_FILE)
|
16
|
+
@country_to_phone_code.values
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/lib/geolookup/version.rb
CHANGED
data/spec/lib/country_spec.rb
CHANGED
@@ -12,4 +12,14 @@ describe "Geolookup::Country" do
|
|
12
12
|
expect(Geolookup::Country.name_to_lat_long("United States")).to eql([38000000, -97000000])
|
13
13
|
end
|
14
14
|
end
|
15
|
-
|
15
|
+
|
16
|
+
describe "#find_country_phone_code" do
|
17
|
+
it "expects a country phone code when given a country code" do
|
18
|
+
expect(Geolookup::Country::PhoneCodes.country_to_phone_code('DZ')).to eq(213)
|
19
|
+
end
|
20
|
+
|
21
|
+
it "expects an array of country phone codes" do
|
22
|
+
expect(Geolookup::Country::PhoneCodes.country_phone_codes).to include(213)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: geolookup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Austin Fonacier
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2016-05-
|
14
|
+
date: 2016-05-20 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: bundler
|
@@ -78,6 +78,7 @@ files:
|
|
78
78
|
- lib/data/COUNTRY_CODE_TO_NAME.yml
|
79
79
|
- lib/data/COUNTRY_LAT_LONG.yml
|
80
80
|
- lib/data/COUNTRY_NAME_TO_CODE.yml
|
81
|
+
- lib/data/COUNTRY_TO_PHONE_CODE.yml
|
81
82
|
- lib/data/COUNTY_CODE_TO_NAME.yml
|
82
83
|
- lib/data/COUNTY_IGNORED_STATES.yml
|
83
84
|
- lib/data/COUNTY_LAT_LONG.yml
|
@@ -93,6 +94,7 @@ files:
|
|
93
94
|
- lib/data/ZIP_LAT_LONG.yml
|
94
95
|
- lib/geolookup.rb
|
95
96
|
- lib/geolookup/country.rb
|
97
|
+
- lib/geolookup/country_phone_codes.rb
|
96
98
|
- lib/geolookup/usa/areacodes.rb
|
97
99
|
- lib/geolookup/usa/county.rb
|
98
100
|
- lib/geolookup/usa/metro.rb
|