phony 2.18.2 → 2.18.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ea6a3fcf311fb539d4de327e4b2a80485c45417dcf79318d3ea083c1f998c60f
4
- data.tar.gz: 30e543ef23ec7bff7946d062f35ca8341a30f1175b9bb662293268e7c85b8115
3
+ metadata.gz: dc7effe6a83fbea02459d9360ed7b3110943b0f2f6cdd93842ba49a8b0c57a53
4
+ data.tar.gz: 2cce60443a4838b3d00465b4f846ee4672cae256b777b86a5b2a6ef21c09c4ea
5
5
  SHA512:
6
- metadata.gz: 3c16ac5a223f7b39a17d5dee668461eac0542d307789937d23c476b402b51f0c10ca64c460e3778a538c8e550aebf5cf13bc3697d4cd8d5b4957f4a92ff6476b
7
- data.tar.gz: 445dc30f4055f53f3d1ba3ea5914ca3936941f9a8eaba1a0e4c4d871625ce50e4448fb6d25889d7685549c9f8f0b7202ccda10f7e7ab0bb67e321b205fe188b7
6
+ metadata.gz: 47fd5724f9f51c3f9ebec8066d807cec3696b29e28bb0089dea3f161dcac1f44339f77c14d47dd96666e975c0dea71f83c16f66bc4b30c2342ee476eb1204668
7
+ data.tar.gz: 2f5c1eb7b33ab1666ed3a8bcf84dab9accf91a0da767876f055266ac5a7b679e38d5f29fc4b895cf1d481e60b545763a2721cd2e852f331e5155a7040208d885
@@ -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__
@@ -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 3 mobile operators
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
@@ -4021,8 +4021,9 @@ mobile_4digits = [
4021
4021
  '1520', # Vodafone
4022
4022
  '1521', # Lycamobile
4023
4023
  '1522', # Vodafone
4024
+ '1523', # Vodafone
4024
4025
  '1570', # vistream
4025
- '1527', # E-Plus
4026
+ '1577', # E-Plus
4026
4027
  '1672', # Dolphin Telecom
4027
4028
  ]
4028
4029
 
@@ -4089,7 +4090,7 @@ Phony.define do
4089
4090
  one_of(*service) >> split(3,1..9) |
4090
4091
  one_of(*mobile_4digits) >> split(3,4) |
4091
4092
  one_of(*mobile_3digits) >> split(4,3..4) |
4092
- one_of(*ndcs2) >> split(3,2..10) |
4093
+ one_of(*ndcs2) >> split(3,1..10) |
4093
4094
  one_of(*ndcs3) >> split(3,1..9) |
4094
4095
  one_of(*ndcs4) >> split(3,0..8) |
4095
4096
  fixed(5) >> split(3,0..7)
@@ -170,7 +170,7 @@ module Phony
170
170
  #
171
171
  def plausible? rest, hints = {}
172
172
  local, _, ndc, *rest = internal_split rest
173
-
173
+
174
174
  # Element based checking.
175
175
  #
176
176
  # Note: ndc == false means the country has none.
@@ -251,7 +251,8 @@ describe 'plausibility' do
251
251
  it_is_correct_for 'Gabonese Republic', :samples => '+241 1 627 739'
252
252
  it_is_correct_for 'Gambia', :samples => '+220 989 5148'
253
253
  it_is_correct_for 'Germany', :samples => [
254
- '+49 157 753 6870'
254
+ '+49 69 155 1',
255
+ '+49 1577 536 8701'
255
256
  ]
256
257
  it_is_correct_for 'Georgia', :samples => ['+995 220 123 45',
257
258
  '+995 32 123 4567',
@@ -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 '542965123456', ['54', '2965', '12', '3456']
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
@@ -291,7 +291,7 @@ describe 'country descriptions' do
291
291
  it_splits '49800222340010', ['49', '800', '222', '340010'] # Service number
292
292
 
293
293
  it_splits '4915111231234', ['49', '151', '1123', '1234'] # Mobile number
294
- it_splits '4915771231234', ['49', '157', '7123', '1234'] # Mobile number
294
+ it_splits '4915771231234', ['49', '1577', '123', '1234'] # Mobile number
295
295
  it_splits '491601234567', ['49', '160', '1234', '567'] # Mobile number
296
296
  it_splits '4916312345678', ['49', '163', '1234', '5678'] # Mobile number
297
297
  it_splits '4915211231234', ['49', '1521', '123', '1234'] # Mobile number
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.2
4
+ version: 2.18.7
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-05-02 00:00:00.000000000 Z
11
+ date: 2019-09-04 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