phony 2.2.16 → 2.3.0
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 +14 -6
- data/lib/phony.rb +1 -0
- data/lib/phony/countries.rb +9 -12
- data/lib/phony/countries/china.rb +1 -1
- data/lib/phony/countries/italy.rb +3 -47
- data/lib/phony/countries/ukraine.rb +13 -1
- data/lib/phony/countries/vietnam.rb +129 -0
- data/lib/phony/dsl.rb +12 -6
- data/lib/phony/national_splitters/dsl.rb +4 -0
- data/spec/functional/plausibility_spec.rb +31 -2
- data/spec/lib/phony/countries_spec.rb +19 -4
- data/spec/lib/phony_spec.rb +5 -0
- metadata +10 -9
checksums.yaml
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
MzFlYWI4ZGNmZGYxOTNhOWZjMGZmZTIxZWYxNTNlZjhkZmI1MDdhMg==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
MTAyODcwOTk2Zjg2MDFkMjExMzM3MTJmMjY1MTJkYjJiYjgzZTVjZQ==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
MzYwODJhZmJkNjU2MGUyMDhmZDc2NDM1OGNkYmQ4MzJjN2U2NDYwOWNlMGNh
|
10
|
+
ZDViOGFiNGJjYWUwZTlkY2FkYjhiZjNhNTg1ODZlNjRhMDU2NjhjNDE0NjEz
|
11
|
+
ZjJhNDI1MGRlOWUwYWFmYzkyMTE1ODE4NmZhZDUzZWFkYmIxMDA=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
NzU3Y2FlOGMwMTkzNTBhZDQyZTU0NDIyZDdkZWU5ZmVhMDY3MTgwZDI5ZDJl
|
14
|
+
NWMwNGU3YmQyZGFlMWMzNTJkYTI2YWYzYTIyNDY1MDgwY2M2YTJlMDI4NTdj
|
15
|
+
NWQ1MTc3YzRlZDEzZGExNDhlZDc2OTRjMjc4NTdmNTUyOGQwYjk=
|
data/lib/phony.rb
CHANGED
@@ -53,6 +53,7 @@ require File.expand_path '../phony/countries/sweden', __FILE__
|
|
53
53
|
require File.expand_path '../phony/countries/taiwan', __FILE__
|
54
54
|
require File.expand_path '../phony/countries/tajikistan', __FILE__
|
55
55
|
require File.expand_path '../phony/countries/turkmenistan', __FILE__
|
56
|
+
require File.expand_path '../phony/countries/vietnam', __FILE__
|
56
57
|
require File.expand_path '../phony/countries/ukraine', __FILE__
|
57
58
|
require File.expand_path '../phony/countries/united_kingdom', __FILE__
|
58
59
|
require File.expand_path '../phony/countries/uruguay', __FILE__
|
data/lib/phony/countries.rb
CHANGED
@@ -23,7 +23,7 @@ Phony.define do
|
|
23
23
|
|
24
24
|
# Reserved.
|
25
25
|
#
|
26
|
-
|
26
|
+
reserved '0'
|
27
27
|
|
28
28
|
# USA, Canada, etc.
|
29
29
|
#
|
@@ -239,10 +239,7 @@ Phony.define do
|
|
239
239
|
|
240
240
|
# country '82' # SouthKorea, see special file.
|
241
241
|
|
242
|
-
country '84'
|
243
|
-
one_of('4', '8') >> split(7) |
|
244
|
-
match(/^(2[025679]|3[0136789]|5[23456789]|6[01234678]|7[02345679]|9[0-8])\d/) >> split(6) |
|
245
|
-
fixed(3) >> split(5)
|
242
|
+
# country '84' # Vietnam, see special file.
|
246
243
|
|
247
244
|
# country '86' # China, see special file.
|
248
245
|
|
@@ -881,11 +878,11 @@ Phony.define do
|
|
881
878
|
country '872', todo # Inmarsat (Pacific Ocean)
|
882
879
|
country '873', todo # Inmarsat (Indian Ocean)
|
883
880
|
country '874', todo # Inmarsat (Atlantic Ocean-West)
|
884
|
-
country '875', todo #
|
885
|
-
country '876', todo #
|
886
|
-
country '877', todo #
|
881
|
+
country '875', todo # Maritime Mobile Service Applications
|
882
|
+
country '876', todo # Maritime Mobile Service Applications
|
883
|
+
country '877', todo # Maritime Mobile Service Applications
|
887
884
|
country '878', todo # Universal Personal Telecommunication Service (UPT)
|
888
|
-
|
885
|
+
reserved '879' # Reserved for national non-commercial purposes
|
889
886
|
|
890
887
|
# Bangladesh (People's Republic of)
|
891
888
|
# country '880' # see special file
|
@@ -899,7 +896,7 @@ Phony.define do
|
|
899
896
|
# country '886' # Taiwan, see special file
|
900
897
|
|
901
898
|
country '887', todo # -
|
902
|
-
|
899
|
+
reserved '888' # Reserved for future global service
|
903
900
|
country '889', todo # -
|
904
901
|
|
905
902
|
country '890', todo # -
|
@@ -985,7 +982,7 @@ Phony.define do
|
|
985
982
|
# Oman (Sultanate of), https://www.numberingplans.com/?page=dialling&sub=areacodes
|
986
983
|
country '968', fixed(2) >> split(3,3)
|
987
984
|
|
988
|
-
|
985
|
+
reserved '969' # Reserved - reservation currently under investigation
|
989
986
|
|
990
987
|
country '970', # 970 is used in those countries that block access to 972 (Israel)
|
991
988
|
one_of('1') >> split(3,3,3) | # special numbers
|
@@ -1057,5 +1054,5 @@ Phony.define do
|
|
1057
1054
|
|
1058
1055
|
country '997', todo # Spare code
|
1059
1056
|
country '998', fixed(2) >> split(3, 4) # Uzbekistan (Republic of) http://www.wtng.info/wtng-998-uz.html
|
1060
|
-
|
1057
|
+
reserved '999' # Reserved for possible future use within the Telecommunications for Disaster Relief (TDR) concept
|
1061
1058
|
end
|
@@ -94,53 +94,9 @@ ndcs_4digit = [
|
|
94
94
|
'0971', # Potenza
|
95
95
|
]
|
96
96
|
|
97
|
-
mobile
|
98
|
-
|
99
|
-
|
100
|
-
'313',
|
101
|
-
'319',
|
102
|
-
'320',
|
103
|
-
'322',
|
104
|
-
'323',
|
105
|
-
'327',
|
106
|
-
'328',
|
107
|
-
'329',
|
108
|
-
'330',
|
109
|
-
'331',
|
110
|
-
'333',
|
111
|
-
'334',
|
112
|
-
'335',
|
113
|
-
'336',
|
114
|
-
'337',
|
115
|
-
'338',
|
116
|
-
'339',
|
117
|
-
'340',
|
118
|
-
'341',
|
119
|
-
'343',
|
120
|
-
'345',
|
121
|
-
'346',
|
122
|
-
'347',
|
123
|
-
'348',
|
124
|
-
'349',
|
125
|
-
'350',
|
126
|
-
'360',
|
127
|
-
'361',
|
128
|
-
'362',
|
129
|
-
'363',
|
130
|
-
'366',
|
131
|
-
'368',
|
132
|
-
'370',
|
133
|
-
'373',
|
134
|
-
'377',
|
135
|
-
'380',
|
136
|
-
'388',
|
137
|
-
'389',
|
138
|
-
'390',
|
139
|
-
'391',
|
140
|
-
'392',
|
141
|
-
'393',
|
142
|
-
'397'
|
143
|
-
]
|
97
|
+
# All 3-- numbers are reserved for mobile phones according to
|
98
|
+
# http://en.wikipedia.org/wiki/Telephone_numbers_in_Italy#Mobile_telephones
|
99
|
+
mobile = (300..399).collect(&:to_s).to_a
|
144
100
|
|
145
101
|
service = [ # Not exhaustive.
|
146
102
|
'112',
|
@@ -600,6 +600,17 @@ ndcs_with_4_subscriber_numbers = %w(
|
|
600
600
|
57572
|
601
601
|
)
|
602
602
|
|
603
|
+
seven_digit_mobile_prefixes = [
|
604
|
+
'50', '66', '95', '99', # MTS-UKR
|
605
|
+
'67', '96', '97', '98', # Kyivstar
|
606
|
+
'63', '93', # Life:)
|
607
|
+
'39', # Kyivstar(Golden Telecom)
|
608
|
+
'68', # Kyivstar(Beeline)
|
609
|
+
'91', # UTEL
|
610
|
+
'92', # PEOPLEnet
|
611
|
+
'94' # Intertelecom
|
612
|
+
]
|
613
|
+
|
603
614
|
ndcs_with_3_subscriber_numbers = %w(433861)
|
604
615
|
|
605
616
|
Phony.define do
|
@@ -608,7 +619,8 @@ Phony.define do
|
|
608
619
|
one_of(ndcs_with_4_subscriber_numbers) >> split(4) |
|
609
620
|
one_of(ndcs_with_5_subscriber_numbers) >> split(3,2) |
|
610
621
|
one_of(ndcs_with_6_subscriber_numbers) >> split(3,3) |
|
622
|
+
one_of(seven_digit_mobile_prefixes) >> split(3,2,2) |
|
611
623
|
one_of('800') >> split(3,3) | # freephone
|
612
624
|
one_of(ndcs_with_7_subscriber_numbers) >> split(4,3) |
|
613
|
-
fixed(3) >> split(3,3) #
|
625
|
+
fixed(3) >> split(3,3) # other
|
614
626
|
end
|
@@ -0,0 +1,129 @@
|
|
1
|
+
# Vietnamese phone numbers.
|
2
|
+
#
|
3
|
+
# http://en.wikipedia.org/wiki/Telephone_numbers_in_Vietnam
|
4
|
+
# http://www.wtng.info/wtng-84-vn.html
|
5
|
+
#
|
6
|
+
# Landline numbers are composed of 1 to 3 digit area code + 5 to 8 digits
|
7
|
+
# Mobile numbers are composed of 0 (trunk) + 2 to 3 digit carrier code + 5 to 8 digits
|
8
|
+
#
|
9
|
+
|
10
|
+
ndcs_with_7_subscriber_digits = [
|
11
|
+
'20', # Lào Cai Province
|
12
|
+
'210', # Phú Thọ Province
|
13
|
+
'211', # Vĩnh Phúc Province
|
14
|
+
'218', # Hòa Bình Province (18 before 24 Nov 2007)
|
15
|
+
'219', # Hà Giang Province (19 before 24 Nov 2007)
|
16
|
+
'22', # Sơn La Province
|
17
|
+
'230', # Điện Biên Province (23 before 24 Nov 2007)
|
18
|
+
'231', # Lai Châu Province (23 before 24 Nov 2007)
|
19
|
+
'240', # Bắc Giang Province
|
20
|
+
'241', # Bắc Ninh Province
|
21
|
+
'25', # Lạng Sơn Province
|
22
|
+
'26', # Cao Bằng Province
|
23
|
+
'27', # Tuyên Quang Province
|
24
|
+
'280', # Thái Nguyên Province
|
25
|
+
'281', # Bắc Kạn Province
|
26
|
+
'29', # Yên Bái Province
|
27
|
+
|
28
|
+
'30', # Ninh Bình Province
|
29
|
+
'31', # Hai Phong city
|
30
|
+
'320', # Hải Dương Province
|
31
|
+
'321', # Hưng Yên Province
|
32
|
+
'33', # Quảng Ninh Province
|
33
|
+
'350', # Nam Định Province
|
34
|
+
'351', # Hà Nam Province
|
35
|
+
'36', # Thái Bình Province
|
36
|
+
'37', # Thanh Hóa Province
|
37
|
+
'38', # Nghệ An Province
|
38
|
+
'39', # Hà Tĩnh Province
|
39
|
+
|
40
|
+
'500', # Đắk Lắk Province (50 before 24 Nov 2007)
|
41
|
+
'501', # Đắk Nông Province (50 before 24 Nov 2007)
|
42
|
+
'510', # Quảng Nam Province
|
43
|
+
'511', # Da Nang city
|
44
|
+
'52', # Quảng Bình Province
|
45
|
+
'53', # Quảng Trị Province
|
46
|
+
'54', # Thừa Thiên–Huế Province
|
47
|
+
'55', # Quảng Ngãi Province
|
48
|
+
'56', # Bình Định Province
|
49
|
+
'57', # Phú Yên Province
|
50
|
+
'58', # Khánh Hòa Province
|
51
|
+
'59', # Gia Lai Province
|
52
|
+
|
53
|
+
'60', # Kon Tum Province
|
54
|
+
'61', # Đồng Nai Province
|
55
|
+
'62', # Bình Thuận Province
|
56
|
+
'63', # Lâm Đồng Province
|
57
|
+
'64', # Bà Rịa–Vũng Tàu Province
|
58
|
+
'650', # Bình Dương Province
|
59
|
+
'651', # Bình Phước Province
|
60
|
+
'66', # Tây Ninh Province
|
61
|
+
'67', # Đồng Tháp Province
|
62
|
+
'68', # Ninh Thuận Province
|
63
|
+
|
64
|
+
'70', # Vĩnh Long Province
|
65
|
+
'710', # Cần Thơ city (71 before 24 Nov 2007)
|
66
|
+
'711', # Hậu Giang Province (71 before 24 Nov 2007)
|
67
|
+
'72', # Long An Province
|
68
|
+
'73', # Tiền Giang Province
|
69
|
+
'74', # Trà Vinh Province
|
70
|
+
'75', # Bến Tre Province
|
71
|
+
'76', # An Giang Province
|
72
|
+
'77', # Kiên Giang Province
|
73
|
+
'780', # Cà Mau Province
|
74
|
+
'781', # Bạc Liêu Province
|
75
|
+
'79' # Sóc Trăng Province
|
76
|
+
]
|
77
|
+
|
78
|
+
ndcs_with_8_subscriber_digits = [
|
79
|
+
'4', # Hanoi
|
80
|
+
'8' # Ho Chi Minh City
|
81
|
+
]
|
82
|
+
|
83
|
+
mobile = [
|
84
|
+
'90', # MobiFone
|
85
|
+
'91', # Vinaphone
|
86
|
+
'92', # Vietnamobile (previously known as HT Mobile)
|
87
|
+
'93', # MobiFone
|
88
|
+
'94', # Vinaphone
|
89
|
+
'95', # S-Fone
|
90
|
+
'96', # previously EVN Telecom, now Viettel Mobile
|
91
|
+
'97', # Viettel Mobile
|
92
|
+
'98', # Viettel Mobile
|
93
|
+
'996', # Gmobile (traded as Beeline)
|
94
|
+
'997', # Gmobile (traded as Beeline)
|
95
|
+
'998', # Indochina Telecom
|
96
|
+
'999', # Indochina Telecom
|
97
|
+
'120', # MobiFone
|
98
|
+
'121', # MobiFone
|
99
|
+
'122', # MobiFone
|
100
|
+
'123', # Vinaphone
|
101
|
+
'124', # Vinaphone
|
102
|
+
'125', # Vinaphone
|
103
|
+
'126', # MobiFone
|
104
|
+
'127', # Vinaphone
|
105
|
+
'128', # MobiFone
|
106
|
+
'129', # Vinaphone
|
107
|
+
'163', # Viettel Mobile
|
108
|
+
'164', # Viettel Mobile
|
109
|
+
'165', # Viettel Mobile
|
110
|
+
'166', # Viettel Mobile
|
111
|
+
'167', # Viettel Mobile
|
112
|
+
'168', # Viettel Mobile
|
113
|
+
'169', # Viettel Mobile
|
114
|
+
'186', # Vietnamobile
|
115
|
+
'188', # Vietnamobile (previously known as HT Mobile)
|
116
|
+
'199' # GTel (traded as Beeline)
|
117
|
+
]
|
118
|
+
|
119
|
+
mobile_with_trunk = mobile.map{|num| "0#{num}" }
|
120
|
+
|
121
|
+
Phony.define do
|
122
|
+
country '84', one_of(ndcs_with_7_subscriber_digits) >> split(3,4) |
|
123
|
+
one_of(ndcs_with_8_subscriber_digits) >> split(4,4) |
|
124
|
+
one_of(mobile) >> split(5..8)|
|
125
|
+
one_of(mobile_with_trunk) >> split(5..8)|
|
126
|
+
# Govt reserved
|
127
|
+
fixed(80) >> split(5) |
|
128
|
+
fixed(69) >> split(1,5)
|
129
|
+
end
|
data/lib/phony/dsl.rb
CHANGED
@@ -54,6 +54,18 @@ module Phony
|
|
54
54
|
Phony::CountryCodes.instance.add country_code, definition
|
55
55
|
end
|
56
56
|
|
57
|
+
# Designates a country code as reserved.
|
58
|
+
#
|
59
|
+
def reserved country_code
|
60
|
+
# Does nothing, will just fail with an exception.
|
61
|
+
end
|
62
|
+
|
63
|
+
# This country still uses a default NDC (and needs to be done, hence the todo).
|
64
|
+
#
|
65
|
+
def todo
|
66
|
+
none >> split(10)
|
67
|
+
end
|
68
|
+
|
57
69
|
#
|
58
70
|
#
|
59
71
|
def trunk code, options = {}
|
@@ -131,12 +143,6 @@ module Phony
|
|
131
143
|
|
132
144
|
NationalSplitters::Regex.instance_for regex, options[:on_fail_take], options
|
133
145
|
end
|
134
|
-
|
135
|
-
# This country still uses a default NDC (and needs to be done, hence the todo).
|
136
|
-
#
|
137
|
-
def todo
|
138
|
-
none >> split(10)
|
139
|
-
end
|
140
146
|
|
141
147
|
# Local splitters.
|
142
148
|
#
|
@@ -76,10 +76,15 @@ describe 'plausibility' do
|
|
76
76
|
it 'is correct' do
|
77
77
|
Phony.plausible?('0000000').should be_false
|
78
78
|
end
|
79
|
+
it 'is correct for zeros in number' do
|
80
|
+
Phony.plausible?('+00 00 000 00 01').should be_false
|
81
|
+
end
|
82
|
+
it 'is correct for zeros in number' do
|
83
|
+
Phony.plausible?('00 00 000 00 01').should be_false
|
84
|
+
end
|
79
85
|
it 'is correct' do
|
80
86
|
Phony.plausible?('hello').should be_false
|
81
87
|
end
|
82
|
-
|
83
88
|
it "is correct" do
|
84
89
|
Phony.plausible?('+41 44 111 22 33').should be_true
|
85
90
|
end
|
@@ -417,6 +422,15 @@ describe 'plausibility' do
|
|
417
422
|
Phony.plausible?('+41 44 111 22').should be_false
|
418
423
|
end
|
419
424
|
|
425
|
+
it "is correct for Vietnamese numbers" do
|
426
|
+
Phony.plausible?('+84 8 3827 9666').should be_true
|
427
|
+
Phony.plausible?('+84 4 3926 1720').should be_true
|
428
|
+
Phony.plausible?('+84 091 123-4567').should be_true
|
429
|
+
Phony.plausible?('+84 0167 123456').should be_true
|
430
|
+
Phony.plausible?('+84 1 1234').should be_false # too short
|
431
|
+
Phony.plausible?('+84 12 3456 7891 0111213').should be_false # too long
|
432
|
+
end
|
433
|
+
|
420
434
|
it "is correct for US numbers" do
|
421
435
|
# Still need E164 conform numbers.
|
422
436
|
#
|
@@ -773,7 +787,22 @@ describe 'plausibility' do
|
|
773
787
|
'+380 32 2123 456',
|
774
788
|
'+380 3259 123 45',
|
775
789
|
'+380 32606 1234',
|
776
|
-
'+380
|
790
|
+
'+380 50 123 45 67',
|
791
|
+
'+380 66 123 45 67',
|
792
|
+
'+380 95 123 45 67',
|
793
|
+
'+380 99 123 45 67',
|
794
|
+
'+380 67 123 45 67',
|
795
|
+
'+380 96 123 45 67',
|
796
|
+
'+380 97 123 45 67',
|
797
|
+
'+380 98 123 45 67',
|
798
|
+
'+380 63 123 45 67',
|
799
|
+
'+380 93 123 45 67',
|
800
|
+
'+380 39 123 45 67',
|
801
|
+
'+380 68 123 45 67',
|
802
|
+
'+380 91 123 45 67',
|
803
|
+
'+380 92 123 45 67',
|
804
|
+
'+380 94 123 45 67'
|
805
|
+
]
|
777
806
|
it_is_correct_for 'United Arab Emirates', :samples => ['+971 800 12',
|
778
807
|
'+971 800 12 345 6789',
|
779
808
|
'+971 2 123 4567',
|
@@ -348,6 +348,7 @@ describe 'country descriptions' do
|
|
348
348
|
describe 'Italy' do
|
349
349
|
it_splits '3934869528', ['39', '348', '695', '28'] # Mobile
|
350
350
|
it_splits '393357210488', ['39', '335', '721', '0488'] # Mobile
|
351
|
+
it_splits '393248644272', ['39', '324', '864', '4272'] # Mobile
|
351
352
|
it_splits '390612341234', ['39', '06', '1234', '1234'] # Roma
|
352
353
|
it_splits '390288838883', ['39', '02', '8883', '8883'] # Milano
|
353
354
|
it_splits '390141595661', ['39', '0141', '595', '661'] # Asti
|
@@ -562,7 +563,7 @@ describe 'country descriptions' do
|
|
562
563
|
it { Phony.split('421212345678').should == ['421', '2', '12345678'] } # Bratislava
|
563
564
|
it { Phony.split('421371234567').should == ['421', '37', '1234567'] } # Nitra / Other
|
564
565
|
end
|
565
|
-
|
566
|
+
|
566
567
|
describe 'Spain' do
|
567
568
|
it_splits '34600123456', ['34', '600', '123', '456'] # Mobile
|
568
569
|
it_splits '34900123456', ['34', '900', '123', '456'] # Special
|
@@ -570,7 +571,7 @@ describe 'country descriptions' do
|
|
570
571
|
it_splits '34975123456', ['34', '975', '12', '34', '56'] # Landline
|
571
572
|
it_splits '34123456789', ['34', '123', '456', '789'] # Default
|
572
573
|
end
|
573
|
-
|
574
|
+
|
574
575
|
describe 'Sri Lanka' do
|
575
576
|
it { Phony.split('94711231212').should == ['94', '71', '123', '12', '12'] } # Mobile
|
576
577
|
end
|
@@ -662,7 +663,7 @@ describe 'country descriptions' do
|
|
662
663
|
describe 'Vietnam' do
|
663
664
|
it { Phony.split('8498123456').should == ['84', '98', '123456'] } # Viettel Mobile
|
664
665
|
it { Phony.split('8499612345').should == ['84', '996', '12345'] } # GTel
|
665
|
-
it { Phony.split('
|
666
|
+
it { Phony.split('84412345678').should == ['84', '4', '1234', '5678'] } # Hanoi
|
666
667
|
end
|
667
668
|
describe 'Zambia' do
|
668
669
|
it_splits '260977640895', ['260', '97', '7640895'] # mobile
|
@@ -1060,7 +1061,21 @@ describe 'country descriptions' do
|
|
1060
1061
|
it_splits '380320123456', %w(380 32 0123 456)
|
1061
1062
|
it_splits '380325912345', %w(380 3259 123 45)
|
1062
1063
|
it_splits '380326061234', %w(380 32606 1234)
|
1063
|
-
it_splits '
|
1064
|
+
it_splits '380391234567', %w(380 39 123 45 67)
|
1065
|
+
it_splits '380501234567', %w(380 50 123 45 67)
|
1066
|
+
it_splits '380631234567', %w(380 63 123 45 67)
|
1067
|
+
it_splits '380661234567', %w(380 66 123 45 67)
|
1068
|
+
it_splits '380671234567', %w(380 67 123 45 67)
|
1069
|
+
it_splits '380681234567', %w(380 68 123 45 67)
|
1070
|
+
it_splits '380911234567', %w(380 91 123 45 67)
|
1071
|
+
it_splits '380921234567', %w(380 92 123 45 67)
|
1072
|
+
it_splits '380931234567', %w(380 93 123 45 67)
|
1073
|
+
it_splits '380941234567', %w(380 94 123 45 67)
|
1074
|
+
it_splits '380951234567', %w(380 95 123 45 67)
|
1075
|
+
it_splits '380961234567', %w(380 96 123 45 67)
|
1076
|
+
it_splits '380971234567', %w(380 97 123 45 67)
|
1077
|
+
it_splits '380981234567', %w(380 98 123 45 67)
|
1078
|
+
it_splits '380991234567', %w(380 99 123 45 67)
|
1064
1079
|
end
|
1065
1080
|
describe 'United Arab Emirates' do
|
1066
1081
|
it_splits '97180012', %w(971 800 12)
|
data/spec/lib/phony_spec.rb
CHANGED
@@ -32,6 +32,11 @@ describe Phony do
|
|
32
32
|
Phony.normalize nil
|
33
33
|
}.to raise_error(ArgumentError, 'Phone number cannot be nil. Use e.g. number && Phony.normalize(number).')
|
34
34
|
end
|
35
|
+
it 'raises if number starts with reserved zero code' do
|
36
|
+
expect do
|
37
|
+
Phony.normalize '+00 00 00 00 01'
|
38
|
+
end.to raise_error(Phony::NormalizationError, 'Phony could not normalize the given number. Is it a phone number?')
|
39
|
+
end
|
35
40
|
it 'raises a nice error message' do
|
36
41
|
expect do
|
37
42
|
Phony.normalize 'test'
|
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: phony
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Florian Hanke
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-09-
|
11
|
+
date: 2014-09-13 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description: 'Fast international phone number (E164 standard) normalizing, splitting
|
13
|
+
description: ! 'Fast international phone number (E164 standard) normalizing, splitting
|
14
14
|
and formatting. Lots of formatting options: International (+.., 00..), national
|
15
15
|
(0..), and local.'
|
16
16
|
email: florian.hanke+phony@gmail.com
|
@@ -19,9 +19,6 @@ extensions: []
|
|
19
19
|
extra_rdoc_files:
|
20
20
|
- README.textile
|
21
21
|
files:
|
22
|
-
- README.textile
|
23
|
-
- lib/phony.rb
|
24
|
-
- lib/phony/countries.rb
|
25
22
|
- lib/phony/countries/austria.rb
|
26
23
|
- lib/phony/countries/bangladesh.rb
|
27
24
|
- lib/phony/countries/belarus.rb
|
@@ -58,7 +55,9 @@ files:
|
|
58
55
|
- lib/phony/countries/ukraine.rb
|
59
56
|
- lib/phony/countries/united_kingdom.rb
|
60
57
|
- lib/phony/countries/uruguay.rb
|
58
|
+
- lib/phony/countries/vietnam.rb
|
61
59
|
- lib/phony/countries/zimbabwe.rb
|
60
|
+
- lib/phony/countries.rb
|
62
61
|
- lib/phony/country.rb
|
63
62
|
- lib/phony/country_codes.rb
|
64
63
|
- lib/phony/dsl.rb
|
@@ -73,6 +72,8 @@ files:
|
|
73
72
|
- lib/phony/national_splitters/variable.rb
|
74
73
|
- lib/phony/trunk_code.rb
|
75
74
|
- lib/phony/vanity.rb
|
75
|
+
- lib/phony.rb
|
76
|
+
- README.textile
|
76
77
|
- spec/functional/error_spec.rb
|
77
78
|
- spec/functional/normalize_spec.rb
|
78
79
|
- spec/functional/plausibility_spec.rb
|
@@ -99,17 +100,17 @@ require_paths:
|
|
99
100
|
- lib
|
100
101
|
required_ruby_version: !ruby/object:Gem::Requirement
|
101
102
|
requirements:
|
102
|
-
- -
|
103
|
+
- - ! '>='
|
103
104
|
- !ruby/object:Gem::Version
|
104
105
|
version: '0'
|
105
106
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
106
107
|
requirements:
|
107
|
-
- -
|
108
|
+
- - ! '>='
|
108
109
|
- !ruby/object:Gem::Version
|
109
110
|
version: '0'
|
110
111
|
requirements: []
|
111
112
|
rubyforge_project:
|
112
|
-
rubygems_version: 2.
|
113
|
+
rubygems_version: 2.0.3
|
113
114
|
signing_key:
|
114
115
|
specification_version: 4
|
115
116
|
summary: Fast international phone number (E164 standard) normalizing, splitting and
|