phony 2.20.6 → 2.20.8
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/brazil.rb +2 -2
- data/lib/phony/countries.rb +1 -0
- data/spec/functional/plausibility_spec.rb +8 -0
- data/spec/lib/phony/countries_spec.rb +2 -2
- 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: a9beecb3c5ba9d3ca599f0a3284aa82305bb5512d479f0fc55c10467e1e5e3b2
|
4
|
+
data.tar.gz: b704cd453f22ebd0ca35e838895f706ee662882001c133f1f970d7b8a65338f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c611f80164333973c6f3193f8997aaffefb492eb7417dc8a603d7adcfd5183d8c474806e1cd85e521f97078e36adecc3cbb43c50ee8062f40f994400324212aa
|
7
|
+
data.tar.gz: 2fd3068506fa93bba120e6c62eb49055bad27fee5725dc665c10112d1c8b1a1bbab148347dbda0e3d6d9e60885f4df8df56c173e56966a34544dd36cab5d5021
|
@@ -4,7 +4,7 @@
|
|
4
4
|
#
|
5
5
|
#
|
6
6
|
# NDC Reference
|
7
|
-
#
|
7
|
+
# https://www.gov.br/anatel/pt-br/regulado/numeracao/plano-de-numeracao-brasileiro
|
8
8
|
|
9
9
|
# 11 #Sao Paulo
|
10
10
|
# 12 #Sao Paulo
|
@@ -99,7 +99,7 @@ special_numbers_4 = %w{ 3003 4003 4004 4020 }
|
|
99
99
|
Phony.define do
|
100
100
|
country '55',
|
101
101
|
match(/^#{ndcs}9\d{8}$/) >> split(5,4) |
|
102
|
-
match(/^#{ndcs}\d{
|
102
|
+
match(/^#{ndcs}[2-5]\d{7}$/) >> split(4,4) |
|
103
103
|
one_of(special_numbers_3_4) >> split(3,4) |
|
104
104
|
one_of(special_numbers_4) >> split(4) |
|
105
105
|
one_of(service) >> split(3) |
|
data/lib/phony/countries.rb
CHANGED
@@ -1079,6 +1079,7 @@ Phony.define do
|
|
1079
1079
|
|
1080
1080
|
# Lao People's Democratic Republic http://www.wtng.info/wtng-856-la.html, https://www.numberingplans.com
|
1081
1081
|
country '856',
|
1082
|
+
trunk('0') |
|
1082
1083
|
one_of('30') >> split(3,4) | # geographic
|
1083
1084
|
one_of('20') >> split(4,4) | # mobile
|
1084
1085
|
fixed(2) >> split(3,3) # geographic
|
@@ -51,6 +51,14 @@ describe 'plausibility' do
|
|
51
51
|
it_is_correct_for 'Bosnia and Herzegovina', :samples => ['+387 66 666 666',
|
52
52
|
'+387 37 123 456',
|
53
53
|
'+387 33 222 111']
|
54
|
+
it 'is correct for Brasil' do
|
55
|
+
Phony.plausible?('+55 67 998280912').should be_truthy
|
56
|
+
Phony.plausible?('+55 67 98280912').should be_falsey
|
57
|
+
Phony.plausible?('+55 11 12345678').should be_falsey
|
58
|
+
Phony.plausible?('+55 11 123456789').should be_falsey
|
59
|
+
Phony.plausible?('+55 11 023456789').should be_falsey
|
60
|
+
Phony.plausible?('+55 11 22345678').should be_truthy
|
61
|
+
end
|
54
62
|
it 'is correct for Bulgaria' do
|
55
63
|
Phony.plausible?('+359 2 1234567').should be_truthy
|
56
64
|
Phony.plausible?('+359 30 12345').should be_truthy
|
@@ -147,9 +147,8 @@ describe 'country descriptions' do
|
|
147
147
|
end
|
148
148
|
|
149
149
|
describe 'Brazil' do
|
150
|
-
it_splits '
|
150
|
+
it_splits '551122341234', ['55', '11', '2234', '1234']
|
151
151
|
it_splits '5511981231234', ['55', '11', '98123', '1234'] # São Paulo's 9 digits mobile
|
152
|
-
it_splits '552181231234', ['55', '21', '8123', '1234']
|
153
152
|
it_splits '5521981231234', ['55', '21', '98123', '1234'] # Rio de Janeiro's 9 digits mobile
|
154
153
|
it_splits '551931311234', ['55', '19', '3131', '1234']
|
155
154
|
it_splits '5531991311234', ['55', '31', '99131', '1234'] # Belo Horizonte's 9th digit
|
@@ -157,6 +156,7 @@ describe 'country descriptions' do
|
|
157
156
|
it_splits '5579991311234', ['55', '79', '99131', '1234'] # Sergipe's 9th digit
|
158
157
|
it_splits '5547991311234', ['55', '47', '99131', '1234'] # Santa Catarina's 9th digit
|
159
158
|
it_splits '5541991311234', ['55', '41', '99131', '1234'] # Parana's 9th digit
|
159
|
+
it_splits '556734212121', ['55', '67', '3421', '2121']
|
160
160
|
|
161
161
|
context 'mobile numbers' do
|
162
162
|
%w{
|
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.20.
|
4
|
+
version: 2.20.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: 2023-
|
11
|
+
date: 2023-09-06 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
|
@@ -115,7 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
115
115
|
- !ruby/object:Gem::Version
|
116
116
|
version: '0'
|
117
117
|
requirements: []
|
118
|
-
rubygems_version: 3.4.
|
118
|
+
rubygems_version: 3.4.19
|
119
119
|
signing_key:
|
120
120
|
specification_version: 4
|
121
121
|
summary: Fast international phone number (E164 standard) normalizing, splitting and
|