phony 2.18.4 → 2.18.5

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: db79646f3b77b08c8894645615cfb86ac101c27f7aa7f45ff11f3b5465ce6ec4
4
- data.tar.gz: 3c4b444c507b434adbe52651941b444019313c1c09473e64a8dc779036b8b549
3
+ metadata.gz: da81c89f8da18101dd1ad489ec5c6e7c66d6f3836058ba9b33f1eb4c02395ea2
4
+ data.tar.gz: a8fe8edd6e28d32ad7a0ea2ccdfb69c52897c2163f735b44b3e71e3fed7175ea
5
5
  SHA512:
6
- metadata.gz: 267251e1d56ab1b335c3779b5a28a7b15d8b73b9635a1e60a604cf48b500f376c65fcd6a158e94d4eb07db97e392410443094da02694224561f1a48d4175c037
7
- data.tar.gz: f496ad6a5854fbdaa919fb5fc175dbba898fcd5261096fe3df43929f98b4bf1af476bc80853b16116703ab99aae3b34eb014ed7903e46fb0dbc93bfe829dcedb
6
+ metadata.gz: b36455cfb130e3657e423b331f7a2978fd960be66af3834335506ce3c0a17690bb9775aefacbba1b5a617550e6f42f34b8e7a5c1c9cfb67d6a4d7e95cc2e17b0
7
+ data.tar.gz: 82d22fff926d5225418694fdcaa8553f621d529151f870d05530b74b11b9405b3164a67e7bc8bc14638610da58c14f0680939a7762243ec93f4d262f9d7b3b22
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__
@@ -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, 5) | # mobile
352
+ one_of(area_codes_3digits.map{|x| "9#{x}" }) >> split(3, 5) | # mobile
353
+ one_of(area_codes_4digits.map{|x| "9#{x}" }) >> split(2, 5) | # mobile
354
+ one_of(special_numbers) >> split(3, 4)
355
+ end
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phony
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.18.4
4
+ version: 2.18.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Hanke
@@ -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