phony 2.20.7 → 2.20.9

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dbab86defbfd8a5efb60e155549ca13d3809b11e1b28e1c6cd4c2d585fe1a1eb
4
- data.tar.gz: 4092da2814cecda8fdec8f64f5eb91e566287cc9f4869653f469bd7664a26066
3
+ metadata.gz: 3d74174244f95d313c9addce1e9bdf6977534fb4accc356566f6e4435b183ec6
4
+ data.tar.gz: e694651c6c3293c9b967ada7eb306913114ede441ed99a920f7acae49186f9a2
5
5
  SHA512:
6
- metadata.gz: 7602a49002ac077a26757f02540869f13b7145554e587f6980cff26ce99d566cd0c225ff34a8e51126069c34658375b1379fc174d0d2e224dc207ed1522ff6c9
7
- data.tar.gz: fc0956c863ec0febe514aa0323f18efd23bc0022412b33522137484a48180090df207e7ae173d8f3ac86ee6082835e37c37262ef8b6c226ddfad433a9bc29599
6
+ metadata.gz: cb0dbf2b5a0e42436c116cb4047dc4848783de6caff1889430b1b3f2b32925ba6eb24428217c1841278ca248f69bb5ec44a8987e6a7beacd29f31147589bd442
7
+ data.tar.gz: 6a586b100039f976fef6f800d5021e6219dbd26c80d22c3945dd588573e65e3f0e64e0e7929b97c87b119b5bc2204386baa9c7fd3b1ebf420830dab247aaa510
@@ -4,7 +4,7 @@
4
4
  #
5
5
  #
6
6
  # NDC Reference
7
- # http://www.anatel.gov.br/hotsites/CodigosNacionaisLocalidade/TelefoneCelular-CodigosDeArea.htm
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{8}$/) >> split(4,4) |
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) |
@@ -287,6 +287,7 @@ Phony.define do
287
287
  /\A\d{6}\z/ => [4,2],
288
288
  /\A\d{7}\z/ => [4,3],
289
289
  /\A\d{8}\z/ => [4,4],
290
+ /\A\d{9}\z/ => [4,5]
290
291
  ) |
291
292
  one_of(*ndcs_2digit) >> matched_split(
292
293
  /\A\d{4}\z/ => [4],
@@ -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
@@ -628,6 +636,9 @@ describe 'plausibility' do
628
636
 
629
637
  Phony.plausible?('+39 803 08163').should be_falsy
630
638
  Phony.plausible?('+39 803 081').should be_truthy
639
+
640
+ Phony.plausible?('+39 06 8323074181').should be_falsy
641
+ Phony.plausible?('+39 06 832307418').should be_truthy
631
642
  end
632
643
 
633
644
  it 'is correct for Russia' do
@@ -147,9 +147,8 @@ describe 'country descriptions' do
147
147
  end
148
148
 
149
149
  describe 'Brazil' do
150
- it_splits '551112341234', ['55', '11', '1234', '1234']
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.7
4
+ version: 2.20.9
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-08-14 00:00:00.000000000 Z
11
+ date: 2023-10-16 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,26 +115,26 @@ required_rubygems_version: !ruby/object:Gem::Requirement
115
115
  - !ruby/object:Gem::Version
116
116
  version: '0'
117
117
  requirements: []
118
- rubygems_version: 3.2.3
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
122
122
  formatting.
123
123
  test_files:
124
- - spec/lib/phony_spec.rb
125
- - spec/lib/phony/trunk_code_spec.rb
126
- - spec/lib/phony/country_spec.rb
127
- - spec/lib/phony/national_code_spec.rb
124
+ - spec/functional/config_spec.rb
125
+ - spec/functional/plausibility_spec.rb
128
126
  - spec/lib/phony/countries_spec.rb
127
+ - spec/lib/phony/country_codes_spec.rb
128
+ - spec/lib/phony/country_spec.rb
129
129
  - spec/lib/phony/dsl_spec.rb
130
- - spec/lib/phony/national_splitters/variable_spec.rb
130
+ - spec/lib/phony/local_splitters/fixed_spec.rb
131
+ - spec/lib/phony/local_splitters/regex_spec.rb
132
+ - spec/lib/phony/national_code_spec.rb
133
+ - spec/lib/phony/national_splitters/default_spec.rb
134
+ - spec/lib/phony/national_splitters/fixed_spec.rb
131
135
  - spec/lib/phony/national_splitters/none_spec.rb
132
136
  - spec/lib/phony/national_splitters/regex_spec.rb
133
- - spec/lib/phony/national_splitters/fixed_spec.rb
134
- - spec/lib/phony/national_splitters/default_spec.rb
135
- - spec/lib/phony/country_codes_spec.rb
136
- - spec/lib/phony/local_splitters/regex_spec.rb
137
- - spec/lib/phony/local_splitters/fixed_spec.rb
137
+ - spec/lib/phony/national_splitters/variable_spec.rb
138
+ - spec/lib/phony/trunk_code_spec.rb
138
139
  - spec/lib/phony/vanity_spec.rb
139
- - spec/functional/config_spec.rb
140
- - spec/functional/plausibility_spec.rb
140
+ - spec/lib/phony_spec.rb