phony 1.9.0 → 2.19.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/README.textile +64 -112
- data/lib/phony/config.rb +91 -0
- data/lib/phony/countries/argentina.rb +355 -0
- data/lib/phony/countries/austria.rb +56 -22
- data/lib/phony/countries/bangladesh.rb +57 -0
- data/lib/phony/countries/belarus.rb +133 -0
- data/lib/phony/countries/brazil.rb +101 -95
- data/lib/phony/countries/cambodia.rb +131 -0
- data/lib/phony/countries/china.rb +13 -6
- data/lib/phony/countries/croatia.rb +23 -0
- data/lib/phony/countries/georgia.rb +94 -0
- data/lib/phony/countries/germany.rb +66 -42
- data/lib/phony/countries/guinea.rb +46 -0
- data/lib/phony/countries/india.rb +50 -0
- data/lib/phony/countries/indonesia.rb +55 -0
- data/lib/phony/countries/ireland.rb +35 -28
- data/lib/phony/countries/italy.rb +272 -166
- data/lib/phony/countries/japan.rb +468 -0
- data/lib/phony/countries/kyrgyzstan.rb +120 -0
- data/lib/phony/countries/latvia.rb +43 -0
- data/lib/phony/countries/libya.rb +116 -0
- data/lib/phony/countries/malaysia.rb +31 -7
- data/lib/phony/countries/moldova.rb +53 -0
- data/lib/phony/countries/montenegro.rb +30 -0
- data/lib/phony/countries/myanmar.rb +55 -0
- data/lib/phony/countries/namibia.rb +37 -0
- data/lib/phony/countries/nepal.rb +73 -0
- data/lib/phony/countries/netherlands.rb +17 -5
- data/lib/phony/countries/pakistan.rb +121 -0
- data/lib/phony/countries/paraguay.rb +147 -0
- data/lib/phony/countries/{russia_kazakhstan_abhasia_south_osetia.rb → russia_kazakhstan_abkhasia_south_ossetia.rb} +35 -24
- data/lib/phony/countries/saudi_arabia.rb +40 -0
- data/lib/phony/countries/serbia.rb +47 -0
- data/lib/phony/countries/somalia.rb +26 -0
- data/lib/phony/countries/south_korea.rb +19 -10
- data/lib/phony/countries/sweden.rb +58 -38
- data/lib/phony/countries/taiwan.rb +28 -0
- data/lib/phony/countries/tajikistan.rb +79 -0
- data/lib/phony/countries/turkmenistan.rb +76 -0
- data/lib/phony/countries/ukraine.rb +630 -0
- data/lib/phony/countries/united_kingdom.rb +639 -44
- data/lib/phony/countries/uruguay.rb +53 -0
- data/lib/phony/countries/vietnam.rb +133 -0
- data/lib/phony/countries/zimbabwe.rb +39 -0
- data/lib/phony/countries.rb +901 -301
- data/lib/phony/country.rb +177 -20
- data/lib/phony/country_codes.rb +119 -101
- data/lib/phony/dsl.rb +113 -68
- data/lib/phony/local_splitters/fixed.rb +25 -1
- data/lib/phony/local_splitters/regex.rb +16 -2
- data/lib/phony/national_code.rb +7 -7
- data/lib/phony/national_splitters/default.rb +35 -3
- data/lib/phony/national_splitters/dsl.rb +12 -7
- data/lib/phony/national_splitters/fixed.rb +7 -1
- data/lib/phony/national_splitters/none.rb +7 -3
- data/lib/phony/national_splitters/regex.rb +6 -0
- data/lib/phony/national_splitters/variable.rb +13 -9
- data/lib/phony/trunk_code.rb +57 -0
- data/lib/phony/vanity.rb +3 -3
- data/lib/phony.rb +239 -55
- data/spec/functional/config_spec.rb +44 -0
- data/spec/functional/plausibility_spec.rb +656 -0
- data/spec/lib/phony/countries_spec.rb +1207 -119
- data/spec/lib/phony/country_codes_spec.rb +99 -81
- data/spec/lib/phony/country_spec.rb +54 -14
- data/spec/lib/phony/dsl_spec.rb +2 -2
- data/spec/lib/phony/local_splitters/fixed_spec.rb +4 -4
- data/spec/lib/phony/local_splitters/regex_spec.rb +50 -2
- data/spec/lib/phony/national_code_spec.rb +34 -34
- data/spec/lib/phony/national_splitters/default_spec.rb +34 -0
- data/spec/lib/phony/national_splitters/fixed_spec.rb +12 -6
- data/spec/lib/phony/national_splitters/none_spec.rb +13 -3
- data/spec/lib/phony/national_splitters/regex_spec.rb +1 -1
- data/spec/lib/phony/national_splitters/variable_spec.rb +11 -5
- data/spec/lib/phony/trunk_code_spec.rb +85 -0
- data/spec/lib/phony/vanity_spec.rb +15 -19
- data/spec/lib/phony_spec.rb +59 -277
- metadata +67 -34
- data/lib/phony/validator.rb +0 -26
- data/lib/phony/validators.rb +0 -88
- data/spec/lib/phony/validations_spec.rb +0 -109
@@ -0,0 +1,355 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Argentinian numbers are all ten digits long.
|
4
|
+
# Information taken from:
|
5
|
+
# https://www.enacom.gob.ar/multimedia/normativas/1997/Resolucion%2046_97.pdf
|
6
|
+
# http://www.wtng.info/wtng-54-ar.html
|
7
|
+
# https://en.wikipedia.org/wiki/Telephone_numbers_in_Argentina
|
8
|
+
# Area codes collected from https://www.enacom.gob.ar/indicativos-interurbanos_p366 (06/27/19)
|
9
|
+
|
10
|
+
|
11
|
+
# Landline
|
12
|
+
area_codes_2digits = [
|
13
|
+
'11',
|
14
|
+
]
|
15
|
+
|
16
|
+
area_codes_3digits = [
|
17
|
+
'220',
|
18
|
+
'221',
|
19
|
+
'223',
|
20
|
+
'230',
|
21
|
+
'236',
|
22
|
+
'237',
|
23
|
+
'249',
|
24
|
+
'260',
|
25
|
+
'261',
|
26
|
+
'263',
|
27
|
+
'264',
|
28
|
+
'266',
|
29
|
+
'280',
|
30
|
+
'291',
|
31
|
+
'294',
|
32
|
+
'297',
|
33
|
+
'298',
|
34
|
+
'299',
|
35
|
+
'336',
|
36
|
+
'341',
|
37
|
+
'342',
|
38
|
+
'343',
|
39
|
+
'345',
|
40
|
+
'348',
|
41
|
+
'351',
|
42
|
+
'353',
|
43
|
+
'358',
|
44
|
+
'362',
|
45
|
+
'364',
|
46
|
+
'370',
|
47
|
+
'376',
|
48
|
+
'379',
|
49
|
+
'380',
|
50
|
+
'381',
|
51
|
+
'383',
|
52
|
+
'385',
|
53
|
+
'387',
|
54
|
+
'388',
|
55
|
+
]
|
56
|
+
|
57
|
+
area_codes_4digits = [
|
58
|
+
'2202',
|
59
|
+
'2221',
|
60
|
+
'2223',
|
61
|
+
'2224',
|
62
|
+
'2225',
|
63
|
+
'2226',
|
64
|
+
'2227',
|
65
|
+
'2229',
|
66
|
+
'2241',
|
67
|
+
'2242',
|
68
|
+
'2243',
|
69
|
+
'2244',
|
70
|
+
'2245',
|
71
|
+
'2246',
|
72
|
+
'2252',
|
73
|
+
'2254',
|
74
|
+
'2255',
|
75
|
+
'2257',
|
76
|
+
'2261',
|
77
|
+
'2262',
|
78
|
+
'2264',
|
79
|
+
'2265',
|
80
|
+
'2266',
|
81
|
+
'2267',
|
82
|
+
'2268',
|
83
|
+
'2271',
|
84
|
+
'2272',
|
85
|
+
'2273',
|
86
|
+
'2274',
|
87
|
+
'2281',
|
88
|
+
'2283',
|
89
|
+
'2284',
|
90
|
+
'2285',
|
91
|
+
'2286',
|
92
|
+
'2291',
|
93
|
+
'2292',
|
94
|
+
'2296',
|
95
|
+
'2297',
|
96
|
+
'2302',
|
97
|
+
'2314',
|
98
|
+
'2316',
|
99
|
+
'2317',
|
100
|
+
'2320',
|
101
|
+
'2323',
|
102
|
+
'2324',
|
103
|
+
'2325',
|
104
|
+
'2326',
|
105
|
+
'2331',
|
106
|
+
'2333',
|
107
|
+
'2334',
|
108
|
+
'2335',
|
109
|
+
'2336',
|
110
|
+
'2337',
|
111
|
+
'2338',
|
112
|
+
'2342',
|
113
|
+
'2343',
|
114
|
+
'2344',
|
115
|
+
'2345',
|
116
|
+
'2346',
|
117
|
+
'2352',
|
118
|
+
'2353',
|
119
|
+
'2354',
|
120
|
+
'2355',
|
121
|
+
'2356',
|
122
|
+
'2357',
|
123
|
+
'2358',
|
124
|
+
'2392',
|
125
|
+
'2393',
|
126
|
+
'2394',
|
127
|
+
'2395',
|
128
|
+
'2396',
|
129
|
+
'2473',
|
130
|
+
'2474',
|
131
|
+
'2475',
|
132
|
+
'2477',
|
133
|
+
'2478',
|
134
|
+
'2622',
|
135
|
+
'2624',
|
136
|
+
'2625',
|
137
|
+
'2626',
|
138
|
+
'2646',
|
139
|
+
'2647',
|
140
|
+
'2648',
|
141
|
+
'2651',
|
142
|
+
'2655',
|
143
|
+
'2656',
|
144
|
+
'2657',
|
145
|
+
'2658',
|
146
|
+
'2901',
|
147
|
+
'2902',
|
148
|
+
'2903',
|
149
|
+
'2920',
|
150
|
+
'2921',
|
151
|
+
'2922',
|
152
|
+
'2923',
|
153
|
+
'2924',
|
154
|
+
'2925',
|
155
|
+
'2926',
|
156
|
+
'2927',
|
157
|
+
'2928',
|
158
|
+
'2929',
|
159
|
+
'2931',
|
160
|
+
'2932',
|
161
|
+
'2933',
|
162
|
+
'2934',
|
163
|
+
'2935',
|
164
|
+
'2936',
|
165
|
+
'2940',
|
166
|
+
'2942',
|
167
|
+
'2945',
|
168
|
+
'2946',
|
169
|
+
'2948',
|
170
|
+
'2952',
|
171
|
+
'2953',
|
172
|
+
'2954',
|
173
|
+
'2962',
|
174
|
+
'2963',
|
175
|
+
'2964',
|
176
|
+
'2966',
|
177
|
+
'2972',
|
178
|
+
'2982',
|
179
|
+
'2983',
|
180
|
+
'3327',
|
181
|
+
'3329',
|
182
|
+
'3382',
|
183
|
+
'3385',
|
184
|
+
'3387',
|
185
|
+
'3388',
|
186
|
+
'3400',
|
187
|
+
'3401',
|
188
|
+
'3402',
|
189
|
+
'3404',
|
190
|
+
'3405',
|
191
|
+
'3406',
|
192
|
+
'3407',
|
193
|
+
'3408',
|
194
|
+
'3409',
|
195
|
+
'3435',
|
196
|
+
'3436',
|
197
|
+
'3437',
|
198
|
+
'3438',
|
199
|
+
'3442',
|
200
|
+
'3444',
|
201
|
+
'3445',
|
202
|
+
'3446',
|
203
|
+
'3447',
|
204
|
+
'3454',
|
205
|
+
'3455',
|
206
|
+
'3456',
|
207
|
+
'3458',
|
208
|
+
'3460',
|
209
|
+
'3462',
|
210
|
+
'3463',
|
211
|
+
'3464',
|
212
|
+
'3465',
|
213
|
+
'3466',
|
214
|
+
'3467',
|
215
|
+
'3468',
|
216
|
+
'3469',
|
217
|
+
'3471',
|
218
|
+
'3472',
|
219
|
+
'3476',
|
220
|
+
'3482',
|
221
|
+
'3483',
|
222
|
+
'3487',
|
223
|
+
'3489',
|
224
|
+
'3491',
|
225
|
+
'3492',
|
226
|
+
'3493',
|
227
|
+
'3496',
|
228
|
+
'3497',
|
229
|
+
'3498',
|
230
|
+
'3521',
|
231
|
+
'3522',
|
232
|
+
'3524',
|
233
|
+
'3525',
|
234
|
+
'3532',
|
235
|
+
'3533',
|
236
|
+
'3537',
|
237
|
+
'3541',
|
238
|
+
'3542',
|
239
|
+
'3543',
|
240
|
+
'3544',
|
241
|
+
'3546',
|
242
|
+
'3547',
|
243
|
+
'3548',
|
244
|
+
'3549',
|
245
|
+
'3562',
|
246
|
+
'3563',
|
247
|
+
'3564',
|
248
|
+
'3571',
|
249
|
+
'3572',
|
250
|
+
'3573',
|
251
|
+
'3574',
|
252
|
+
'3575',
|
253
|
+
'3576',
|
254
|
+
'3582',
|
255
|
+
'3583',
|
256
|
+
'3584',
|
257
|
+
'3585',
|
258
|
+
'3711',
|
259
|
+
'3715',
|
260
|
+
'3716',
|
261
|
+
'3718',
|
262
|
+
'3721',
|
263
|
+
'3725',
|
264
|
+
'3731',
|
265
|
+
'3734',
|
266
|
+
'3735',
|
267
|
+
'3741',
|
268
|
+
'3743',
|
269
|
+
'3751',
|
270
|
+
'3754',
|
271
|
+
'3755',
|
272
|
+
'3756',
|
273
|
+
'3757',
|
274
|
+
'3758',
|
275
|
+
'3772',
|
276
|
+
'3773',
|
277
|
+
'3774',
|
278
|
+
'3775',
|
279
|
+
'3777',
|
280
|
+
'3781',
|
281
|
+
'3782',
|
282
|
+
'3786',
|
283
|
+
'3821',
|
284
|
+
'3825',
|
285
|
+
'3826',
|
286
|
+
'3827',
|
287
|
+
'3832',
|
288
|
+
'3835',
|
289
|
+
'3837',
|
290
|
+
'3838',
|
291
|
+
'3841',
|
292
|
+
'3843',
|
293
|
+
'3844',
|
294
|
+
'3845',
|
295
|
+
'3846',
|
296
|
+
'3854',
|
297
|
+
'3855',
|
298
|
+
'3856',
|
299
|
+
'3857',
|
300
|
+
'3858',
|
301
|
+
'3861',
|
302
|
+
'3862',
|
303
|
+
'3863',
|
304
|
+
'3865',
|
305
|
+
'3867',
|
306
|
+
'3868',
|
307
|
+
'3869',
|
308
|
+
'3873',
|
309
|
+
'3876',
|
310
|
+
'3877',
|
311
|
+
'3878',
|
312
|
+
'3885',
|
313
|
+
'3886',
|
314
|
+
'3887',
|
315
|
+
'3888',
|
316
|
+
'3891',
|
317
|
+
'3892',
|
318
|
+
'3894',
|
319
|
+
]
|
320
|
+
|
321
|
+
# Mobile
|
322
|
+
# Mobile phone numbers in Argentina are assigned the same geographic area codes as fixed lines,
|
323
|
+
# according to the subscriber's choice or residence, and can be 6, 7 or 8 digits long, just as
|
324
|
+
# landline numbers are. The difference with landline numbers is that a prefix 15, never used for
|
325
|
+
# landlines, must be dialed.
|
326
|
+
|
327
|
+
|
328
|
+
|
329
|
+
# International: +54 + 9 + area code + subscriber number (without '15' prefix)
|
330
|
+
# Domestic: area code + 15 + subscriber number
|
331
|
+
# Mobile numbers in Argentina may be listed as 15-xxxxxxx. However, the leading '15'
|
332
|
+
# is a domestic prefix which must be omitted when calling these from outside Argentina,
|
333
|
+
# with the xxxxxxx being the actual subscriber number portion.
|
334
|
+
|
335
|
+
# Non-geographic numbers 0ppp-nnn-nnnn
|
336
|
+
special_numbers = [
|
337
|
+
'800', # toll-free telephone numbers
|
338
|
+
'810', # calls from any area chargeable at local rate
|
339
|
+
'822', # toll-free numbers used for calling card access
|
340
|
+
'600', # premium-rate telephone numbers
|
341
|
+
'609', # premium, fixed-rate gaming numbers
|
342
|
+
'610', # dial-up Internet access numbers, usually cheaper than a local call, less frequently used as dial-up Internet access decreased
|
343
|
+
'605', # premium-rate telephone numbers for charity donations
|
344
|
+
]
|
345
|
+
|
346
|
+
Phony.define do
|
347
|
+
country '54', trunk('0') |
|
348
|
+
one_of(area_codes_4digits) >> split(2, 4) | # landline
|
349
|
+
one_of(area_codes_3digits) >> split(3, 4) | # landline
|
350
|
+
one_of(area_codes_2digits) >> split(4, 4) | # landline
|
351
|
+
one_of(area_codes_2digits.map{|x| "9#{x}" }) >> split(4, 4) | # mobile
|
352
|
+
one_of(area_codes_3digits.map{|x| "9#{x}" }) >> split(3, 4) | # mobile
|
353
|
+
one_of(area_codes_4digits.map{|x| "9#{x}" }) >> split(2, 4) | # mobile
|
354
|
+
one_of(special_numbers) >> split(3, 4)
|
355
|
+
end
|
@@ -1,30 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Austria uses a variable-length ndc code, thus we use a separate file to not let all_other.rb explode.
|
2
4
|
#
|
3
5
|
ndcs = [
|
4
|
-
'1', # Vienna
|
5
|
-
'57', # -
|
6
|
-
'59', # -
|
6
|
+
# '1', # Vienna
|
7
7
|
'89', # Routing Number
|
8
8
|
'316', # Graz
|
9
|
-
'
|
10
|
-
'502', # -
|
11
|
-
'503', # -
|
12
|
-
'504', # -
|
13
|
-
'505', # -
|
14
|
-
'506', # -
|
15
|
-
'507', # -
|
16
|
-
'508', # -
|
17
|
-
'509', # -
|
9
|
+
'463', # Klagenfurt
|
18
10
|
'512', # Innsbruck
|
19
|
-
'517', # -
|
20
11
|
'662', # Salzburg
|
21
|
-
'720', #
|
22
12
|
'732' # Linz
|
23
13
|
]
|
24
14
|
|
15
|
+
corporate_2digit = [
|
16
|
+
'57',
|
17
|
+
'59'
|
18
|
+
]
|
19
|
+
|
20
|
+
corporate = [
|
21
|
+
'501',
|
22
|
+
'502',
|
23
|
+
'503',
|
24
|
+
'504',
|
25
|
+
'505',
|
26
|
+
'506',
|
27
|
+
'507',
|
28
|
+
'508',
|
29
|
+
'509',
|
30
|
+
'517'
|
31
|
+
]
|
32
|
+
|
25
33
|
mobile = [
|
26
|
-
'67',
|
27
|
-
'68',
|
28
34
|
'644',
|
29
35
|
'650',
|
30
36
|
'651',
|
@@ -35,15 +41,30 @@ mobile = [
|
|
35
41
|
'659',
|
36
42
|
'660',
|
37
43
|
'661',
|
38
|
-
'663',
|
39
44
|
'664',
|
40
45
|
'665',
|
41
46
|
'666',
|
42
47
|
'667',
|
43
48
|
'668',
|
44
|
-
'669'
|
49
|
+
'669',
|
50
|
+
'670',
|
51
|
+
'676',
|
52
|
+
'677',
|
53
|
+
'678',
|
54
|
+
'680',
|
55
|
+
'681',
|
56
|
+
'688',
|
57
|
+
'690',
|
58
|
+
'699',
|
45
59
|
]
|
46
60
|
|
61
|
+
mobile_2digit = [
|
62
|
+
'67',
|
63
|
+
'68',
|
64
|
+
'69',
|
65
|
+
]
|
66
|
+
|
67
|
+
|
47
68
|
service = [
|
48
69
|
'710',
|
49
70
|
'711',
|
@@ -51,7 +72,6 @@ service = [
|
|
51
72
|
'730',
|
52
73
|
'740',
|
53
74
|
'780',
|
54
|
-
'800',
|
55
75
|
'802',
|
56
76
|
'804',
|
57
77
|
'810',
|
@@ -65,7 +85,21 @@ service = [
|
|
65
85
|
'939'
|
66
86
|
]
|
67
87
|
|
88
|
+
# https://www.rtr.at/en/tk/E129/Austrian_Numbering_Plan_2011-03-30.pdf
|
89
|
+
#
|
90
|
+
# TODO Add more details.
|
91
|
+
#
|
68
92
|
Phony.define do
|
69
|
-
country '43',
|
70
|
-
|
71
|
-
|
93
|
+
country '43', trunk('0') |
|
94
|
+
one_of('1') >> split(3..12) | # Vienna
|
95
|
+
one_of(service) >> split(9..9) |
|
96
|
+
one_of('720') >> split(6..10) | # VoIP number length is 9..13
|
97
|
+
one_of('800') >> split(6..10) | # Free number length is 9..13
|
98
|
+
one_of(corporate_2digit) >> split(3..11) | # Corporate number length is 5..13
|
99
|
+
one_of(corporate) >> split(2..10) | # Corporate number length is 5..13
|
100
|
+
one_of(ndcs) >> split(5..10) |
|
101
|
+
one_of('663') >> split(6..8) | # 6..8 digit mobile.
|
102
|
+
one_of(mobile) >> split(4,3..9) |
|
103
|
+
one_of(mobile_2digit) >> split(7..7) | # Separate as mobile contains 676 - 67 violates the prefix rule.
|
104
|
+
fixed(4) >> split(3..9) # Number length is 7..13.
|
105
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Bangladesh (People's Republic of)
|
4
|
+
# https://www.numberingplans.com
|
5
|
+
|
6
|
+
ndcs_with_3_subscriber_numbers = %w(
|
7
|
+
3035 3036 3224 3424 3427 3529 3823 4027 4222 4225 4425 4525 4623 4653 4658
|
8
|
+
5222 5323 5327 5526 6257 7022 7622 8023 8032 8332 8424 8528 8626 9423 9424
|
9
|
+
)
|
10
|
+
|
11
|
+
ndcs_with_4_subscriber_numbers = %w(
|
12
|
+
3020 3022 3023 3024 3025 3026 3027 3028 3029 3032 3033 3034 3035 3036 3221 3222 3223 3225
|
13
|
+
3322 3323 3324 3325 3326 3422 3824 4020 4029 4222 4223 4224 4225 4226 4227 4228
|
14
|
+
4320 4322 4323 4324 4325 4326 4327 4328 4329 4523 4653 4654 4655 4657 4624 4626 4627
|
15
|
+
4953 6024 6622 6655 7323 7324 7325 7327 7328 7522 7523 7524 7525 7526 7527 7528 7529
|
16
|
+
8020 8022 8023 8024 8025 8026 8027 8028 8029 8032 8033 8424 8425 8426 8427 8522 8523 8524 8525 8526 8527
|
17
|
+
)
|
18
|
+
|
19
|
+
ndcs_with_5_subscriber_numbers = {
|
20
|
+
2 => %w(51 71 81 91),
|
21
|
+
3 => %w(321 331 341 351 361 371 381 441 448 421 451 461 471 481 491 468
|
22
|
+
488 498 521 531 541 551 561 571 581 591 628 601 631 641 651 661 668
|
23
|
+
691 731 741 751 761 771 781 791 831 841 851 861 871 921 931 941 951 981),
|
24
|
+
4 => %w(3023 3024 3028 3223 3225 3324 3422 3425 3822
|
25
|
+
4033 4226 4227 4322 4323 4326 4327 4328 4422 4423 4424 4426 4455 4624 4625 4626 4655 4656 4657 4823 4854 4922 4924 4925 4953
|
26
|
+
5020 5023 5024 5028 5029 5224 5225 5227 5323 5325 5326 5329 5424 5426 5526 5653 5724 5826
|
27
|
+
6023 6024 6222 6224 6225 6253 6254 6255 6323 6324 6327 6328 6423 6424 6524 6527 6623 6624 6652 6653 6654 6655
|
28
|
+
6722 6723 6724 6725 6822 6823 6824 6825 6922 6923 6924 6925 6926
|
29
|
+
7225 7227 7228 7229 7324 7326 7327 7329 7425 7426 7522 7525 7526 7528 7529 7724 7823 7825 7923
|
30
|
+
8020 8022 8026 8029 8220 8222 8223 8224 8225 8226 8227 8229 8232 8325 8327 8328 8425 8426 8427 8522 8523 8524
|
31
|
+
8622 8623 8624 8625 8626 8723 8725 8727
|
32
|
+
9020 9022 9024 9025 9027 9028 9032 9033 9222 9223 9225 9226 9227 9228 9229 9232 9233 9424 9426 9428 9524 9525 9528 9529 9824 9827)
|
33
|
+
}
|
34
|
+
|
35
|
+
ndcs_with_6_subscriber_numbers = {2 => %w(31 41), 3 => %w(721 821)}
|
36
|
+
|
37
|
+
ndcs_with_7_subscriber_numbers = {1 => %w(2), 3 => %w(431)}
|
38
|
+
|
39
|
+
Phony.define do
|
40
|
+
country '880',
|
41
|
+
# some ndc have several subscriber number length.
|
42
|
+
match(/\A(#{ndcs_with_3_subscriber_numbers.join('|')})\d{3}\z/) >> split(3) |
|
43
|
+
match(/\A(#{ndcs_with_4_subscriber_numbers.join('|')})\d{4}\z/) >> split(4) |
|
44
|
+
match(/\A(#{ndcs_with_5_subscriber_numbers[4].join('|')})\d{5}\z/) >> split(5) |
|
45
|
+
#
|
46
|
+
one_of(ndcs_with_3_subscriber_numbers) >> split(3) |
|
47
|
+
one_of(ndcs_with_4_subscriber_numbers) >> split(4) |
|
48
|
+
one_of(ndcs_with_5_subscriber_numbers[2]) >> split(5) |
|
49
|
+
one_of(ndcs_with_5_subscriber_numbers[3]) >> split(5) |
|
50
|
+
one_of(ndcs_with_5_subscriber_numbers[4]) >> split(5) |
|
51
|
+
one_of(ndcs_with_6_subscriber_numbers[2]) >> split(6) |
|
52
|
+
one_of(ndcs_with_6_subscriber_numbers[3]) >> split(6) |
|
53
|
+
one_of(ndcs_with_7_subscriber_numbers[1]) >> split(7) |
|
54
|
+
one_of(ndcs_with_7_subscriber_numbers[3]) >> split(7) |
|
55
|
+
# match(/\A(1[15-9])\d{8}\z/) >> split(8) # mobile
|
56
|
+
fixed(2) >> split(8) # mobile
|
57
|
+
end
|
@@ -0,0 +1,133 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Belarus
|
4
|
+
# http://www.eng.beltelecom.by/en/subscribers/phone-codes
|
5
|
+
# https://www.numberingplans.com
|
6
|
+
|
7
|
+
ndcs_with_5_subscriber_digits = %w(
|
8
|
+
1511
|
9
|
+
1512
|
10
|
+
1513
|
11
|
+
1514
|
12
|
+
1515
|
13
|
+
1562
|
14
|
+
1563
|
15
|
+
1564
|
16
|
+
1591
|
17
|
+
1592
|
18
|
+
1593
|
19
|
+
1594
|
20
|
+
1595
|
21
|
+
1596
|
22
|
+
1597
|
23
|
+
1631
|
24
|
+
1632
|
25
|
+
1633
|
26
|
+
1641
|
27
|
+
1642
|
28
|
+
1643
|
29
|
+
1644
|
30
|
+
1645
|
31
|
+
1646
|
32
|
+
1647
|
33
|
+
1651
|
34
|
+
1652
|
35
|
+
1655
|
36
|
+
1713
|
37
|
+
1714
|
38
|
+
1715
|
39
|
+
1716
|
40
|
+
1717
|
41
|
+
1718
|
42
|
+
1719
|
43
|
+
1770
|
44
|
+
1771
|
45
|
+
1772
|
46
|
+
1774
|
47
|
+
1775
|
48
|
+
1776
|
49
|
+
1792
|
50
|
+
1793
|
51
|
+
1794
|
52
|
+
1795
|
53
|
+
1796
|
54
|
+
1797
|
55
|
+
2130
|
56
|
+
2131
|
57
|
+
2132
|
58
|
+
2133
|
59
|
+
2135
|
60
|
+
2136
|
61
|
+
2137
|
62
|
+
2138
|
63
|
+
2139
|
64
|
+
2151
|
65
|
+
2152
|
66
|
+
2153
|
67
|
+
2154
|
68
|
+
2155
|
69
|
+
2156
|
70
|
+
2157
|
71
|
+
2158
|
72
|
+
2159
|
73
|
+
2230
|
74
|
+
2231
|
75
|
+
2232
|
76
|
+
2233
|
77
|
+
2234
|
78
|
+
2235
|
79
|
+
2236
|
80
|
+
2237
|
81
|
+
2238
|
82
|
+
2239
|
83
|
+
2240
|
84
|
+
2241
|
85
|
+
2242
|
86
|
+
2243
|
87
|
+
2244
|
88
|
+
2245
|
89
|
+
2246
|
90
|
+
2247
|
91
|
+
2248
|
92
|
+
2330
|
93
|
+
2332
|
94
|
+
2333
|
95
|
+
2334
|
96
|
+
2336
|
97
|
+
2337
|
98
|
+
2339
|
99
|
+
2340
|
100
|
+
2342
|
101
|
+
2344
|
102
|
+
2345
|
103
|
+
2346
|
104
|
+
2347
|
105
|
+
2350
|
106
|
+
2353
|
107
|
+
2354
|
108
|
+
2355
|
109
|
+
2356
|
110
|
+
2357
|
111
|
+
)
|
112
|
+
|
113
|
+
ndcs_with_6_subscriber_digits = %w(152 154 162 163 165 174 176 177 212 214 216 222 225 232 236 602)
|
114
|
+
|
115
|
+
ndcs_with_7_subscriber_digits = %w(17 25 29 33 44)
|
116
|
+
|
117
|
+
Phony.define do
|
118
|
+
country '375',
|
119
|
+
trunk('80?') |
|
120
|
+
one_of(ndcs_with_5_subscriber_digits) >> split(5) |
|
121
|
+
one_of(ndcs_with_6_subscriber_digits) >> split(6) |
|
122
|
+
one_of(ndcs_with_7_subscriber_digits) >> split(7) |
|
123
|
+
# not available from abroad
|
124
|
+
one_of(%w(600)) >> split(3) |
|
125
|
+
one_of(%w(606 777 801 803 805 810 902)) >> split(7) |
|
126
|
+
one_of(%w(820)) >> split(8) |
|
127
|
+
# Non-geographic number - Home country direct service
|
128
|
+
# Assigned to Beltelecom - not available from abroad
|
129
|
+
match(/\A(800)\d{3}\z/) >> split(3) |
|
130
|
+
match(/\A(800)\d{4}\z/) >> split(4) |
|
131
|
+
match(/\A(800)\d{7}\z/) >> split(7)
|
132
|
+
end
|
133
|
+
|