phony 2.19.11 → 2.20.13
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 +4 -4
- data/README.textile +5 -1
- data/lib/phony/countries/brazil.rb +2 -2
- data/lib/phony/countries/italy.rb +34 -17
- data/lib/phony/countries/japan.rb +51 -2
- data/lib/phony/countries/vietnam.rb +3 -0
- data/lib/phony/countries.rb +41 -21
- data/lib/phony/country_codes.rb +13 -0
- data/spec/functional/config_spec.rb +5 -5
- data/spec/functional/plausibility_spec.rb +49 -7
- data/spec/lib/phony/countries_spec.rb +20 -9
- data/spec/lib/phony/country_codes_spec.rb +78 -55
- data/spec/lib/phony/country_spec.rb +13 -13
- data/spec/lib/phony/dsl_spec.rb +6 -2
- data/spec/lib/phony/local_splitters/regex_spec.rb +12 -15
- data/spec/lib/phony/national_code_spec.rb +15 -45
- data/spec/lib/phony/national_splitters/fixed_spec.rb +12 -16
- data/spec/lib/phony/national_splitters/none_spec.rb +3 -3
- data/spec/lib/phony/national_splitters/variable_spec.rb +9 -13
- data/spec/lib/phony/vanity_spec.rb +4 -4
- metadata +15 -15
@@ -4,34 +4,30 @@ describe Phony::NationalSplitters::Variable do
|
|
4
4
|
|
5
5
|
describe 'split' do
|
6
6
|
context 'normal' do
|
7
|
-
|
8
|
-
@splitter = Phony::NationalSplitters::Variable.new 4, ['1', '316', '67', '68', '669', '711']
|
9
|
-
end
|
7
|
+
let(:splitter) { Phony::NationalSplitters::Variable.new 4, ['1', '316', '67', '68', '669', '711'] }
|
10
8
|
it "handles Vienna" do
|
11
|
-
|
9
|
+
expect(splitter.split('198110')).to eq [nil, '1', '98110']
|
12
10
|
end
|
13
11
|
it "handles some mobile services" do
|
14
|
-
|
12
|
+
expect(splitter.split('66914093902')).to eq [nil, '669', '14093902']
|
15
13
|
end
|
16
14
|
it "handles Graz" do
|
17
|
-
|
15
|
+
expect(splitter.split('3161234567891')).to eq [nil, '316', '1234567891']
|
18
16
|
end
|
19
17
|
it "handles Rohrau" do
|
20
|
-
|
18
|
+
expect(splitter.split('2164123456789')).to eq [nil, '2164', '123456789']
|
21
19
|
end
|
22
20
|
it 'has an NDC length of 3' do
|
23
|
-
|
21
|
+
expect(splitter.length).to eq (1..3)
|
24
22
|
end
|
25
23
|
end
|
26
24
|
context 'special handling for using the variable size splitter for Swiss service numbers' do
|
27
|
-
|
28
|
-
@splitter = Phony::NationalSplitters::Variable.new 2, ['800']
|
29
|
-
end
|
25
|
+
let(:splitter) { Phony::NationalSplitters::Variable.new 2, ['800'] }
|
30
26
|
it "should handle swiss service numbers" do
|
31
|
-
|
27
|
+
expect(splitter.split('800223344')).to eq [nil, '800', '223344']
|
32
28
|
end
|
33
29
|
it 'has an NDC length of 3' do
|
34
|
-
|
30
|
+
expect(splitter.length).to eq (3..3)
|
35
31
|
end
|
36
32
|
end
|
37
33
|
end
|
@@ -8,22 +8,22 @@ describe Phony::Vanity do
|
|
8
8
|
|
9
9
|
describe '.replace' do
|
10
10
|
it 'replaces letters with digits' do
|
11
|
-
vanity.replace('1-800-HELLO').
|
11
|
+
expect(vanity.replace('1-800-HELLO')).to eq '1-800-43556'
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
15
|
describe '.vanity?' do
|
16
16
|
it 'returns true on a vanity number' do
|
17
|
-
vanity.vanity?('800HELLOES').
|
17
|
+
expect(vanity.vanity?('800HELLOES')).to eq true
|
18
18
|
end
|
19
19
|
it 'returns false on a non-vanity number' do
|
20
|
-
vanity.vanity?('8004355637').
|
20
|
+
expect(vanity.vanity?('8004355637')).to eq false
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
24
|
describe '.normalized' do
|
25
25
|
it 'normalizes the vanity number' do
|
26
|
-
vanity.normalized('1-800-HELLO').
|
26
|
+
expect(vanity.normalized('1-800-HELLO')).to eq '1800HELLO'
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
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.
|
4
|
+
version: 2.20.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: 2024-08-13 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.
|
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/
|
125
|
-
- spec/
|
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/
|
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/
|
134
|
-
- spec/lib/phony/
|
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/
|
140
|
-
- spec/functional/plausibility_spec.rb
|
140
|
+
- spec/lib/phony_spec.rb
|