phony 1.2.1 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/phony/countries/all_other.rb +1 -1
- data/lib/phony/countries/austria.rb +66 -66
- data/lib/phony/countries/chile.rb +11 -11
- data/lib/phony/countries/china.rb +26 -0
- data/lib/phony/countries/egypt.rb +35 -35
- data/lib/phony/countries/greece.rb +24 -24
- data/lib/phony/countries/hungary.rb +18 -18
- data/lib/phony/countries/italy.rb +100 -100
- data/lib/phony/countries/netherlands.rb +51 -51
- data/lib/phony/countries/peru.rb +14 -14
- data/lib/phony/countries/romania.rb +25 -25
- data/lib/phony/countries/sweden.rb +48 -48
- data/lib/phony.rb +1 -0
- data/spec/lib/phony_spec.rb +4 -0
- metadata +3 -2
@@ -116,7 +116,7 @@ module Phony
|
|
116
116
|
'81' => fixed(2), # TODO Japan
|
117
117
|
'82' => fixed(2), # TODO Korea (Republic of)
|
118
118
|
'84' => fixed(2), # TODO Viet Nam (Socialist Republic of)
|
119
|
-
'86' =>
|
119
|
+
'86' => Countries::China, # China (People's Republic of), http://en.wikipedia.org/wiki/Telephone_numbers_in_China
|
120
120
|
|
121
121
|
'90' => fixed(3, # Turkey, http://en.wikipedia.org/wiki/Telephone_numbers_in_Turkey
|
122
122
|
:local_format => [3, 4] # Wiki says 7, but the examples say 3, 4.
|
@@ -1,69 +1,69 @@
|
|
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
|
Phony::Countries::Austria = Phony::Country.configured :local_format => [10],
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
4
|
+
:local_special_format => [10],
|
5
|
+
:ndc_fallback_length => 4,
|
6
|
+
:ndc_mapping => {
|
7
|
+
:landline => [
|
8
|
+
'1', # Vienna
|
9
|
+
'57', # -
|
10
|
+
'59', # -
|
11
|
+
'89', # Routing Number
|
12
|
+
'316', # Graz
|
13
|
+
'501', # -
|
14
|
+
'502', # -
|
15
|
+
'503', # -
|
16
|
+
'504', # -
|
17
|
+
'505', # -
|
18
|
+
'506', # -
|
19
|
+
'507', # -
|
20
|
+
'508', # -
|
21
|
+
'509', # -
|
22
|
+
'512', # Innsbruck
|
23
|
+
'517', # -
|
24
|
+
'662', # Salzburg
|
25
|
+
'720', #
|
26
|
+
'732' # Linz
|
27
|
+
],
|
28
|
+
:mobile => [
|
29
|
+
'67',
|
30
|
+
'68',
|
31
|
+
'644',
|
32
|
+
'650',
|
33
|
+
'651',
|
34
|
+
'652',
|
35
|
+
'653',
|
36
|
+
'655',
|
37
|
+
'657',
|
38
|
+
'659',
|
39
|
+
'660',
|
40
|
+
'661',
|
41
|
+
'663',
|
42
|
+
'664',
|
43
|
+
'665',
|
44
|
+
'666',
|
45
|
+
'667',
|
46
|
+
'668',
|
47
|
+
'669'
|
48
|
+
],
|
49
|
+
:service => [
|
50
|
+
'710',
|
51
|
+
'711',
|
52
|
+
'718',
|
53
|
+
'730',
|
54
|
+
'740',
|
55
|
+
'780',
|
56
|
+
'800',
|
57
|
+
'802',
|
58
|
+
'804',
|
59
|
+
'810',
|
60
|
+
'820',
|
61
|
+
'821',
|
62
|
+
'828',
|
63
|
+
'900',
|
64
|
+
'901',
|
65
|
+
'930',
|
66
|
+
'931',
|
67
|
+
'939'
|
68
|
+
]
|
69
|
+
}
|
@@ -7,14 +7,14 @@
|
|
7
7
|
# As usual, best effort.
|
8
8
|
#
|
9
9
|
Phony::Countries::Chile = Phony::Country.configured :local_format => [8],
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
10
|
+
:local_special_format => [3, 3],
|
11
|
+
:ndc_fallback_length => 2,
|
12
|
+
:ndc_mapping => {
|
13
|
+
:landline => [
|
14
|
+
'2', # Santiago
|
15
|
+
],
|
16
|
+
:mobile => [
|
17
|
+
'9',
|
18
|
+
],
|
19
|
+
:service => %w{130 131 132 133 134 135 136 137 139 147 149}
|
20
|
+
}
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# Chinese phone numbers.
|
2
|
+
#
|
3
|
+
# http://en.wikipedia.org/wiki/Telephone_numbers_in_China
|
4
|
+
#
|
5
|
+
# Note: Tibet partially uses 4-digit NDC codes. This is NOT YET reflected here.
|
6
|
+
#
|
7
|
+
Phony::Countries::China = Phony::Country.configured :local_format => [4, 4],
|
8
|
+
:local_special_format => [8],
|
9
|
+
:ndc_fallback_length => 3,
|
10
|
+
:ndc_mapping => {
|
11
|
+
:landline => [
|
12
|
+
'10', # Beijing, TODO Confirm – is it 10 or 1?
|
13
|
+
'20', # Guangzhou
|
14
|
+
'21', # Shanghai
|
15
|
+
'22', # Tianjin
|
16
|
+
'23', # Chongquin
|
17
|
+
'24', # Shenyang
|
18
|
+
'25', # Nanjing
|
19
|
+
'26', # Taipei, Taiwan - gotta be kidding, right?!
|
20
|
+
'27', # Wuhan
|
21
|
+
'28', # Chengdu
|
22
|
+
'29', # Xi'an
|
23
|
+
],
|
24
|
+
:mobile => %w{ 130 131 132 133 135 136 137 138 139 145 150 151 152 153 155 156 157 158 159 185 186 187 188 189 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 },
|
25
|
+
:service => %w{ 110 114 119 120 122 999 } # Probably not exhaustive. TODO Look at http://www.eoc.com.cn/?action-viewnews-itemid-11493.
|
26
|
+
}
|
@@ -3,38 +3,38 @@
|
|
3
3
|
# http://en.wikipedia.org/wiki/Telephone_numbers_in_Egypt
|
4
4
|
#
|
5
5
|
Phony::Countries::Egypt = Phony::Country.configured :local_format => [8],
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
6
|
+
:local_special_format => [7],
|
7
|
+
:ndc_fallback_length => 2,
|
8
|
+
:ndc_mapping => {
|
9
|
+
:landline => [
|
10
|
+
'2', # Cairo/Giza
|
11
|
+
'3', # Alexandria
|
12
|
+
'13', # Banha
|
13
|
+
'15', # 10th of Ramadan
|
14
|
+
'45', # Damanhur
|
15
|
+
'46', # Marsa Matruh
|
16
|
+
'47', # Kafer El Sheik
|
17
|
+
'48', # Monufia
|
18
|
+
'50', # Mansoura
|
19
|
+
'55', # Zazazig
|
20
|
+
'56', # Spare
|
21
|
+
'57', # Damiette
|
22
|
+
'62', # Suez
|
23
|
+
'64', # Ismailia
|
24
|
+
'65', # Red Sea
|
25
|
+
'66', # Port Said
|
26
|
+
'68', # El Arish
|
27
|
+
'69', # El-Tor
|
28
|
+
'82', # Beni Suef
|
29
|
+
'84', # Fayoum
|
30
|
+
'86', # Minia
|
31
|
+
'88', # Assiout
|
32
|
+
'92', # Wadi El Gehid
|
33
|
+
'93', # Sohag
|
34
|
+
'95', # Luxor
|
35
|
+
'96', # Qunea
|
36
|
+
'97', # Aswan
|
37
|
+
],
|
38
|
+
:mobile => %w{10 11 12 14 16 17 18 19},
|
39
|
+
:service => %w{800} # Not exhaustive.
|
40
|
+
}
|
@@ -4,27 +4,27 @@
|
|
4
4
|
# To save space, we only use ndcs of length up to 3 (and use the fallback).
|
5
5
|
#
|
6
6
|
Phony::Countries::Greece = Phony::Country.configured :local_format => [6],
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
7
|
+
:ndc_fallback_length => 4,
|
8
|
+
:ndc_mapping => {
|
9
|
+
:landline => [
|
10
|
+
'21', # Athens
|
11
|
+
'231', # Thessaloniki
|
12
|
+
'241', # Larissa
|
13
|
+
'251', # Kavala
|
14
|
+
'261', # Patras
|
15
|
+
'271', # Tripoli
|
16
|
+
'281', # Heraklion
|
17
|
+
],
|
18
|
+
:mobile => [
|
19
|
+
'690',
|
20
|
+
'693',
|
21
|
+
'694',
|
22
|
+
'695',
|
23
|
+
'697',
|
24
|
+
'698',
|
25
|
+
'699'
|
26
|
+
],
|
27
|
+
:service => [ # TODO
|
28
|
+
'800'
|
29
|
+
]
|
30
|
+
}
|
@@ -3,21 +3,21 @@
|
|
3
3
|
# http://en.wikipedia.org/wiki/Telephone_numbers_in_Hungary
|
4
4
|
#
|
5
5
|
Phony::Countries::Hungary = Phony::Country.configured :local_format => [3, 4], # Also captures 3, 3 on a fallback.
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
6
|
+
:local_special_format => [3, 3],
|
7
|
+
:ndc_fallback_length => 2,
|
8
|
+
:ndc_mapping => {
|
9
|
+
# 1 is Budapest.
|
10
|
+
# All others are captured using
|
11
|
+
# the fallback length 2.
|
12
|
+
#
|
13
|
+
:landline => [
|
14
|
+
'1'
|
15
|
+
],
|
16
|
+
:mobile => [], # TODO
|
17
|
+
:service => [
|
18
|
+
'104',
|
19
|
+
'105',
|
20
|
+
'107',
|
21
|
+
'112'
|
22
|
+
]
|
23
|
+
}
|
@@ -3,103 +3,103 @@
|
|
3
3
|
# http://en.wikipedia.org/wiki/Telephone_numbers_in_Italy
|
4
4
|
#
|
5
5
|
Phony::Countries::Italy = Phony::Country.configured :local_format => [3, 4],
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
6
|
+
:local_special_format => [3, 3],
|
7
|
+
:ndc_fallback_length => 3,
|
8
|
+
:ndc_mapping => {
|
9
|
+
:landline => [
|
10
|
+
'10', # Genoa
|
11
|
+
'11', # Turin
|
12
|
+
'122', # Sestrieres, Bardonecchia and other Susa Valley mountain resorts
|
13
|
+
'125', # Ivrea
|
14
|
+
'131', # Alessandria
|
15
|
+
'141', # Asti
|
16
|
+
'15', # Biella
|
17
|
+
'161', # Vercelli
|
18
|
+
'165', # Aosta, Courmayeur
|
19
|
+
'166', # Cervinia
|
20
|
+
'171', # Cuneo
|
21
|
+
'185', # Tigullio
|
22
|
+
'187', # La Spezia and Cinque Terre
|
23
|
+
'19', # Savona
|
24
|
+
'2', # Milan
|
25
|
+
'30', # Brescia
|
26
|
+
'31', # Como
|
27
|
+
'321', # Novara
|
28
|
+
'331', # Varese
|
29
|
+
'341', # Lecco
|
30
|
+
'342', # Sondrio
|
31
|
+
'35', # Bergamo
|
32
|
+
'369', # Mediaset Cologno Monzese and Segrate TV studios, geographical rate (used for polls, television programs, etc.)
|
33
|
+
'376', # Mantua
|
34
|
+
'382', # Pavia
|
35
|
+
'39', # Monza
|
36
|
+
'40', # Trieste
|
37
|
+
'41', # Venice
|
38
|
+
'425', # Rovigo
|
39
|
+
'432', # Udine
|
40
|
+
'444', # Vicenza
|
41
|
+
'45', # Verona
|
42
|
+
'461', # Trento
|
43
|
+
'471', # Bolzano
|
44
|
+
'481', # Gorizia
|
45
|
+
'49', # Padua
|
46
|
+
'50', # Pisa
|
47
|
+
'51', # Bologna
|
48
|
+
'521', # Parma
|
49
|
+
'522', # Reggio nell'Emilia
|
50
|
+
'523', # Piacenza
|
51
|
+
'532', # Ferrara
|
52
|
+
'536', # Sassuolo
|
53
|
+
'541', # Rimini
|
54
|
+
'549', # San Marino (Most Serene Republic of San Marino)
|
55
|
+
'55', # Florence
|
56
|
+
'573', # Pistoia
|
57
|
+
'577', # Siena
|
58
|
+
'586', # Livorno
|
59
|
+
'59', # Modena
|
60
|
+
'6', # Rome (including State of Vatican City) and Aprilia
|
61
|
+
'70', # Cagliari
|
62
|
+
'71', # Ancona
|
63
|
+
'75', # Perugia
|
64
|
+
'769', # RAI Saxa Rubra Studios, geographical rate (used for polls, television programs, etc.)
|
65
|
+
'771', # Fondi
|
66
|
+
'773', # Latina
|
67
|
+
'775', # Frosinone
|
68
|
+
'789', # Olbia and Costa Smeralda
|
69
|
+
'79', # Sassari
|
70
|
+
'80', # Bari
|
71
|
+
'81', # Naples
|
72
|
+
'823', # Caserta
|
73
|
+
'824', # Benevento
|
74
|
+
'825', # Avellino
|
75
|
+
'85', # Pescara
|
76
|
+
'865', # Isernia
|
77
|
+
'871', # Chieti
|
78
|
+
'872', # Lanciano
|
79
|
+
'873', # Vasto
|
80
|
+
'874', # Campobasso
|
81
|
+
'875', # Termoli
|
82
|
+
'881', # Foggia
|
83
|
+
'89', # Salerno
|
84
|
+
'90', # Messina
|
85
|
+
'91', # Palermo
|
86
|
+
'92', # Agrigento
|
87
|
+
'95', # Catania
|
88
|
+
'961', # Catanzaro
|
89
|
+
'965', # Reggio di Calabria
|
90
|
+
'971', # Potenza
|
91
|
+
'99', # Taranto
|
92
|
+
],
|
93
|
+
:mobile => [], # TODO
|
94
|
+
:service => [ # Not exhaustive.
|
95
|
+
'112',
|
96
|
+
'113',
|
97
|
+
'115',
|
98
|
+
'117',
|
99
|
+
'118',
|
100
|
+
'878',
|
101
|
+
'1515',
|
102
|
+
'1518',
|
103
|
+
'1530'
|
104
|
+
]
|
105
|
+
}
|
@@ -4,54 +4,54 @@
|
|
4
4
|
# To save space, we only use ndcs of length 2 (and use the fallback of 3 to handle the rest).
|
5
5
|
#
|
6
6
|
Phony::Countries::Netherlands = Phony::Country.configured :local_format => [8], # 8 is for mobile numbers, other numbers will work as well (they use 7).
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
7
|
+
:ndc_fallback_length => 3,
|
8
|
+
:ndc_mapping => {
|
9
|
+
:landline => [
|
10
|
+
'10', # Rotterdam
|
11
|
+
'13', # Tilburg
|
12
|
+
'14', # KPN
|
13
|
+
'15', # Delft
|
14
|
+
'20', # Amsterdam
|
15
|
+
'23', # Haarlem
|
16
|
+
'24', # Nijmegen
|
17
|
+
'26', # Arnhem
|
18
|
+
'30', # Utrecht
|
19
|
+
'33', # Amersfoort
|
20
|
+
'35', # Hilversum
|
21
|
+
'36', # Almere
|
22
|
+
'38', # Zwolle
|
23
|
+
'40', # Eindhoven
|
24
|
+
'43', # Maastricht
|
25
|
+
'45', # Heerlen
|
26
|
+
'46', # Sittard
|
27
|
+
'50', # Groningen
|
28
|
+
'53', # Enschede
|
29
|
+
'55', # Apeldoorn
|
30
|
+
'58', # Leeuwarden
|
31
|
+
'70', # Den Haag
|
32
|
+
'71', # Leiden
|
33
|
+
'72', # Alkmaar
|
34
|
+
'73', # 's-Hertogenbosch
|
35
|
+
'74', # Hengelo
|
36
|
+
'75', # Zaanstad
|
37
|
+
'76', # Breda
|
38
|
+
'77', # Venlo
|
39
|
+
'78', # Dordrecht
|
40
|
+
'79', # Zoetermeer
|
41
|
+
],
|
42
|
+
:mobile => [
|
43
|
+
'6' # Mobiele nummers en Semafoondiensten
|
44
|
+
],
|
45
|
+
:service => [
|
46
|
+
'84', # Persoonlijke-assistentdiensten, zoals voicemail en faxmail
|
47
|
+
'85', # Plaatsonafhankelijk netnummer
|
48
|
+
'87', # Both of the above.
|
49
|
+
'88', # Bedrijfsnummers
|
50
|
+
'91', # Plaatsonafhankelijk netnummer
|
51
|
+
'676', # Inbelnummers van Internetproviders
|
52
|
+
'800', # Gratis informatienummers
|
53
|
+
'900', # Betaalde informatienummers
|
54
|
+
'906', # Betaalde informatienummers
|
55
|
+
'909', # Betaalde informatienummers
|
56
|
+
]
|
57
|
+
}
|
data/lib/phony/countries/peru.rb
CHANGED
@@ -3,17 +3,17 @@
|
|
3
3
|
# http://en.wikipedia.org/wiki/Telephone_numbers_in_Peru
|
4
4
|
#
|
5
5
|
Phony::Countries::Peru = Phony::Country.configured :local_format => [4, 4],
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
6
|
+
:local_special_format => [3, 3],
|
7
|
+
:ndc_fallback_length => 2,
|
8
|
+
:ndc_mapping => {
|
9
|
+
:landline => [
|
10
|
+
'1', # Lima
|
11
|
+
],
|
12
|
+
:mobile => [
|
13
|
+
'9',
|
14
|
+
],
|
15
|
+
:service => [
|
16
|
+
'103',
|
17
|
+
'105',
|
18
|
+
]
|
19
|
+
}
|
@@ -3,28 +3,28 @@
|
|
3
3
|
# http://en.wikipedia.org/wiki/Romania_telephone_area_codes
|
4
4
|
#
|
5
5
|
Phony::Countries::Romania = Phony::Country.configured :local_format => [3, 4], # Also captures 3, 3 on a fallback.
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
6
|
+
:local_special_format => [3, 3],
|
7
|
+
:ndc_fallback_length => 3,
|
8
|
+
:ndc_mapping => {
|
9
|
+
:landline => [
|
10
|
+
'21', # Bucureşti
|
11
|
+
'31', # Bucureşti
|
12
|
+
],
|
13
|
+
:mobile => [
|
14
|
+
'71',
|
15
|
+
'72',
|
16
|
+
'73',
|
17
|
+
'74',
|
18
|
+
'75',
|
19
|
+
'76',
|
20
|
+
'77',
|
21
|
+
'78',
|
22
|
+
],
|
23
|
+
:service => [
|
24
|
+
'112',
|
25
|
+
'800',
|
26
|
+
'900',
|
27
|
+
'903',
|
28
|
+
'906',
|
29
|
+
]
|
30
|
+
}
|
@@ -7,51 +7,51 @@
|
|
7
7
|
# http://www.pts.se/upload/Ovrigt/Tele/Nummerfragor/bilaga-2b.pdf
|
8
8
|
#
|
9
9
|
Phony::Countries::Sweden = Phony::Country.configured :local_format => [8],
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
10
|
+
:ndc_fallback_length => 3,
|
11
|
+
:ndc_mapping => {
|
12
|
+
:landline => [
|
13
|
+
'7', # Non-geographical
|
14
|
+
'8', # Stockholm
|
15
|
+
'10', # VOIP
|
16
|
+
'11', # Norrköping
|
17
|
+
'13', # Linköping
|
18
|
+
'16', # Eskilstuna-Torshälla
|
19
|
+
'18', # Uppsala
|
20
|
+
'19', # Örebro-Kumla
|
21
|
+
'20', # toll-free
|
22
|
+
'21', # Västerås
|
23
|
+
'23', # Falun
|
24
|
+
'26', # Gävle-Sandviken
|
25
|
+
'31', # Göteborg
|
26
|
+
'33', # Borås
|
27
|
+
'35', # Halmstad
|
28
|
+
'36', # Jönköping-Huskvarna
|
29
|
+
'40', # Malmö
|
30
|
+
'42', # Helsingborg-Höganäs
|
31
|
+
'44', # Kristianstad
|
32
|
+
'46', # Lund
|
33
|
+
'54', # Karlstad
|
34
|
+
'60', # Sundsvall-Timrå
|
35
|
+
'63', # Östersund
|
36
|
+
'90', # Umeå
|
37
|
+
],
|
38
|
+
:mobile => [
|
39
|
+
'70', # Mobile
|
40
|
+
'71', # Telematics
|
41
|
+
'72', # Mobile
|
42
|
+
'73', # Mobile
|
43
|
+
'74', # Pagers
|
44
|
+
'76', # Mobile
|
45
|
+
],
|
46
|
+
:service => [
|
47
|
+
'99', # Premium Rate
|
48
|
+
'112', # Emergency Service
|
49
|
+
'116', # Psychological Help
|
50
|
+
'118', # Number enquiries
|
51
|
+
'900', # Premium Rate
|
52
|
+
'939', # Premium Rate
|
53
|
+
'944', # Premium Rate
|
54
|
+
'1177', # Health Care Advice
|
55
|
+
'11414', # Police
|
56
|
+
]
|
57
|
+
}
|
data/lib/phony.rb
CHANGED
@@ -14,6 +14,7 @@ require File.expand_path '../phony/country', __FILE__
|
|
14
14
|
require File.expand_path '../phony/countries/all_other', __FILE__
|
15
15
|
require File.expand_path '../phony/countries/austria', __FILE__
|
16
16
|
require File.expand_path '../phony/countries/chile', __FILE__
|
17
|
+
require File.expand_path '../phony/countries/china', __FILE__
|
17
18
|
require File.expand_path '../phony/countries/egypt', __FILE__
|
18
19
|
require File.expand_path '../phony/countries/germany', __FILE__
|
19
20
|
require File.expand_path '../phony/countries/greece', __FILE__
|
data/spec/lib/phony_spec.rb
CHANGED
@@ -19,6 +19,10 @@ describe Phony do
|
|
19
19
|
Phony.split('5675123456').should == ['56', '75', '123456'] # Curico
|
20
20
|
Phony.split('56912345678').should == ['56', '9', '12345678'] # mobile
|
21
21
|
end
|
22
|
+
it 'handles chinese numbers' do
|
23
|
+
Phony.split('862112345678').should == ['86', '21', '1234', '5678'] # Shanghai
|
24
|
+
Phony.split('8675582193447').should == ['86', '755', '8219', '3447'] # Shenzhen
|
25
|
+
end
|
22
26
|
it 'handles danish numbers' do
|
23
27
|
Phony.split('4532121212').should == ['45', '32', '12', '12', '12']
|
24
28
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 1
|
7
7
|
- 2
|
8
|
-
-
|
9
|
-
version: 1.2.
|
8
|
+
- 2
|
9
|
+
version: 1.2.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Florian Hanke
|
@@ -30,6 +30,7 @@ files:
|
|
30
30
|
- lib/phony/countries/all_other.rb
|
31
31
|
- lib/phony/countries/austria.rb
|
32
32
|
- lib/phony/countries/chile.rb
|
33
|
+
- lib/phony/countries/china.rb
|
33
34
|
- lib/phony/countries/egypt.rb
|
34
35
|
- lib/phony/countries/germany.rb
|
35
36
|
- lib/phony/countries/greece.rb
|