phonelib 0.5.5 → 0.5.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (111) hide show
  1. checksums.yaml +4 -4
  2. data/README.rdoc +11 -2
  3. data/data/extended_data.dat +0 -0
  4. data/data/libphonenumber/FAQ.md +166 -0
  5. data/data/libphonenumber/README.md +1 -1
  6. data/data/libphonenumber/cpp/CMakeLists.txt +16 -3
  7. data/data/libphonenumber/cpp/src/phonenumbers/lite_metadata.cc +9337 -9341
  8. data/data/libphonenumber/cpp/src/phonenumbers/metadata.cc +9948 -9951
  9. data/data/libphonenumber/cpp/src/phonenumbers/short_metadata.cc +1285 -1280
  10. data/data/libphonenumber/debian/control +1 -1
  11. data/data/libphonenumber/java/carrier/pom.xml +4 -4
  12. data/data/libphonenumber/java/carrier/src/com/google/i18n/phonenumbers/carrier/data/225_en +0 -0
  13. data/data/libphonenumber/java/carrier/src/com/google/i18n/phonenumbers/carrier/data/234_en +0 -0
  14. data/data/libphonenumber/java/carrier/src/com/google/i18n/phonenumbers/carrier/data/235_en +0 -0
  15. data/data/libphonenumber/java/carrier/src/com/google/i18n/phonenumbers/carrier/data/251_en +0 -0
  16. data/data/libphonenumber/java/carrier/src/com/google/i18n/phonenumbers/carrier/data/675_en +0 -0
  17. data/data/libphonenumber/java/carrier/src/com/google/i18n/phonenumbers/carrier/data/91_en +0 -0
  18. data/data/libphonenumber/java/carrier/src/com/google/i18n/phonenumbers/carrier/data/993_en +0 -0
  19. data/data/libphonenumber/java/demo/pom.xml +6 -6
  20. data/data/libphonenumber/java/demo/src/com/google/phonenumbers/PhoneNumberParserServlet.java +4 -3
  21. data/data/libphonenumber/java/geocoder/pom.xml +4 -4
  22. data/data/libphonenumber/java/geocoder/src/com/google/i18n/phonenumbers/geocoding/data/1380_en +0 -0
  23. data/data/libphonenumber/java/geocoder/src/com/google/i18n/phonenumbers/geocoding/data/1825_en +0 -0
  24. data/data/libphonenumber/java/geocoder/src/com/google/i18n/phonenumbers/geocoding/data/212_en +0 -0
  25. data/data/libphonenumber/java/geocoder/src/com/google/i18n/phonenumbers/geocoding/data/46_en +0 -0
  26. data/data/libphonenumber/java/geocoder/src/com/google/i18n/phonenumbers/geocoding/data/config +0 -0
  27. data/data/libphonenumber/java/internal/prefixmapper/pom.xml +3 -3
  28. data/data/libphonenumber/java/libphonenumber/pom.xml +2 -2
  29. data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/MultiFileMetadataSourceImpl.java +9 -1
  30. data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java +2 -2
  31. data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AG +0 -0
  32. data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AI +0 -0
  33. data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AS +0 -0
  34. data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BB +0 -0
  35. data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BM +0 -0
  36. data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BS +0 -0
  37. data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BW +0 -0
  38. data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CA +0 -0
  39. data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CI +0 -0
  40. data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CK +0 -0
  41. data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_DJ +0 -0
  42. data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_DM +0 -0
  43. data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_DO +0 -0
  44. data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_ET +0 -0
  45. data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GD +0 -0
  46. data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GM +0 -0
  47. data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GU +0 -0
  48. data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_IN +0 -0
  49. data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_JM +0 -0
  50. data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_KN +0 -0
  51. data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_KY +0 -0
  52. data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_LC +0 -0
  53. data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MA +0 -0
  54. data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MP +0 -0
  55. data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MS +0 -0
  56. data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_NA +0 -0
  57. data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_NG +0 -0
  58. data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_PG +0 -0
  59. data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_PR +0 -0
  60. data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SE +0 -0
  61. data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SK +0 -0
  62. data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SX +0 -0
  63. data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TC +0 -0
  64. data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TD +0 -0
  65. data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TM +0 -0
  66. data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TT +0 -0
  67. data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_US +0 -0
  68. data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_VC +0 -0
  69. data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_VG +0 -0
  70. data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_VI +0 -0
  71. data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/ShortNumberMetadataProto_KR +0 -0
  72. data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/ShortNumberMetadataProto_PT +0 -0
  73. data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/SingleFilePhoneNumberMetadataProto +0 -0
  74. data/data/libphonenumber/java/pom.xml +1 -1
  75. data/data/libphonenumber/java/release_notes.txt +47 -7
  76. data/data/libphonenumber/javascript/i18n/phonenumbers/demo-compiled.js +171 -169
  77. data/data/libphonenumber/javascript/i18n/phonenumbers/metadata.js +61 -57
  78. data/data/libphonenumber/javascript/i18n/phonenumbers/metadatalite.js +61 -57
  79. data/data/libphonenumber/resources/PhoneNumberMetadata.xml +165 -155
  80. data/data/libphonenumber/resources/ShortNumberMetadata.xml +41 -7
  81. data/data/libphonenumber/resources/carrier/en/225.txt +1 -0
  82. data/data/libphonenumber/resources/carrier/en/234.txt +15 -4
  83. data/data/libphonenumber/resources/carrier/en/235.txt +1 -0
  84. data/data/libphonenumber/resources/carrier/en/251.txt +1 -0
  85. data/data/libphonenumber/resources/carrier/en/675.txt +6 -5
  86. data/data/libphonenumber/resources/carrier/en/91.txt +1 -0
  87. data/data/libphonenumber/resources/carrier/en/993.txt +1 -0
  88. data/data/libphonenumber/resources/geocoding/en/1.txt +2 -0
  89. data/data/libphonenumber/resources/geocoding/en/212.txt +1 -0
  90. data/data/libphonenumber/resources/geocoding/en/46.txt +15 -0
  91. data/data/libphonenumber/resources/geocoding/fr/212.txt +1 -0
  92. data/data/libphonenumber/resources/phonemetadata.proto +1 -1
  93. data/data/libphonenumber/tools/java/common/src/com/google/i18n/phonenumbers/BuildMetadataFromXml.java +4 -5
  94. data/data/libphonenumber/tools/java/cpp-build/target/cpp-build-1.0-SNAPSHOT-jar-with-dependencies.jar +0 -0
  95. data/data/libphonenumber/tools/java/data/pom.xml +1 -1
  96. data/data/libphonenumber/tools/java/java-build/target/java-build-1.0-SNAPSHOT-jar-with-dependencies.jar +0 -0
  97. data/data/phone_data.dat +0 -0
  98. data/lib/phonelib/core.rb +13 -0
  99. data/lib/phonelib/phone.rb +10 -4
  100. data/lib/phonelib/version.rb +1 -1
  101. metadata +5 -12
  102. data/data/libphonenumber/java/geocoder/src/com/google/i18n/phonenumbers/geocoding/data/1726_en +0 -0
  103. data/data/libphonenumber/java/geocoder/src/com/google/i18n/phonenumbers/geocoding/data/1730_en +0 -0
  104. data/data/libphonenumber/java/geocoder/src/com/google/i18n/phonenumbers/geocoding/data/1838_en +0 -0
  105. data/data/libphonenumber/java/geocoder/src/com/google/i18n/phonenumbers/geocoding/data/1851_en +0 -0
  106. data/data/libphonenumber/java/geocoder/src/com/google/i18n/phonenumbers/geocoding/data/1888_en +0 -0
  107. data/data/libphonenumber/java/geocoder/src/com/google/i18n/phonenumbers/geocoding/data/225_fr +0 -0
  108. data/data/libphonenumber/java/geocoder/src/com/google/i18n/phonenumbers/geocoding/data/238_pt +0 -0
  109. data/data/libphonenumber/java/geocoder/src/com/google/i18n/phonenumbers/geocoding/data/242_fr +0 -0
  110. data/data/libphonenumber/java/geocoder/src/com/google/i18n/phonenumbers/geocoding/data/269_fr +0 -0
  111. data/data/libphonenumber/java/geocoder/src/com/google/i18n/phonenumbers/geocoding/data/55_pt +0 -0
