phony 2.0.0.beta7 → 2.0.0.beta8
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 +8 -8
- data/lib/phony/countries/austria.rb +27 -16
- data/spec/lib/phony/countries_spec.rb +3 -2
- data/spec/lib/phony/validations_spec.rb +4 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YTAwNWIzNzY3NzI3NWM2OTg1NTUxZDE0ZWViOTJlZjNiNjJmMGM4Mg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NjUyMjcwMjUyYjZkMjAxNDI4YzQ0OGRkODg4YmI0YzBiNjhiZjQwZA==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ODZiZTM0ZDM5OGIxODFhZGZkZmFhZmI2YmNlMDc1MTBjMGUzZDgzZjgwMDg1
|
10
|
+
MWJkZjY4YjlhOWQxZjMwNjI2NGQwYzVlNmMzNmJjN2VjMzIyMWQ0YjM1NzZk
|
11
|
+
OGQ0YTNiZmEyMjY4YjU5YzIwYjgzMjkwNTIwY2M5YTdiMzUxZGU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NjM5ZjY0OTQ3ZGQ2OWFjY2I3Y2E3OTk2YTAyZGYyMjBhZmIzMzBkNTk5NmZj
|
14
|
+
ZDkyNDJiYjcxOGM2MTIyNGI1YjhkNGI5NzhlZDc1MDRlNTA1MzJlZGE1ZDg4
|
15
|
+
ZWFkM2ZjY2UyZWEzZjQ4NmY2MDY1NDEyMzllOGNiYjc5ZWNlZTQ=
|
@@ -1,27 +1,30 @@
|
|
1
1
|
# Austria uses a variable-length ndc code, thus we use a separate file to not let all_other.rb explode.
|
2
2
|
#
|
3
3
|
ndcs = [
|
4
|
-
'1', # Vienna
|
5
|
-
'57', # -
|
6
|
-
'59', # -
|
4
|
+
# '1', # Vienna
|
7
5
|
'89', # Routing Number
|
8
6
|
'316', # Graz
|
9
|
-
'501', # -
|
10
|
-
'502', # -
|
11
|
-
'503', # -
|
12
|
-
'504', # -
|
13
|
-
'505', # -
|
14
|
-
'506', # -
|
15
|
-
'507', # -
|
16
|
-
'508', # -
|
17
|
-
'509', # -
|
18
7
|
'512', # Innsbruck
|
19
|
-
'517', # -
|
20
8
|
'662', # Salzburg
|
21
|
-
'720', #
|
22
9
|
'732' # Linz
|
23
10
|
]
|
24
11
|
|
12
|
+
corporate = [
|
13
|
+
'57', # -
|
14
|
+
'59', # -
|
15
|
+
'501', # -
|
16
|
+
'502', # -
|
17
|
+
'503', # -
|
18
|
+
'504', # -
|
19
|
+
'505', # -
|
20
|
+
'506', # -
|
21
|
+
'507', # -
|
22
|
+
'508', # -
|
23
|
+
'509', # -
|
24
|
+
'517', # -
|
25
|
+
'720', #
|
26
|
+
]
|
27
|
+
|
25
28
|
mobile = [
|
26
29
|
'67',
|
27
30
|
'68',
|
@@ -70,7 +73,15 @@ service = [
|
|
70
73
|
'939'
|
71
74
|
]
|
72
75
|
|
76
|
+
# https://www.rtr.at/en/tk/E129/Austrian_Numbering_Plan_2011-03-30.pdf
|
77
|
+
#
|
78
|
+
# TODO Add more details.
|
79
|
+
#
|
73
80
|
Phony.define do
|
74
|
-
country '43', one_of(
|
75
|
-
|
81
|
+
country '43', one_of('1') >> split(4) | # Vienna
|
82
|
+
one_of(service) >> split(9) |
|
83
|
+
one_of(corporate) >> split(5) |
|
84
|
+
one_of(ndcs) >> split(6) |
|
85
|
+
one_of(mobile) >> split(7) |
|
86
|
+
fixed(4) >> split(7)
|
76
87
|
end
|
@@ -29,8 +29,9 @@ describe 'country descriptions' do
|
|
29
29
|
it_splits '548001234567', ['54', '800', '123', '4567']
|
30
30
|
end
|
31
31
|
describe 'Austria' do
|
32
|
-
it_splits '43198110',
|
33
|
-
it_splits '
|
32
|
+
it_splits '43198110', ['43', '1', '98110'] # Vienna
|
33
|
+
it_splits '43800123456789', ['43', '800', '123456789'] # Free
|
34
|
+
it_splits '4366914093902', ['43', '669', '14093902'] # Mobile
|
34
35
|
it_splits '433161234567891', ['43', '316', '1234567891'] # Graz
|
35
36
|
it_splits '432164123456789', ['43', '2164', '123456789'] # Rohrau
|
36
37
|
end
|
@@ -216,9 +216,10 @@ describe 'validations' do
|
|
216
216
|
end
|
217
217
|
|
218
218
|
it "is correct for Austria" do
|
219
|
-
Phony.plausible?('+43 501
|
220
|
-
Phony.plausible?('+43 501
|
221
|
-
Phony.plausible?('+43 501
|
219
|
+
Phony.plausible?('+43 501 12345').should be_true
|
220
|
+
Phony.plausible?('+43 501 1234').should be_false # too short
|
221
|
+
Phony.plausible?('+43 501 123456').should be_false # too long
|
222
|
+
Phony.plausible?('+43 800 123456789').should be_true
|
222
223
|
end
|
223
224
|
|
224
225
|
it "is correct for Azerbaijan" do
|
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.0.0.
|
4
|
+
version: 2.0.0.beta8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Florian Hanke
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-06-17 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
|