phony 2.18.3 → 2.18.8
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 +4 -4
- data/lib/phony.rb +1 -0
- data/lib/phony/countries.rb +2 -9
- data/lib/phony/countries/argentina.rb +355 -0
- data/lib/phony/countries/austria.rb +2 -2
- data/lib/phony/countries/germany.rb +1 -1
- data/spec/functional/plausibility_spec.rb +3 -1
- data/spec/lib/phony/countries_spec.rb +7 -7
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 52ba5d1bdf3df3934d02b98d0e9cc4cfceb98b40aa1d42b128e6c67aadbe60bd
|
4
|
+
data.tar.gz: 51e53daf31b85be5d8a403a9e97e019d5b38b76441da664b87704a1046ef5b4b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fff3dc566134933103392fc1f00402d0aa45422cea6e957adb302aca8a01e2a56024257370facc96c23c587ac653b2931259d877c08a659a3aa0a8a90bac56de
|
7
|
+
data.tar.gz: 79ca7f07001002ec9303a9df0b21c49fd1cd3b67394c6aaa602b0f6c3bd5e5ad48292e5ccc462e7de9b789aa759d7e5b44496783442dba74b9a805523a45100e
|
data/lib/phony.rb
CHANGED
@@ -24,6 +24,7 @@ load File.expand_path '../phony/dsl.rb', __FILE__
|
|
24
24
|
#
|
25
25
|
# The ones that need more space to define.
|
26
26
|
#
|
27
|
+
load File.expand_path '../phony/countries/argentina.rb', __FILE__
|
27
28
|
load File.expand_path '../phony/countries/austria.rb', __FILE__
|
28
29
|
load File.expand_path '../phony/countries/bangladesh.rb', __FILE__
|
29
30
|
load File.expand_path '../phony/countries/belarus.rb', __FILE__
|
data/lib/phony/countries.rb
CHANGED
@@ -69,7 +69,7 @@ Phony.define do
|
|
69
69
|
country '20', one_of('800') >> split(7..7) | # Egypt toll free
|
70
70
|
one_of('3') >> split(7..7) | # Alexandria
|
71
71
|
one_of('2') >> split(8..8) | # Cairo/Giza
|
72
|
-
one_of('10', '11', '12') >> split(8..8) | # the
|
72
|
+
one_of('10', '11', '12', '15') >> split(8..8) | # the 4 mobile operators
|
73
73
|
fixed(2) >> split(7..7) # all the other 24 provinces
|
74
74
|
|
75
75
|
# South Africa.
|
@@ -213,14 +213,7 @@ Phony.define do
|
|
213
213
|
fixed(3) >> split(7) # 3-digit NDCs
|
214
214
|
|
215
215
|
# Argentine Republic.
|
216
|
-
#
|
217
|
-
country '54',
|
218
|
-
one_of('11', '911') >> split(4,4) | # Fixed & Mobile
|
219
|
-
match(/^(22[0137]|237|26[14]|29[179]|34[1235]|35[138]|38[1578])/) >> split(3,4) | # Fixed
|
220
|
-
match(/^(922[0137]|9237|926[14]|929[179]|934[1235]|935[138]|938[1578])/) >> split(3,4) | # Mobile
|
221
|
-
match(/^(9\d{4})/) >> split(2,4) | # Mobile
|
222
|
-
match(/^([68]\d{2})/) >> split(3,4) | # Service
|
223
|
-
fixed(4) >> split(2,4) # Fixed
|
216
|
+
# country '54' # argentina, see special file.
|
224
217
|
|
225
218
|
# Brazil (Federative Republic of).
|
226
219
|
# http://en.wikipedia.org/wiki/Telephone_numbers_in_Brazil
|
@@ -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
|
@@ -85,7 +85,7 @@ service = [
|
|
85
85
|
'939'
|
86
86
|
]
|
87
87
|
|
88
|
-
# https://www.rtr.at/en/tk/E129/
|
88
|
+
# https://www.rtr.at/en/tk/E129/Austrian_Numbering_Plan_2011-03-30.pdf
|
89
89
|
#
|
90
90
|
# TODO Add more details.
|
91
91
|
#
|
@@ -97,7 +97,7 @@ Phony.define do
|
|
97
97
|
one_of('800') >> split(6..10) | # Free number length is 9..13
|
98
98
|
one_of(corporate_2digit) >> split(3..11) | # Corporate number length is 5..13
|
99
99
|
one_of(corporate) >> split(2..10) | # Corporate number length is 5..13
|
100
|
-
one_of(ndcs) >> split(
|
100
|
+
one_of(ndcs) >> split(5..10) |
|
101
101
|
one_of('663') >> split(6..8) | # 6..8 digit mobile.
|
102
102
|
one_of(mobile) >> split(4,3..9) |
|
103
103
|
one_of(mobile_2digit) >> split(7..7) | # Separate as mobile contains 676 - 67 violates the prefix rule.
|
@@ -4090,7 +4090,7 @@ Phony.define do
|
|
4090
4090
|
one_of(*service) >> split(3,1..9) |
|
4091
4091
|
one_of(*mobile_4digits) >> split(3,4) |
|
4092
4092
|
one_of(*mobile_3digits) >> split(4,3..4) |
|
4093
|
-
one_of(*ndcs2) >> split(3,
|
4093
|
+
one_of(*ndcs2) >> split(3,1..10) |
|
4094
4094
|
one_of(*ndcs3) >> split(3,1..9) |
|
4095
4095
|
one_of(*ndcs4) >> split(3,0..8) |
|
4096
4096
|
fixed(5) >> split(3,0..7)
|
@@ -46,7 +46,8 @@ describe 'plausibility' do
|
|
46
46
|
end
|
47
47
|
|
48
48
|
context 'specific countries' do
|
49
|
-
it_is_correct_for 'Austria', :samples => '+43 720 116987' # VoIP
|
49
|
+
it_is_correct_for 'Austria', :samples => ['+43 720 116987', # VoIP
|
50
|
+
'+43 463 12345'] # Klagenfurt
|
50
51
|
it_is_correct_for 'Bosnia and Herzegovina', :samples => ['+387 66 666 666',
|
51
52
|
'+387 37 123 456',
|
52
53
|
'+387 33 222 111']
|
@@ -251,6 +252,7 @@ describe 'plausibility' do
|
|
251
252
|
it_is_correct_for 'Gabonese Republic', :samples => '+241 1 627 739'
|
252
253
|
it_is_correct_for 'Gambia', :samples => '+220 989 5148'
|
253
254
|
it_is_correct_for 'Germany', :samples => [
|
255
|
+
'+49 69 155 1',
|
254
256
|
'+49 1577 536 8701'
|
255
257
|
]
|
256
258
|
it_is_correct_for 'Georgia', :samples => ['+995 220 123 45',
|
@@ -33,13 +33,13 @@ describe 'country descriptions' do
|
|
33
33
|
end
|
34
34
|
|
35
35
|
describe 'Argentina' do
|
36
|
-
it_splits '541112345678', ['54', '11', '1234', '5678']
|
37
|
-
it_splits '542911234567', ['54', '291', '123', '4567']
|
38
|
-
it_splits '
|
39
|
-
it_splits '5491112345678', ['54', '911', '1234', '5678']
|
40
|
-
it_splits '5492201234567', ['54', '9220', '123', '4567']
|
41
|
-
it_splits '5492221123456', ['54', '92221', '12', '3456']
|
42
|
-
it_splits '548001234567', ['54', '800', '123', '4567']
|
36
|
+
it_splits '541112345678', ['54', '11', '1234', '5678'] # 2-digit area code / landline
|
37
|
+
it_splits '542911234567', ['54', '291', '123', '4567'] # 3-digit area code / landline
|
38
|
+
it_splits '542903123456', ['54', '2903', '12', '3456'] # 4-digit area code / landline
|
39
|
+
it_splits '5491112345678', ['54', '911', '1234', '5678'] # 2-digit area code / international mobile
|
40
|
+
it_splits '5492201234567', ['54', '9220', '123', '4567'] # 3-digit area code / international mobile
|
41
|
+
it_splits '5492221123456', ['54', '92221', '12', '3456'] # 4-digit area code / international mobile
|
42
|
+
it_splits '548001234567', ['54', '800', '123', '4567'] # Non-geographic number
|
43
43
|
end
|
44
44
|
|
45
45
|
describe 'Austria' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: phony
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.18.
|
4
|
+
version: 2.18.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Florian Hanke
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-09-11 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: 'Fast international phone number (E164 standard) normalizing, splitting
|
14
14
|
and formatting. Lots of formatting options: International (+.., 00..), national
|
@@ -23,6 +23,7 @@ files:
|
|
23
23
|
- lib/phony.rb
|
24
24
|
- lib/phony/config.rb
|
25
25
|
- lib/phony/countries.rb
|
26
|
+
- lib/phony/countries/argentina.rb
|
26
27
|
- lib/phony/countries/austria.rb
|
27
28
|
- lib/phony/countries/bangladesh.rb
|
28
29
|
- lib/phony/countries/belarus.rb
|