phony 2.18.12 → 2.18.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/phony/countries.rb +3 -2
- data/lib/phony/countries/china.rb +1 -1
- data/spec/lib/phony/countries_spec.rb +15 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e14e2c7d06393753fce0427aa20663f54f193738bfd16b540a36e76d5ba2acc
|
4
|
+
data.tar.gz: 3d88d8b49030814139b5bcc32f6e527d8cf6320cd94276a24e9d80518dc00f28
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1fa00cd7d9c0e5610eece54633e47f5af65996a35697b564da8b021e5280139c8151544c9356716db899c33e89aca258d7c150e95d01d6e01069baf122908797
|
7
|
+
data.tar.gz: b3de10ec071c5db69937bc2bd169def6f56ab3a127d2f7d18945438b1da2fb2cd6e022ecb74db40ec1a2efe27e76b2b379ec96ac6b3dbd041789d24e5684a29b
|
data/lib/phony/countries.rb
CHANGED
@@ -102,7 +102,7 @@ Phony.define do
|
|
102
102
|
match(/^(800|90\d)\d+$/) >> split(2,3) | # Toll free service and premium numbers
|
103
103
|
match(/^(46[05678])\d{6}$/) >> split(2,2,2) | # Mobile (Lycamobile, Telenet, Join Experience, Proximus 0460)
|
104
104
|
match(/^(4[789]\d)\d{6}$/) >> split(2,2,2) | # Mobile
|
105
|
-
match(/^(
|
105
|
+
match(/^(45[56])\d{6}$/) >> split(2,2,2) | # Mobile Vikings and Voo
|
106
106
|
one_of('2','3','4','9') >> split(3,2,2) | # Short NDCs
|
107
107
|
fixed(2) >> split(2,2,2) # 2-digit NDCs
|
108
108
|
|
@@ -382,8 +382,9 @@ Phony.define do
|
|
382
382
|
# Ghana
|
383
383
|
#
|
384
384
|
# From http://www.itu.int/oth/T0202000052/en
|
385
|
+
# https://en.wikipedia.org/wiki/Telephone_numbers_in_Ghana
|
385
386
|
#
|
386
|
-
country '233', fixed(2) >> split(3,4)
|
387
|
+
country '233', trunk('0') | fixed(2) >> split(3,4)
|
387
388
|
|
388
389
|
# Nigeria
|
389
390
|
# 3 4 split for mobile and 1 digit NDC, 3 2 or 3 3 otherwise
|
@@ -19,7 +19,7 @@ ndcs = [
|
|
19
19
|
'28', # Chengdu
|
20
20
|
'29', # Xi'an
|
21
21
|
]
|
22
|
-
mobile = %w{ 130 131 132 133 134 135 136 137 138 139 145 150 151 152 153 155 156 157 158 159 185 186 187 188 189 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 }
|
22
|
+
mobile = %w{ 130 131 132 133 134 135 136 137 138 139 145 146 147 148 149 150 151 152 153 155 156 157 158 159 162 165 166 167 170 171 172 173 174 175 176 177 178 180 181 182 183 184 185 186 187 188 189 190 191 192 193 195 196 197 198 199 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 }
|
23
23
|
service = %w{ 110 114 119 120 122 999 } # Probably not exhaustive. TODO Look at http://www.eoc.com.cn/?action-viewnews-itemid-11493.
|
24
24
|
|
25
25
|
Phony.define do
|
@@ -105,6 +105,7 @@ describe 'country descriptions' do
|
|
105
105
|
it_splits '3216473200', ['32', '16', '47', '32', '00'] # Leuven
|
106
106
|
it_splits '32475279584', ['32', '475', '27', '95', '84'] # mobile
|
107
107
|
it_splits '32468279584', ['32', '468', '27', '95', '84'] # mobile (Telenet)
|
108
|
+
it_splits '32455123456', ['32', '455', '12', '34', '56'] # mobile (Voo)
|
108
109
|
it_splits '3270123123', ['32', '70', '123', '123'] # Bus Service?
|
109
110
|
it_splits '3278123123', ['32', '78', '123', '123'] # National rate service
|
110
111
|
it_splits '3290123123', ['32', '901', '23', '123'] # National rate service
|
@@ -214,6 +215,20 @@ describe 'country descriptions' do
|
|
214
215
|
describe 'China' do
|
215
216
|
it_splits '862112345678', ['86', '21', '1234', '5678'] # Shanghai
|
216
217
|
it_splits '8675582193447', ['86', '755', '8219', '3447'] # Shenzhen
|
218
|
+
|
219
|
+
context 'mobile numbers' do
|
220
|
+
%w{
|
221
|
+
130 131 132 133 134 135 136 137 138 139
|
222
|
+
145 146 147 148 149
|
223
|
+
150 151 152 153 155 156 157 158 159
|
224
|
+
162 165 166 167
|
225
|
+
170 171 172 173 174 175 176 177 178
|
226
|
+
180 181 182 183 184 185 186 187 188 189
|
227
|
+
190 191 192 193 195 196 197 198 199
|
228
|
+
}.each do |prefix|
|
229
|
+
it_splits "86#{prefix}12345678", ['86', prefix, '1234', '5678']
|
230
|
+
end
|
231
|
+
end
|
217
232
|
end
|
218
233
|
describe 'Colombia' do
|
219
234
|
it_splits '5711234567', ['57', '1', '123', '4567']
|
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.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Florian Hanke
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-05-24 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
|
@@ -114,7 +114,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
114
114
|
- !ruby/object:Gem::Version
|
115
115
|
version: '0'
|
116
116
|
requirements: []
|
117
|
-
rubygems_version: 3.0.
|
117
|
+
rubygems_version: 3.0.3
|
118
118
|
signing_key:
|
119
119
|
specification_version: 4
|
120
120
|
summary: Fast international phone number (E164 standard) normalizing, splitting and
|