@@ -5659,7 +5659,10 @@
5659
5659
  2[01389]|
5660
5660
  3(?:
5661
5661
  2|
5662
- 39|
5662
+ 3[039]|
5663
+ 45|
5664
+ 66|
5665
+ 88|
5663
5666
  9[18]
5664
5667
  )|
5665
5668
  82
@@ -5687,9 +5690,11 @@
5687
5690
  <nationalNumberPattern>
5688
5691
  1(?:
5689
5692
  17|
5690
- 29|
5693
+ 2[139]|
5691
5694
  3(?:
5692
- 39|
5695
+ 3[09]|
5696
+ 66|
5697
+ 88|
5693
5698
  9[18]
5694
5699
  )|
5695
5700
  82
@@ -5703,10 +5708,11 @@
5703
5708
  1(?:
5704
5709
  1[78]|
5705
5710
  28|
5711
+ 330|
5706
5712
  82
5707
5713
  )
5708
5714
  </nationalNumberPattern>
5709
- <possibleNumberPattern>\d{3}</possibleNumberPattern>
5715
+ <possibleNumberPattern>\d{3,4}</possibleNumberPattern>
5710
5716
  <exampleNumber>118</exampleNumber>
5711
5717
  </tollFree>
5712
5718
  </territory>
@@ -7825,17 +7831,45 @@
7825
7831
  <!-- http://www.anacom.pt/render.jsp?categoryId=279098 -->
7826
7832
  <territory id="PT">
7827
7833
  <generalDesc>
7828
- <nationalNumberPattern>1\d{2}</nationalNumberPattern>
7829
- <possibleNumberPattern>\d{3}</possibleNumberPattern>
7834
+ <nationalNumberPattern>1\d{2,5}</nationalNumberPattern>
7835
+ <possibleNumberPattern>\d{3,6}</possibleNumberPattern>
7830
7836
  </generalDesc>
7831
7837
  <shortCode>
7832
- <nationalNumberPattern>11[25-8]</nationalNumberPattern>
7838
+ <nationalNumberPattern>
7839
+ 11(?:
7840
+ [2578]|
7841
+ 6(?:
7842
+ 000|
7843
+ 111
7844
+ )
7845
+ )
7846
+ </nationalNumberPattern>
7833
7847
  <exampleNumber>112</exampleNumber>
7834
7848
  </shortCode>
7835
7849
  <emergency>
7836
7850
  <nationalNumberPattern>11[25]</nationalNumberPattern>
7837
7851
  <exampleNumber>112</exampleNumber>
7838
7852
  </emergency>
7853
+ <expandedEmergency>
7854
+ <nationalNumberPattern>
7855
+ 116(?:
7856
+ 000|
7857
+ 111
7858
+ )
7859
+ </nationalNumberPattern>
7860
+ <possibleNumberPattern>\d{6}</possibleNumberPattern>
7861
+ <exampleNumber>116000</exampleNumber>
7862
+ </expandedEmergency>
7863
+ <tollFree>
7864
+ <nationalNumberPattern>
7865
+ 116(?:
7866
+ 000|
7867
+ 111
7868
+ )
7869
+ </nationalNumberPattern>
7870
+ <possibleNumberPattern>\d{6}</possibleNumberPattern>
7871
+ <exampleNumber>116000</exampleNumber>
7872
+ </tollFree>
7839
7873
  </territory>
7840
7874
 
7841
7875
  <!-- Palau -->
@@ -52,3 +52,4 @@
52
52
  22575|MTN
53
53
  22577|Orange
54
54
  22578|Orange
55
+ 22587|Orange
@@ -12,6 +12,9 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
+ # NITEL and Mtel are brand names of the same consortium. They are merged under
16
+ # NATCOM, and as of Nov 2015 are known as Ntel.
17
+
15
18
  234173|Starcomms
16
19
  234174|Starcomms
17
20
  2341804|Starcomms
@@ -136,18 +139,23 @@
136
139
  2346987|Starcomms
137
140
  2346988|Starcomms
138
141
  2346989|Starcomms
139
- 2347021|M-Tel
140
- 2347022|M-Tel
142
+ 234701|Airtel
143
+ 2347020|Smile
144
+ 2347021|Ntel
145
+ 2347022|Ntel
146
+ 2347023|Zoom
147
+ 2347024|Prestel
141
148
  2347025|Visafone
142
149
  2347026|Visafone
150
+ 2347027|Multilinks
143
151
  2347028|Starcomms
144
152
  2347029|Starcomms
145
153
  234703|MTN
146
154
  234704|Visafone
147
155
  234705|Glo
148
156
  234706|MTN
149
- 234707|Glo
150
157
  234708|Airtel
158
+ 234709|Multilinks
151
159
  2347380|Starcomms
152
160
  2347381|Starcomms
153
161
  2347382|Starcomms
@@ -167,9 +175,11 @@
167
175
  2347782|Starcomms
168
176
  2347783|Starcomms
169
177
  2347784|Starcomms
178
+ 2348010|Megatech
179
+ 2348011|Megatech
170
180
  234802|Airtel
171
181
  234803|MTN
172
- 234804|M-Tel
182
+ 234804|Ntel
173
183
  234805|Glo
174
184
  234806|MTN
175
185
  234807|Glo
@@ -241,6 +251,7 @@
241
251
  234902|Airtel
242
252
  234903|MTN
243
253
  234905|Glo
254
+ 234908|Etisalat
244
255
  234909|Etisalat
245
256
  234980|Starcomms
246
257
  234987|Starcomms
@@ -13,4 +13,5 @@
13
13
  # limitations under the License.
14
14
 
15
15
  2356|Airtel
16
+ 23577|Sotel
16
17
  2359|Millicom
@@ -17,3 +17,4 @@
17
17
  25193|Ethio Telecom
18
18
  25194|Ethio Telecom
19
19
  25195|Ethio Telecom
20
+ 251966|Ethio Telecom
@@ -13,17 +13,18 @@
13
13
  # limitations under the License.
14
14
 
15
15
  # http://www.itu.int/oth/T02020000A4/en
16
- #
17
- # bmobile changed its name in 2009 to bemobile,
18
- # which is the name used in the ITU document,
19
- # but most online sources including the company's own web site still refer to bmobile.
16
+ # bmobile changed its name in 2009 to bemobile, which is the name used in the
17
+ # ITU document, but most online sources including the company's own web site
18
+ # still refer to bmobile.
20
19
 
21
20
  67520150|bmobile/Telikom
22
21
  67570|Digicel
23
22
  67571|Digicel
24
23
  67572|Digicel
25
24
  67573|Digicel
25
+ 67574|Digicel
26
+ 67575|bmobile
26
27
  67576|bmobile
27
28
  675775|Telikom
29
+ 67578|Telikom
28
30
  67579|Digicel
29
-
@@ -218,6 +218,7 @@
218
218
  917308|Reliance
219
219
  917309|Idea
220
220
  917310|Vodafone
221
+ 917319|Airtel
221
222
  917350|Idea
222
223
  917351|Idea
223
224
  917352|Idea
@@ -12,6 +12,7 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
+ 99361|TM-Cell
15
16
  99365|TM-Cell
16
17
  99366|MTS (BARASH Communication)
17
18
  99367|MTS (BARASH Communication)
@@ -8567,6 +8567,7 @@
8567
8567
  1361994|Corpus Christi, TX
8568
8568
  1364|Kentucky
8569
8569
  1365|Ontario
8570
+ 1380|Ohio
8570
8571
  1385|Utah
8571
8572
  1386|Florida
8572
8573
  1386218|Orange City, FL
@@ -29141,6 +29142,7 @@
29141
29142
  1819983|Saint-André-Avellin, QC
29142
29143
  1819985|Thurso, QC
29143
29144
  1819986|Gatineau, QC
29145
+ 1825|Alberta
29144
29146
  1828|North Carolina
29145
29147
  1828210|Asheville, NC
29146
29148
  1828213|Asheville, NC
@@ -18,6 +18,7 @@
18
18
 
19
19
  212520|Casablanca
20
20
  212521|Casablanca/Central Morocco
21
+ 2125220|Casablanca
21
22
  2125222|Casablanca
22
23
  2125223|Casablanca
23
24
  2125224|Casablanca
@@ -36,6 +36,7 @@
36
36
  46159|Mariefred
37
37
  4616|Eskilstuna-Torshälla
38
38
  46171|Enköping
39
+ 46173|Öregrund-Östhammar
39
40
  46174|Alunda
40
41
  46175|Hallstavik-Rimbo
41
42
  46176|Norrtälje
@@ -45,10 +46,12 @@
45
46
  46220|Hallstahammar-Surahammar
46
47
  46221|Köping
47
48
  46222|Skinnskatteberg
49
+ 46223|Fagersta-Norberg
48
50
  46224|Sala-Heby
49
51
  46225|Hedemora-Säter
50
52
  46226|Avesta-Krylbo
51
53
  46227|Kungsör
54
+ 4623|Falun
52
55
  46240|Ludvika-Smedjebacken
53
56
  46241|Gagnef-Floda
54
57
  46243|Borlänge
@@ -58,6 +61,7 @@
58
61
  46250|Mora-Orsa
59
62
  46251|Älvdalen
60
63
  46253|Idre-Särna
64
+ 46258|Furudal
61
65
  4626|Gävle-Sandviken
62
66
  46270|Söderhamn
63
67
  46271|Alfta-Edsbyn
@@ -73,7 +77,9 @@
73
77
  46297|Ockelbo-Hamrånge
74
78
  46300|Kungsbacka
75
79
  46301|Hindås
80
+ 46302|Lerum
76
81
  46303|Kungälv
82
+ 46304|Orust-Tjörn
77
83
  4631|Gothenburg
78
84
  46320|Kinna
79
85
  46321|Ulricehamn
@@ -134,6 +140,7 @@
134
140
  46492|Vimmerby
135
141
  46493|Gamleby
136
142
  46494|Kisa
143
+ 46495|Hultsfred-Virserum
137
144
  46496|Mariannelund
138
145
  46498|Gotland
139
146
  46499|Mönsterås
@@ -147,6 +154,7 @@
147
154
  46510|Lidköping
148
155
  46511|Skara-Götene
149
156
  46512|Vara-Nossebro
157
+ 46513|Herrljunga
150
158
  46514|Grästorp
151
159
  46515|Falköping
152
160
  46520|Trollhättan
@@ -168,6 +176,7 @@
168
176
  46552|Deje
169
177
  46553|Molkom
170
178
  46554|Kil
179
+ 46555|Grums
171
180
  46560|Torsby
172
181
  46563|Hagfors-Munkfors
173
182
  46564|Sysslebäck
@@ -181,6 +190,7 @@
181
190
  46583|Askersund
182
191
  46584|Laxå
183
192
  46585|Fjugesta-Svartå
193
+ 46586|Karlskoga-Degerfors
184
194
  46587|Nora
185
195
  46589|Arboga
186
196
  46590|Filipstad
@@ -221,6 +231,7 @@
221
231
  46691|Torpshammar
222
232
  46692|Liden
223
233
  46693|Bräcke-Gällö
234
+ 46695|Stugun
224
235
  46696|Hammarstrand
225
236
  468|Stockholm
226
237
  4690|Umeå
@@ -228,6 +239,7 @@
228
239
  46911|Piteå
229
240
  46912|Byske
230
241
  46913|Lövånger
242
+ 46914|Burträsk
231
243
  46915|Bastuträsk
232
244
  46916|Jörn
233
245
  46918|Norsjö
@@ -249,14 +261,17 @@
249
261
  46940|Vilhelmina
250
262
  46941|Åsele
251
263
  46942|Dorotea
264
+ 46943|Fredrika
252
265
  46950|Lycksele
253
266
  46951|Storuman
254
267
  46952|Sorsele
255
268
  46953|Malå
256
269
  46954|Tärnaby
270
+ 46960|Arvidsjaur
257
271
  46961|Arjeplog
258
272
  46970|Gällivare
259
273
  46971|Jokkmokk
274
+ 46973|Porjus
260
275
  46975|Hakkas
261
276
  46976|Vuollerim
262
277
  46977|Korpilombolo
@@ -17,6 +17,7 @@
17
17
 
18
18
  212520|Casablanca
19
19
  212521|Casablanca/Maroc Central
20
+ 2125220|Casablanca
20
21
  2125222|Casablanca
21
22
  2125223|Casablanca
22
23
  2125224|Casablanca
@@ -82,7 +82,7 @@ message NumberFormat {
82
82
  // commonly seen this number written by people without the leading 0, for
83
83
  // example as (20) XXXX XXXX, this field would be set to true. This will be
84
84
  // inherited from the value set for the territory in the XML file, unless a
85
- // national_prefix_formatting_rule is defined specifically for this
85
+ // national_prefix_optional_when_formatting is defined specifically for this
86
86
  // NumberFormat.
87
87
  optional bool national_prefix_optional_when_formatting = 6;
88
88
 
@@ -294,10 +294,10 @@ public class BuildMetadataFromXml {
294
294
  }
295
295
 
296
296
  /**
297
- * Extracts the available formats from the provided DOM element. If it does not contain any
298
- * nationalPrefixFormattingRule, the one passed-in is retained. The nationalPrefix,
299
- * nationalPrefixFormattingRule and nationalPrefixOptionalWhenFormatting values are provided from
300
- * the parent (territory) element.
297
+ * Extracts the available formats from the provided DOM element. If it does not contain any
298
+ * nationalPrefixFormattingRule, the one passed-in is retained; similarly for
299
+ * nationalPrefixOptionalWhenFormatting. The nationalPrefix, nationalPrefixFormattingRule and
300
+ * nationalPrefixOptionalWhenFormatting values are provided from the parent (territory) element.
301
301
  */
302
302
  // @VisibleForTesting
303
303
  static void loadAvailableFormats(PhoneMetadata metadata,
@@ -324,7 +324,6 @@ public class BuildMetadataFromXml {
324
324
  } else {
325
325
  format.nationalPrefixFormattingRule = nationalPrefixFormattingRule;
326
326
  }
327
-
328
327
  if (numberFormatElement.hasAttribute(NATIONAL_PREFIX_OPTIONAL_WHEN_FORMATTING)) {
329
328
  format.nationalPrefixOptionalWhenFormatting =
330
329
  Boolean.valueOf(numberFormatElement.getAttribute(
@@ -13,7 +13,7 @@
13
13
  <name>Libphonenumber Data tools</name>
14
14
 
15
15
  <properties>
16
- <gae.version>1.5.4</gae.version>
16
+ <gae.version>1.9.32</gae.version>
17
17
  </properties>
18
18
 
19
19
  <repositories>
data/data/phone_data.dat CHANGED
Binary file
data/lib/phonelib/core.rb CHANGED
@@ -77,6 +77,19 @@ module Phonelib
77
77
  @@parse_special = special
78
78
  end
79
79
 
80
+ # strict check for validator, doesn't sanitize number
81
+ @@strict_check = false
82
+
83
+ # getter for strict check flag
84
+ def strict_check
85
+ @@strict_check
86
+ end
87
+
88
+ # setter for strict check flag
89
+ def strict_check=(strict)
90
+ @@strict_check = strict
91
+ end
92
+
80
93
  # gem constants definition
81
94
 
82
95
  # Main data file
@@ -34,7 +34,11 @@ module Phonelib
34
34
 
35
35
  # method to get sanitized phone number (only numbers)
36
36
  def sanitized
37
- @sanitized ||= @original && @original.gsub(/[^0-9]+/, '') || ''
37
+ @sanitized = if Phonelib.strict_check
38
+ @original
39
+ else
40
+ @original && @original.gsub(/[^0-9]+/, '') || ''
41
+ end
38
42
  end
39
43
 
40
44
  # Returns all phone types that matched valid patterns
@@ -135,21 +139,23 @@ module Phonelib
135
139
  end
136
140
 
137
141
  # Returns formatted national number
138
- def national
142
+ def national(formatted = true)
139
143
  return @national_number unless valid?
140
144
  format_match, format_string = get_formatting_data
141
145
 
142
146
  if format_match
143
- format_string.gsub(/\$\d/) { |el| format_match[el[1].to_i] }
147
+ out = format_string.gsub(/\$\d/) { |el| format_match[el[1].to_i] }
148
+ formatted ? out : out.gsub(/[^0-9]/, '')
144
149
  else
145
150
  @national_number
146
151
  end
147
152
  end
148
153
 
149
154
  # Returns e164 formatted phone number
150
- def international
155
+ def international(formatted = true)
151
156
  return nil if sanitized.nil? || sanitized.empty?
152
157
  return "+#{sanitized}" unless valid?
158
+ return "#{@data[country][Core::COUNTRY_CODE]}#{@national_number}" unless formatted
153
159
 
154
160
  format = @data[country][:format]
155
161
  if matches = @national_number.match(/#{format[Core::PATTERN]}/)