phony 1.2.11 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.textile +1 -1
- data/lib/countries.rb +385 -0
- data/lib/phony.rb +11 -9
- data/lib/phony/countries.rb +1 -0
- data/lib/phony/countries/austria.rb +68 -67
- data/lib/phony/countries/belgium.rb +29 -57
- data/lib/phony/countries/chile.rb +5 -12
- data/lib/phony/countries/china.rb +21 -20
- data/lib/phony/countries/egypt.rb +12 -37
- data/lib/phony/countries/germany.rb +39 -36
- data/lib/phony/countries/greece.rb +21 -25
- data/lib/phony/countries/hungary.rb +6 -19
- data/lib/phony/countries/italy.rb +174 -152
- data/lib/phony/countries/malaysia.rb +17 -17
- data/lib/phony/countries/netherlands.rb +50 -52
- data/lib/phony/countries/romania.rb +28 -27
- data/lib/phony/countries/south_korea.rb +11 -11
- data/lib/phony/countries/sweden.rb +49 -49
- data/lib/phony/countries/united_kingdom.rb +4 -4
- data/lib/phony/country.rb +14 -80
- data/lib/phony/country_codes.rb +23 -3
- data/lib/phony/dsl.rb +78 -0
- data/lib/phony/national_code.rb +2 -5
- data/lib/phony/national_splitters/dsl.rb +20 -0
- data/lib/phony/national_splitters/fixed.rb +1 -1
- data/lib/phony/national_splitters/none.rb +1 -1
- data/lib/phony/national_splitters/regex.rb +49 -0
- data/lib/phony/national_splitters/variable.rb +6 -6
- data/lib/phony/vanity.rb +3 -0
- data/spec/lib/phony/country_codes_spec.rb +1 -1
- data/spec/lib/phony/country_spec.rb +12 -45
- data/spec/lib/phony/local_splitters/fixed_spec.rb +8 -0
- data/spec/lib/phony/national_code_spec.rb +13 -0
- data/spec/lib/phony/national_splitters/regex_spec.rb +23 -0
- data/spec/lib/phony/national_splitters/variable_spec.rb +2 -4
- data/spec/lib/phony_spec.rb +44 -4
- metadata +9 -21
- data/lib/phony/countries/all_other.rb +0 -455
- data/lib/phony/countries/norway.rb +0 -11
- data/lib/phony/countries/peru.rb +0 -19
- data/lib/phony/countries/portugal.rb +0 -16
- data/lib/phony/national_splitters/experimental.rb +0 -17
- data/spec/lib/phony/countries/austria_spec.rb +0 -24
- data/spec/lib/phony/countries/belgium_spec.rb +0 -33
- data/spec/lib/phony/countries/egypt_spec.rb +0 -18
- data/spec/lib/phony/countries/greece_spec.rb +0 -18
- data/spec/lib/phony/countries/portugal_spec.rb +0 -21
- data/spec/lib/phony/countries/switzerland_spec.rb +0 -18
- data/spec/lib/phony/countries/united_kingdom_spec.rb +0 -50
data/spec/lib/phony_spec.rb
CHANGED
@@ -8,8 +8,15 @@ describe Phony do
|
|
8
8
|
it 'handles afghan numbers' do
|
9
9
|
Phony.split('93201234567').should == ['93', '20', '1234567'] # Kabul
|
10
10
|
end
|
11
|
+
it 'handles algerian numbers' do
|
12
|
+
Phony.split('213211231234').should == ['213', '21', '123', '1234'] # Algiers
|
13
|
+
Phony.split('213331231234').should == ['213', '33', '123', '1234'] # Batna
|
14
|
+
end
|
11
15
|
it "handles austrian numbers" do
|
12
|
-
Phony.split('43198110').should == ['43', '1', '98110']
|
16
|
+
Phony.split('43198110').should == ['43', '1', '98110'] # Vienna
|
17
|
+
Phony.split('4366914093902').should == ['43', '669', '14093902'] # Mobile
|
18
|
+
Phony.split('433161234567891').should == ['43', '316', '1234567891'] # Graz
|
19
|
+
Phony.split('432164123456789').should == ['43', '2164', '123456789'] # Rohrau
|
13
20
|
end
|
14
21
|
it 'handles belgian numbers' do
|
15
22
|
Phony.split('3235551212').should == ['32', '3', '555', '1212'] # Antwerpen
|
@@ -31,6 +38,11 @@ describe Phony do
|
|
31
38
|
Phony.split('862112345678').should == ['86', '21', '1234', '5678'] # Shanghai
|
32
39
|
Phony.split('8675582193447').should == ['86', '755', '8219', '3447'] # Shenzhen
|
33
40
|
end
|
41
|
+
it 'handles cuban numbers' do
|
42
|
+
Phony.split('5351231234').should == ['53', '5123', '1234'] # Mobile
|
43
|
+
Phony.split('5371234567').should == ['53', '7', '1234567'] # Havana
|
44
|
+
Phony.split('5342123456').should == ['53', '42', '123456'] # Villa Clara
|
45
|
+
end
|
34
46
|
it 'handles danish numbers' do
|
35
47
|
Phony.split('4532121212').should == ['45', '32', '12', '12', '12']
|
36
48
|
end
|
@@ -41,6 +53,7 @@ describe Phony do
|
|
41
53
|
end
|
42
54
|
it "handles egyptian numbers" do
|
43
55
|
Phony.split('20212345678').should == ['20', '2', '12345678']
|
56
|
+
Phony.split('20921234567').should == ['20', '92', '1234567']
|
44
57
|
Phony.split('20951234567').should == ['20', '95', '1234567']
|
45
58
|
end
|
46
59
|
it "handles french numbers" do
|
@@ -53,11 +66,19 @@ describe Phony do
|
|
53
66
|
Phony.split('493434112345').should == ['49', '34341', '123', '45'] # Geithain
|
54
67
|
end
|
55
68
|
it "should handle greek numbers" do
|
69
|
+
Phony.split('3021123456').should == ['30', '21', '123456']
|
70
|
+
Phony.split('3025941234').should == ['30', '2594', '1234']
|
56
71
|
Phony.split('3022631234').should == ['30', '2263', '1234']
|
57
72
|
end
|
58
73
|
it "should handle hungarian numbers" do
|
59
74
|
Phony.split('3612345678').should == ['36', '1', '234', '5678']
|
60
75
|
end
|
76
|
+
it "should handle icelandic numbers" do
|
77
|
+
Phony.split('354112').should == ['354', '112'] # Emergency TODO
|
78
|
+
Phony.split('3544211234').should == ['354', '421', '1234'] # Keflavík
|
79
|
+
Phony.split('3544621234').should == ['354', '462', '1234'] # Akureyri
|
80
|
+
Phony.split('3545511234').should == ['354', '551', '1234'] # Reykjavík
|
81
|
+
end
|
61
82
|
it "should handle italian numbers" do
|
62
83
|
Phony.split('3934869528').should == ['39', '3486', '952', '8'] # Mobile
|
63
84
|
Phony.split('39068546705').should == ['39', '06', '854', '6705'] # Roma
|
@@ -68,6 +89,10 @@ describe Phony do
|
|
68
89
|
Phony.split('60312345678').should == ['60', '3', '12345678'] # Kuala Lumpur
|
69
90
|
Phony.split('60212345678').should == ['60', '2', '12345678'] # Singapore
|
70
91
|
end
|
92
|
+
it 'handles mexican numbers' do
|
93
|
+
Phony.split('525512121212').should == ['52', '55', '12', '12', '12', '12'] # Mexico City
|
94
|
+
Phony.split('526641231212').should == ['52', '664', '123', '12', '12'] # Tijuana
|
95
|
+
end
|
71
96
|
it 'handles norwegian numbers' do
|
72
97
|
Phony.split('4721234567').should == ['47','21','23','45','67']
|
73
98
|
Phony.split('4731234567').should == ['47','31','23','45','67']
|
@@ -100,12 +125,16 @@ describe Phony do
|
|
100
125
|
Phony.split('78122345678').should == ['7', '812', '234', '56', '78']
|
101
126
|
end
|
102
127
|
it 'handles south korean numbers' do
|
103
|
-
Phony.split('82212345678').should == ['82', '2', '1234', '5678']
|
128
|
+
Phony.split('82212345678').should == ['82', '2', '1234', '5678'] # Seoul
|
104
129
|
Phony.split('825112345678').should == ['82', '51', '1234', '5678'] # Busan
|
105
130
|
Phony.split('821027975588').should == ['82', '10', '2797', '5588'] # mobile
|
106
131
|
end
|
132
|
+
it 'handles tunisian numbers' do
|
133
|
+
Phony.split('21611231234').should == ['216', '1', '123', '1234'] # Ariana
|
134
|
+
Phony.split('21621231234').should == ['216', '2', '123', '1234'] # Bizerte
|
135
|
+
end
|
107
136
|
it "should handle swedish numbers" do
|
108
|
-
Phony.split('46812345678').should == ['46', '8', '12345678']
|
137
|
+
Phony.split('46812345678').should == ['46', '8', '12345678'] # Stockholm
|
109
138
|
Phony.split('46111234567').should == ['46', '11', '1234567']
|
110
139
|
Phony.split('46125123456').should == ['46', '125', '123456']
|
111
140
|
end
|
@@ -115,7 +144,18 @@ describe Phony do
|
|
115
144
|
it 'handles turkish numbers' do
|
116
145
|
Phony.split('903121234567').should == ['90', '312', '123', '4567'] # Ankara
|
117
146
|
end
|
118
|
-
it
|
147
|
+
it 'handles UK numbers' do
|
148
|
+
Phony.split('442045671113').should == ['44', '20', '4567', '1113'] # London
|
149
|
+
Phony.split('442076229901').should == ['44', '20', '7622', '9901'] # Cardiff
|
150
|
+
Phony.split('441136770011').should == ['44', '113', '677', '0011'] # Leeds
|
151
|
+
Phony.split('441382229845').should == ['44', '1382', '229845'] # Dundee
|
152
|
+
Phony.split('44120499532').should == ['44', '1204', '99532'] # Bolten
|
153
|
+
Phony.split('441539618756').should == ['44', '15396', '18756'] # Sedbergh
|
154
|
+
Phony.split('447780605207').should == ['44', '7780', '605207'] # Mobile
|
155
|
+
Phony.split('447480605207').should == ['44', '7480', '605207'] # Mobile
|
156
|
+
Phony.split('448005878323').should == ['44', '800', '587', '8323'] # Service, regression
|
157
|
+
end
|
158
|
+
it "handles US numbers" do
|
119
159
|
Phony.split('15551115511').should == ['1', '555', '111', '5511']
|
120
160
|
end
|
121
161
|
it "should handle venezuelan numbers" do
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: phony
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 1.
|
5
|
+
version: 1.3.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Florian Hanke
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-02-
|
13
|
+
date: 2011-02-26 00:00:00 +01:00
|
14
14
|
default_executable:
|
15
15
|
dependencies: []
|
16
16
|
|
@@ -23,7 +23,7 @@ extensions: []
|
|
23
23
|
extra_rdoc_files:
|
24
24
|
- README.textile
|
25
25
|
files:
|
26
|
-
- lib/
|
26
|
+
- lib/countries.rb
|
27
27
|
- lib/phony/countries/austria.rb
|
28
28
|
- lib/phony/countries/belgium.rb
|
29
29
|
- lib/phony/countries/chile.rb
|
@@ -35,34 +35,27 @@ files:
|
|
35
35
|
- lib/phony/countries/italy.rb
|
36
36
|
- lib/phony/countries/malaysia.rb
|
37
37
|
- lib/phony/countries/netherlands.rb
|
38
|
-
- lib/phony/countries/norway.rb
|
39
|
-
- lib/phony/countries/peru.rb
|
40
|
-
- lib/phony/countries/portugal.rb
|
41
38
|
- lib/phony/countries/romania.rb
|
42
39
|
- lib/phony/countries/south_korea.rb
|
43
40
|
- lib/phony/countries/sweden.rb
|
44
41
|
- lib/phony/countries/united_kingdom.rb
|
42
|
+
- lib/phony/countries.rb
|
45
43
|
- lib/phony/country.rb
|
46
44
|
- lib/phony/country_codes.rb
|
45
|
+
- lib/phony/dsl.rb
|
47
46
|
- lib/phony/local_splitters/fixed.rb
|
48
47
|
- lib/phony/local_splitters/regex.rb
|
49
48
|
- lib/phony/national_code.rb
|
50
|
-
- lib/phony/national_splitters/
|
49
|
+
- lib/phony/national_splitters/dsl.rb
|
51
50
|
- lib/phony/national_splitters/fixed.rb
|
52
51
|
- lib/phony/national_splitters/none.rb
|
52
|
+
- lib/phony/national_splitters/regex.rb
|
53
53
|
- lib/phony/national_splitters/variable.rb
|
54
54
|
- lib/phony/vanity.rb
|
55
55
|
- lib/phony.rb
|
56
56
|
- README.textile
|
57
|
-
- spec/lib/phony/countries/austria_spec.rb
|
58
|
-
- spec/lib/phony/countries/belgium_spec.rb
|
59
|
-
- spec/lib/phony/countries/egypt_spec.rb
|
60
57
|
- spec/lib/phony/countries/germany_spec.rb
|
61
|
-
- spec/lib/phony/countries/greece_spec.rb
|
62
58
|
- spec/lib/phony/countries/hungary_spec.rb
|
63
|
-
- spec/lib/phony/countries/portugal_spec.rb
|
64
|
-
- spec/lib/phony/countries/switzerland_spec.rb
|
65
|
-
- spec/lib/phony/countries/united_kingdom_spec.rb
|
66
59
|
- spec/lib/phony/country_codes_spec.rb
|
67
60
|
- spec/lib/phony/country_spec.rb
|
68
61
|
- spec/lib/phony/local_splitters/fixed_spec.rb
|
@@ -70,6 +63,7 @@ files:
|
|
70
63
|
- spec/lib/phony/national_code_spec.rb
|
71
64
|
- spec/lib/phony/national_splitters/fixed_spec.rb
|
72
65
|
- spec/lib/phony/national_splitters/none_spec.rb
|
66
|
+
- spec/lib/phony/national_splitters/regex_spec.rb
|
73
67
|
- spec/lib/phony/national_splitters/variable_spec.rb
|
74
68
|
- spec/lib/phony/vanity_spec.rb
|
75
69
|
- spec/lib/phony_spec.rb
|
@@ -102,15 +96,8 @@ signing_key:
|
|
102
96
|
specification_version: 3
|
103
97
|
summary: Fast international phone number (E164 standard) normalizing, splitting and formatting.
|
104
98
|
test_files:
|
105
|
-
- spec/lib/phony/countries/austria_spec.rb
|
106
|
-
- spec/lib/phony/countries/belgium_spec.rb
|
107
|
-
- spec/lib/phony/countries/egypt_spec.rb
|
108
99
|
- spec/lib/phony/countries/germany_spec.rb
|
109
|
-
- spec/lib/phony/countries/greece_spec.rb
|
110
100
|
- spec/lib/phony/countries/hungary_spec.rb
|
111
|
-
- spec/lib/phony/countries/portugal_spec.rb
|
112
|
-
- spec/lib/phony/countries/switzerland_spec.rb
|
113
|
-
- spec/lib/phony/countries/united_kingdom_spec.rb
|
114
101
|
- spec/lib/phony/country_codes_spec.rb
|
115
102
|
- spec/lib/phony/country_spec.rb
|
116
103
|
- spec/lib/phony/local_splitters/fixed_spec.rb
|
@@ -118,6 +105,7 @@ test_files:
|
|
118
105
|
- spec/lib/phony/national_code_spec.rb
|
119
106
|
- spec/lib/phony/national_splitters/fixed_spec.rb
|
120
107
|
- spec/lib/phony/national_splitters/none_spec.rb
|
108
|
+
- spec/lib/phony/national_splitters/regex_spec.rb
|
121
109
|
- spec/lib/phony/national_splitters/variable_spec.rb
|
122
110
|
- spec/lib/phony/vanity_spec.rb
|
123
111
|
- spec/lib/phony_spec.rb
|
@@ -1,455 +0,0 @@
|
|
1
|
-
# Splits a national number into a fixed size NDC and rest.
|
2
|
-
#
|
3
|
-
module Phony
|
4
|
-
module Countries
|
5
|
-
|
6
|
-
# Ideas for a DSL:
|
7
|
-
#
|
8
|
-
# country(fixed(2) >> local([3,2,2]))
|
9
|
-
# country(none >> local([2,2,2,2]))
|
10
|
-
#
|
11
|
-
|
12
|
-
# Returns an anonymous fixed size ndc / format country handler.
|
13
|
-
#
|
14
|
-
def self.fixed size, options = {}
|
15
|
-
options.merge! :ndc_length => size
|
16
|
-
Phony::Country.fixed options
|
17
|
-
end
|
18
|
-
|
19
|
-
#
|
20
|
-
#
|
21
|
-
def self.custom *splitters
|
22
|
-
codes = []
|
23
|
-
splitters.flatten!
|
24
|
-
until splitters.empty?
|
25
|
-
codes << Phony::NationalCode.new(splitters.shift, splitters.shift)
|
26
|
-
end
|
27
|
-
Phony::Country.new *codes
|
28
|
-
end
|
29
|
-
|
30
|
-
# Experimental.
|
31
|
-
#
|
32
|
-
def self.fix size
|
33
|
-
NationalSplitters::Fixed.instance_for size
|
34
|
-
end
|
35
|
-
def self.none
|
36
|
-
NationalSplitters::None.instance_for
|
37
|
-
end
|
38
|
-
#
|
39
|
-
#
|
40
|
-
def self.format local
|
41
|
-
LocalSplitters::Fixed.instance_for local
|
42
|
-
end
|
43
|
-
|
44
|
-
# TODO
|
45
|
-
#
|
46
|
-
def self.with_cc cc
|
47
|
-
mapping[cc.size][cc.to_s]
|
48
|
-
end
|
49
|
-
|
50
|
-
# Defines a mapping of country code to all splitters/formatters.
|
51
|
-
#
|
52
|
-
# Note: The above fixed helper is used.
|
53
|
-
# In some cases, we have explicit countries defined.
|
54
|
-
#
|
55
|
-
# Note: Many taken from http://en.wikipedia.org/wiki/Telephone_numbering_plan.
|
56
|
-
#
|
57
|
-
def self.mapping
|
58
|
-
{
|
59
|
-
1 => {
|
60
|
-
'0' => fixed(1), # reserved
|
61
|
-
'1' => fixed(3, # USA, Canada, etc.
|
62
|
-
:local_format => [3, 4]
|
63
|
-
),
|
64
|
-
|
65
|
-
# Kazakhstan (Republic of) & Russian Federation
|
66
|
-
# http://en.wikipedia.org/wiki/Telephone_numbers_in_Russia
|
67
|
-
#
|
68
|
-
'7' => fixed(3,
|
69
|
-
:local_format => [3, 2, 2]
|
70
|
-
),
|
71
|
-
},
|
72
|
-
2 => {
|
73
|
-
'20' => Countries::Egypt,
|
74
|
-
'27' => fixed(2, # South Africa
|
75
|
-
:local_format => [3, 4]
|
76
|
-
),
|
77
|
-
|
78
|
-
'30' => Countries::Greece,
|
79
|
-
'31' => Countries::Netherlands,
|
80
|
-
'32' => Countries::Belgium,
|
81
|
-
'33' => fixed(1, # France
|
82
|
-
:local_format => [2, 2, 2, 2],
|
83
|
-
:service_ndcs => %w{8}
|
84
|
-
# :special_ndcs => {
|
85
|
-
# :service => %w{8},
|
86
|
-
# :mobile => %w{6 7}
|
87
|
-
# }
|
88
|
-
),
|
89
|
-
'34' => fixed(2, # Spain
|
90
|
-
:local_format => [3, 4]
|
91
|
-
),
|
92
|
-
'36' => Countries::Hungary,
|
93
|
-
'39' => Countries::Italy,
|
94
|
-
|
95
|
-
'40' => Countries::Romania,
|
96
|
-
'41' => fixed(2, # Switzerland (Confederation of)
|
97
|
-
:local_format => [3, 2, 2],
|
98
|
-
:service_local_format => [3, 3],
|
99
|
-
:service_ndcs => %w{800 840 842 844 848}
|
100
|
-
# :special_ndcs => {
|
101
|
-
# :service => %w{800 840 842 844 848},
|
102
|
-
# :mobile => %w{74 76 77 78 79}
|
103
|
-
# }
|
104
|
-
),
|
105
|
-
'43' => Countries::Austria,
|
106
|
-
'44' => Countries::UnitedKingdom, # TODO United Kingdom of Great Britain and Northern Ireland
|
107
|
-
'45' => custom(none >> format([2,2,2,2])), # Denmark
|
108
|
-
'46' => Countries::Sweden,
|
109
|
-
'47' => Countries::Norway, # custom(none >> regexp(/^[1].*$/ => [3], /^[489].*$/ => [3,2,3], :fallback => [2,2,2,2]))
|
110
|
-
'48' => fixed(3, # Poland (Republic of)
|
111
|
-
:local_format => [3, 3] # Although the NDCs are 2 digits, the representation is 3 digits.
|
112
|
-
), # Note: http://wapedia.mobi/en/Telephone_numbers_in_Poland, mobile not yet correct
|
113
|
-
'49' => Countries::Germany,
|
114
|
-
|
115
|
-
'51' => Countries::Peru,
|
116
|
-
'52' => fixed(2), # TODO Mexico
|
117
|
-
'53' => fixed(2), # TODO Cuba
|
118
|
-
'54' => fixed(2), # TODO Argentine Republic
|
119
|
-
'55' => fixed(2, # Brazil (Federative Republic of)
|
120
|
-
:local_format => [4, 4],
|
121
|
-
:service_ndcs => %w{100 128 190 191 192 193 194 197 198 199}
|
122
|
-
), # http://en.wikipedia.org/wiki/Telephone_numbers_in_Brazil
|
123
|
-
'56' => Countries::Chile,
|
124
|
-
'57' => fixed(2), # TODO Colombia (Republic of)
|
125
|
-
'58' => fixed(3, # Venezuela (Bolivarian Republic of)
|
126
|
-
:local_format => [7]
|
127
|
-
),
|
128
|
-
|
129
|
-
'60' => Countries::Malaysia, # Malaysia, http://en.wikipedia.org/wiki/Telephone_numbers_in_Malaysia
|
130
|
-
'61' => fixed(1, # Australia
|
131
|
-
:local_format => [4, 4]
|
132
|
-
),
|
133
|
-
'62' => fixed(2), # TODO Indonesia (Republic of)
|
134
|
-
'63' => fixed(2), # TODO Philippines (Republic of the)
|
135
|
-
'64' => fixed(1, # New Zealand
|
136
|
-
:local_format => [3, 4]
|
137
|
-
),
|
138
|
-
'65' => fixed(2), # TODO Singapore (Republic of)
|
139
|
-
'66' => fixed(2), # TODO Thailand
|
140
|
-
|
141
|
-
'81' => fixed(2), # TODO Japan
|
142
|
-
'82' => Countries::SouthKorea, # Korea (Republic of), http://en.wikipedia.org/wiki/Telephone_numbers_in_South_Korea
|
143
|
-
'84' => fixed(2), # TODO Viet Nam (Socialist Republic of)
|
144
|
-
'86' => Countries::China, # China (People's Republic of), http://en.wikipedia.org/wiki/Telephone_numbers_in_China
|
145
|
-
|
146
|
-
'90' => fixed(3, # Turkey, http://en.wikipedia.org/wiki/Telephone_numbers_in_Turkey
|
147
|
-
:local_format => [3, 4] # Wiki says 7, but the examples say 3, 4.
|
148
|
-
),
|
149
|
-
'91' => fixed(2), # TODO India (Republic of)
|
150
|
-
'92' => fixed(2), # TODO Pakistan (Islamic Republic of), http://en.wikipedia.org/wiki/Telephone_numbers_in_Pakistan, NDC 2-5
|
151
|
-
'93' => fixed(2, # Afghanistan
|
152
|
-
:local_format => [7] # Actually, the document says 6, but the examples use 7.
|
153
|
-
), # http://www.wtng.info/wtng-93-af.html
|
154
|
-
'94' => fixed(2), # TODO Sri Lanka (Democratic Socialist Republic of)
|
155
|
-
'95' => fixed(2), # TODO Myanmar (Union of)
|
156
|
-
'98' => fixed(2), # TODO Iran (Islamic Republic of)
|
157
|
-
},
|
158
|
-
3 => {
|
159
|
-
# TODO From here on.
|
160
|
-
#
|
161
|
-
'210' => fixed(2), # -
|
162
|
-
'211' => fixed(2), # -
|
163
|
-
'212' => fixed(2), # Morocco
|
164
|
-
'213' => fixed(2), # Algeria
|
165
|
-
'214' => fixed(2), # -
|
166
|
-
'215' => fixed(2), # -
|
167
|
-
'216' => fixed(2), # Tunisia
|
168
|
-
'217' => fixed(2), # -
|
169
|
-
'218' => fixed(2), # Lybia
|
170
|
-
'219' => fixed(2), # -
|
171
|
-
|
172
|
-
'220' => fixed(2), # Gambia
|
173
|
-
'221' => fixed(2), # Senegal
|
174
|
-
'222' => fixed(2), # Mauritania
|
175
|
-
'223' => fixed(2), # Mali
|
176
|
-
'224' => fixed(2), # Guinea
|
177
|
-
'225' => fixed(2), # Côte d'Ivoire
|
178
|
-
'226' => fixed(2), # Burkina Faso
|
179
|
-
'227' => fixed(2), # Niger
|
180
|
-
'228' => fixed(2), # Togolese Republic
|
181
|
-
'229' => fixed(2), # Benin
|
182
|
-
|
183
|
-
'230' => fixed(2), # Mauritius
|
184
|
-
'231' => fixed(2), # Liberia
|
185
|
-
'232' => fixed(2), # Sierra Leone
|
186
|
-
'233' => fixed(2), # Ghana
|
187
|
-
'234' => fixed(2), # Nigeria
|
188
|
-
'235' => fixed(2), # Chad
|
189
|
-
'236' => fixed(2), # Central African Republic
|
190
|
-
'237' => fixed(2), # Cameroon
|
191
|
-
'238' => fixed(2), # Cape Verde
|
192
|
-
'239' => fixed(2), # Sao Tome and Principe
|
193
|
-
|
194
|
-
'240' => fixed(2), # Equatorial Guinea
|
195
|
-
'241' => fixed(2), # Gabonese Republic
|
196
|
-
'242' => fixed(2), # Congo
|
197
|
-
'243' => fixed(2), # Democratic Republic of the Congo
|
198
|
-
'244' => fixed(2), # Angola
|
199
|
-
'245' => fixed(2), # Guinea-Bissau
|
200
|
-
'246' => fixed(2), # Diego Garcia
|
201
|
-
'247' => fixed(2), # Ascension
|
202
|
-
'248' => fixed(2), # Seychelles
|
203
|
-
'249' => fixed(2), # Sudan
|
204
|
-
|
205
|
-
'250' => fixed(2), # Rwanda
|
206
|
-
'251' => fixed(2), # Ethiopia
|
207
|
-
'252' => fixed(2), # Somali Democratic Republic
|
208
|
-
'253' => fixed(2), # Djibouti
|
209
|
-
'254' => fixed(2), # Kenya
|
210
|
-
'255' => fixed(2), # Tanzania
|
211
|
-
'256' => fixed(2), # Uganda
|
212
|
-
'257' => fixed(2), # Burundi
|
213
|
-
'258' => fixed(2), # Mozambique
|
214
|
-
'259' => fixed(2), # -
|
215
|
-
|
216
|
-
'260' => fixed(2), # Zambia
|
217
|
-
'261' => fixed(2), # Madagascar
|
218
|
-
'262' => fixed(3), # Reunion / Mayotte (new)
|
219
|
-
'263' => fixed(2), # Zimbabwe
|
220
|
-
'264' => fixed(2), # Namibia
|
221
|
-
'265' => fixed(2), # Malawi
|
222
|
-
'266' => fixed(2), # Lesotho
|
223
|
-
'267' => fixed(2), # Botswana
|
224
|
-
'268' => fixed(2), # Swaziland
|
225
|
-
'269' => fixed(2), # Comoros
|
226
|
-
|
227
|
-
'280' => fixed(2), # -
|
228
|
-
'281' => fixed(2), # -
|
229
|
-
'282' => fixed(2), # -
|
230
|
-
'283' => fixed(2), # -
|
231
|
-
'284' => fixed(2), # -
|
232
|
-
'285' => fixed(2), # -
|
233
|
-
'286' => fixed(2), # -
|
234
|
-
'287' => fixed(2), # -
|
235
|
-
'288' => fixed(2), # -
|
236
|
-
'289' => fixed(2), # -
|
237
|
-
'290' => fixed(2), # Saint Helena
|
238
|
-
|
239
|
-
'291' => fixed(2), # Eritrea
|
240
|
-
'292' => fixed(2), # -
|
241
|
-
'293' => fixed(2), # -
|
242
|
-
'294' => fixed(2), # -
|
243
|
-
'295' => fixed(2), # -
|
244
|
-
'296' => fixed(2), # -
|
245
|
-
'297' => fixed(2), # Aruba
|
246
|
-
'298' => fixed(2), # Faroe Islands
|
247
|
-
'299' => fixed(2), # Greenland
|
248
|
-
|
249
|
-
'350' => fixed(2), # Gibraltar
|
250
|
-
'351' => Countries::Portugal, # Portugal
|
251
|
-
'352' => fixed(2), # Luxembourg
|
252
|
-
'353' => fixed(2), # Ireland (0-3-4)
|
253
|
-
'354' => fixed(2), # Iceland
|
254
|
-
'355' => fixed(2), # Albania
|
255
|
-
'356' => fixed(2), # Malta
|
256
|
-
'357' => fixed(2), # Cyprus
|
257
|
-
'358' => fixed(2), # Finland
|
258
|
-
'359' => fixed(2), # Bulgaria
|
259
|
-
|
260
|
-
'370' => fixed(2), # Lithuania
|
261
|
-
'371' => fixed(2), # Latvia
|
262
|
-
'372' => fixed(2), # Estonia
|
263
|
-
'373' => fixed(2), # Moldova
|
264
|
-
'374' => fixed(2), # Armenia
|
265
|
-
'375' => fixed(2), # Belarus
|
266
|
-
'376' => fixed(2), # Andorra
|
267
|
-
'377' => fixed(2), # Monaco
|
268
|
-
'378' => fixed(2), # San Marino
|
269
|
-
'379' => fixed(2), # Vatican City State
|
270
|
-
|
271
|
-
'380' => fixed(2), # Ukraine
|
272
|
-
'381' => fixed(2), # Serbia and Montenegro
|
273
|
-
'382' => fixed(2), # -
|
274
|
-
'383' => fixed(2), # -
|
275
|
-
'384' => fixed(2), # -
|
276
|
-
'385' => fixed(2), # Croatia
|
277
|
-
'386' => fixed(2), # Slovenia
|
278
|
-
'387' => fixed(2), # Bosnia and Herzegovina
|
279
|
-
'388' => fixed(2), # Group of countries, shared code
|
280
|
-
'389' => fixed(2), # The Former Yugoslav Republic of Macedonia
|
281
|
-
|
282
|
-
'420' => fixed(3, # Czech Republic
|
283
|
-
:local_format => [3, 3]
|
284
|
-
),
|
285
|
-
'421' => fixed(2), # Slovak Republic
|
286
|
-
'422' => fixed(2), # Spare code
|
287
|
-
'423' => fixed(0, # Liechtenstein (Principality of)
|
288
|
-
:local_format => [3, 2, 2]
|
289
|
-
),
|
290
|
-
'424' => fixed(2), # -
|
291
|
-
'425' => fixed(2), # -
|
292
|
-
'426' => fixed(2), # -
|
293
|
-
'427' => fixed(2), # -
|
294
|
-
'428' => fixed(2), # -
|
295
|
-
'429' => fixed(2), # -
|
296
|
-
|
297
|
-
'500' => fixed(2), # Falkland Islands (Malvinas)
|
298
|
-
'501' => fixed(2), # Belize
|
299
|
-
'502' => fixed(2), # Guatemala (Republic of)
|
300
|
-
'503' => fixed(2), # El Salvador (Republic of)
|
301
|
-
'504' => fixed(2), # Honduras (Republic of)
|
302
|
-
'505' => fixed(2), # Nicaragua
|
303
|
-
'506' => fixed(2), # Costa Rica
|
304
|
-
'507' => fixed(2), # Panama (Republic of)
|
305
|
-
'508' => fixed(2), # Saint Pierre and Miquelon (Collectivité territoriale de la République française)
|
306
|
-
'509' => fixed(2), # Haiti (Republic of)
|
307
|
-
|
308
|
-
'590' => fixed(3), # Guadeloupe (French Department of)
|
309
|
-
'591' => fixed(2), # Bolivia (Republic of)
|
310
|
-
'592' => fixed(2), # Guyana
|
311
|
-
'593' => fixed(2), # Ecuador
|
312
|
-
'594' => fixed(3), # French Guiana (French Department of)
|
313
|
-
'595' => fixed(2), # Paraguay (Republic of)
|
314
|
-
'596' => fixed(3), # Martinique (French Department of)
|
315
|
-
'597' => fixed(2), # Suriname (Republic of)
|
316
|
-
'598' => fixed(2), # Uruguay (Eastern Republic of)
|
317
|
-
'599' => fixed(2), # Netherlands Antilles
|
318
|
-
|
319
|
-
'670' => fixed(2), # Democratic Republic of Timor-Leste
|
320
|
-
'671' => fixed(2), # Spare code
|
321
|
-
'672' => fixed(2), # Australian External Territories
|
322
|
-
'673' => fixed(2), # Brunei Darussalam
|
323
|
-
'674' => fixed(2), # Nauru (Republic of)
|
324
|
-
'675' => fixed(2), # Papua New Guinea
|
325
|
-
'676' => fixed(2), # Tonga (Kingdom of)
|
326
|
-
'677' => fixed(2), # Solomon Islands
|
327
|
-
'678' => fixed(2), # Vanuatu (Republic of)
|
328
|
-
'679' => fixed(2), # Fiji (Republic of)
|
329
|
-
|
330
|
-
'680' => fixed(2), # Palau (Republic of)
|
331
|
-
'681' => fixed(2), # Wallis and Futuna (Territoire français d'outre-mer)
|
332
|
-
'682' => fixed(2), # Cook Islands
|
333
|
-
'683' => fixed(2), # Niue
|
334
|
-
'684' => fixed(2), # -
|
335
|
-
'685' => fixed(2), # Samoa (Independent State of)
|
336
|
-
'686' => fixed(2), # Kiribati (Republic of)
|
337
|
-
'687' => fixed(2), # New Caledonia (Territoire français d'outre-mer)
|
338
|
-
'688' => fixed(2), # Tuvalu
|
339
|
-
'689' => fixed(2), # French Polynesia (Territoire français d'outre-mer)
|
340
|
-
|
341
|
-
'690' => fixed(2), # Tokelau
|
342
|
-
'691' => fixed(2), # Micronesia (Federated States of)
|
343
|
-
'692' => fixed(2), # Marshall Islands (Republic of the)
|
344
|
-
'693' => fixed(2), # -
|
345
|
-
'694' => fixed(2), # -
|
346
|
-
'695' => fixed(2), # -
|
347
|
-
'696' => fixed(2), # -
|
348
|
-
'697' => fixed(2), # -
|
349
|
-
'698' => fixed(2), # -
|
350
|
-
'699' => fixed(2), # -
|
351
|
-
|
352
|
-
'800' => fixed(2), # International Freephone Service
|
353
|
-
'801' => fixed(2), # -
|
354
|
-
'802' => fixed(2), # -
|
355
|
-
'803' => fixed(2), # -
|
356
|
-
'804' => fixed(2), # -
|
357
|
-
'805' => fixed(2), # -
|
358
|
-
'806' => fixed(2), # -
|
359
|
-
'807' => fixed(2), # -
|
360
|
-
'808' => fixed(2), # International Shared Cost Service (ISCS)
|
361
|
-
'809' => fixed(2), # -
|
362
|
-
|
363
|
-
'830' => fixed(2), # -
|
364
|
-
'831' => fixed(2), # -
|
365
|
-
'832' => fixed(2), # -
|
366
|
-
'833' => fixed(2), # -
|
367
|
-
'834' => fixed(2), # -
|
368
|
-
'835' => fixed(2), # -
|
369
|
-
'836' => fixed(2), # -
|
370
|
-
'837' => fixed(2), # -
|
371
|
-
'838' => fixed(2), # -
|
372
|
-
'839' => fixed(2), # -
|
373
|
-
|
374
|
-
'850' => fixed(2), # Democratic People's Republic of Korea
|
375
|
-
'851' => fixed(2), # Spare code
|
376
|
-
'852' => fixed(2), # Hong Kong, China
|
377
|
-
'853' => fixed(2), # Macao, China
|
378
|
-
'854' => fixed(2), # Spare code
|
379
|
-
'855' => fixed(2), # Cambodia (Kingdom of)
|
380
|
-
'856' => fixed(2), # Lao People's Democratic Republic
|
381
|
-
'857' => fixed(2), # Spare code
|
382
|
-
'858' => fixed(2), # Spare code
|
383
|
-
'859' => fixed(2), # Spare code
|
384
|
-
|
385
|
-
'870' => fixed(2), # Inmarsat SNAC
|
386
|
-
'871' => fixed(2), # Inmarsat (Atlantic Ocean-East)
|
387
|
-
'872' => fixed(2), # Inmarsat (Pacific Ocean)
|
388
|
-
'873' => fixed(2), # Inmarsat (Indian Ocean)
|
389
|
-
'874' => fixed(2), # Inmarsat (Atlantic Ocean-West)
|
390
|
-
'875' => fixed(2), # Reserved - Maritime Mobile Service Applications
|
391
|
-
'876' => fixed(2), # Reserved - Maritime Mobile Service Applications
|
392
|
-
'877' => fixed(2), # Reserved - Maritime Mobile Service Applications
|
393
|
-
'878' => fixed(2), # Universal Personal Telecommunication Service (UPT)
|
394
|
-
'879' => fixed(2), # Reserved for national non-commercial purposes
|
395
|
-
|
396
|
-
'880' => fixed(2), # Bangladesh (People's Republic of)
|
397
|
-
'881' => fixed(2), # International Mobile, shared code
|
398
|
-
'882' => fixed(2), # International Networks, shared code
|
399
|
-
'883' => fixed(2), # -
|
400
|
-
'884' => fixed(2), # -
|
401
|
-
'885' => fixed(2), # -
|
402
|
-
'886' => fixed(2), # Reserved
|
403
|
-
'887' => fixed(2), # -
|
404
|
-
'888' => fixed(2), # Reserved for future global service
|
405
|
-
'889' => fixed(2), # -
|
406
|
-
|
407
|
-
'890' => fixed(2), # -
|
408
|
-
'891' => fixed(2), # -
|
409
|
-
'892' => fixed(2), # -
|
410
|
-
'893' => fixed(2), # -
|
411
|
-
'894' => fixed(2), # -
|
412
|
-
'895' => fixed(2), # -
|
413
|
-
'896' => fixed(2), # -
|
414
|
-
'897' => fixed(2), # -
|
415
|
-
'898' => fixed(2), # -
|
416
|
-
'899' => fixed(2), # -
|
417
|
-
|
418
|
-
'960' => fixed(2), # Maldives (Republic of)
|
419
|
-
'961' => fixed(2), # Lebanon
|
420
|
-
'962' => fixed(2), # Jordan (Hashemite Kingdom of)
|
421
|
-
'963' => fixed(2), # Syrian Arab Republic
|
422
|
-
'964' => fixed(2), # Iraq (Republic of)
|
423
|
-
'965' => fixed(2), # Kuwait (State of)
|
424
|
-
'966' => fixed(2), # Saudi Arabia (Kingdom of)
|
425
|
-
'967' => fixed(2), # Yemen (Republic of)
|
426
|
-
'968' => fixed(2), # Oman (Sultanate of)
|
427
|
-
'969' => fixed(2), # Reserved - reservation currently under investigation
|
428
|
-
|
429
|
-
'970' => fixed(2), # Reserved
|
430
|
-
'971' => fixed(2), # United Arab Emirates
|
431
|
-
'972' => fixed(2), # Israel (State of)
|
432
|
-
'973' => fixed(2), # Bahrain (Kingdom of)
|
433
|
-
'974' => fixed(2), # Qatar (State of)
|
434
|
-
'975' => fixed(2), # Bhutan (Kingdom of)
|
435
|
-
'976' => fixed(2), # Mongolia
|
436
|
-
'977' => fixed(2), # Nepal
|
437
|
-
'978' => fixed(2), # -
|
438
|
-
'979' => fixed(2), # International Premium Rate Service (IPRS)
|
439
|
-
|
440
|
-
'990' => fixed(2), # Spare code
|
441
|
-
'991' => fixed(2), # Trial of a proposed new international telecommunication public correspondence service, shared code
|
442
|
-
'992' => fixed(2), # Tajikistan (Republic of)
|
443
|
-
'993' => fixed(2), # Turkmenistan
|
444
|
-
'994' => fixed(2), # Azerbaijani Republic
|
445
|
-
'995' => fixed(2), # Georgia
|
446
|
-
'996' => fixed(2), # Kyrgyz Republic
|
447
|
-
'997' => fixed(2), # Spare code
|
448
|
-
'998' => fixed(2), # Uzbekistan (Republic of)
|
449
|
-
'999' => fixed(2), # Reserved for possible future use within the Telecommunications for Disaster Relief (TDR) concept
|
450
|
-
}
|
451
|
-
}
|
452
|
-
end
|
453
|
-
|
454
|
-
end
|
455
|
-
end
|