Permalink
Browse files

added uk

  • Loading branch information...
kbingman committed Feb 11, 2011
2 parents 060a37b + 4712a10 commit c8173d5b1bcb3ba08513ebe34c0e5c1f90453b0d
View
@@ -7,8 +7,8 @@ This gem can normalize, format and split E164 numbers.
The (admittedly crazy) *goal* of this Gem is to be able to format/split all phone numbers in the world.
-Currently handles Afghan, Austrian, Australian, Belgian, Brazilian, Chilean, Chinese, Czech, Danish, Dutch, Egyptian, French, German, Greek, Hungarian, Italian, Malaysian, (The) Netherlands, New Zealand, Norwegian, Peruvian, Polish, Russian, Romanian, South African, South Korean, Spanish, Swedish, Swiss, Turkish, Liechtenstein, US, Venezuelan numbers.
-And to some extend, all others. Just try if it works for you.
+Currently handles Afghan, Austrian, Australian, Belgian, Brazilian, Chilean, Chinese, Czech, Danish, Dutch, Egyptian, French, German, Greek, Hungarian, Italian, Malaysian, (The) Netherlands, New Zealand, Norwegian, Peruvian, Polish, Russian, Romanian, South African, South Korean, Spanish, Swedish, Swiss, Turkish, Liechtenstein, US, and Venezuelan numbers.
+And to some extent, all others. Just try if it works for you.
If it doesn't, please "enter an issue":http://github.com/floere/phony/issues.
View
@@ -1,3 +1,23 @@
+h2. Version 1.2.9
+
+* hanke: Clashing mobile numbers with Liège in Belgium fixed.
+
+h2. Version 1.2.8
+
+* hanke: Fix by glebm, thanks! Italian number handling did produce errors in Ruby 1.8. Closes "issue 13":https://github.com/floere/phony/issues#issue/13.
+
+h2. Version 1.2.7
+
+* hanke: Italian numbers are correctly normalized: Phony.normalize('+390909709511').should == '390909709511' (Zero in front of area code is not removed, closes "issue 12":https://github.com/floere/phony/issues#issue/12)
+
+h2. Version 1.2.6
+
+* hanke: Italy.
+
+h2. Version 1.2.5
+
+* hanke: Portugal. Polish landline (not mobile).
+
h2. Version 1.2.4
* hanke: Malaysia.
View
@@ -24,9 +24,11 @@
require File.expand_path '../phony/countries/malaysia', __FILE__
require File.expand_path '../phony/countries/netherlands', __FILE__
require File.expand_path '../phony/countries/peru', __FILE__
+require File.expand_path '../phony/countries/portugal', __FILE__
require File.expand_path '../phony/countries/romania', __FILE__
require File.expand_path '../phony/countries/south_korea', __FILE__
require File.expand_path '../phony/countries/sweden', __FILE__
+require File.expand_path '../phony/countries/united_kingdom', __FILE__
require File.expand_path '../phony/country_codes', __FILE__
@@ -72,17 +72,18 @@ def self.mapping
# }
),
'43' => Countries::Austria,
- '44' => fixed(2), # TODO United Kingdom of Great Britain and Northern Ireland
+ '44' => Countries::UnitedKingdom, # TODO United Kingdom of Great Britain and Northern Ireland
'45' => fixed(2, # Denmark
- :local_format => [2, 2, 2]
- ),
+ :local_format => [2, 2, 2],
+ :service_ndcs => %w{112 114}
+ ), # Denmark has no NDC, but 4 groups of 2 digits. I'm faking it here.
'46' => Countries::Sweden,
'47' => fixed(4, # Norway
:local_format => [4]
),
- '48' => fixed(2, # Poland (Republic of)
- :local_format => [1, 3, 3] # Approximation. Correct would be 48-xxx-xxx-xxx
- ),
+ '48' => fixed(3, # Poland (Republic of)
+ :local_format => [3, 3] # Although the NDCs are 2 digits, the representation is 3 digits.
+ ), # Note: http://wapedia.mobi/en/Telephone_numbers_in_Poland, mobile not yet correct
'49' => Countries::Germany,
'51' => Countries::Peru,
@@ -220,7 +221,7 @@ def self.mapping
'299' => fixed(2), # Greenland
'350' => fixed(2), # Gibraltar
- '351' => fixed(2), # Portugal
+ '351' => Countries::Portugal, # Portugal
'352' => fixed(2), # Luxembourg
'353' => fixed(2), # Ireland
'354' => fixed(2), # Iceland
@@ -3,12 +3,13 @@
# Taken from: http://en.wikipedia.org/wiki/Telephone_numbers_in_Belgium
#
Phony::Countries::Belgium = Phony::Country.configured :local_format => [3, 5],
+ :mobile_local_format => [6],
:ndc_fallback_length => 2,
:ndc_mapping => {
:landline => [
'2', # Brussels (Bruxelles/Brussel)
'3', # Antwerpen (Antwerp), Sint-Niklaas
- # '4', # Liège (Luik), Voeren (Fourons)
+ '4', # Liège (Luik), Voeren (Fourons)
'9', # Gent (Ghent/Gand)
],
:mobile => [
@@ -2,6 +2,8 @@
#
# http://en.wikipedia.org/wiki/Telephone_numbers_in_Egypt
#
+# TODO If the fallback length is 2, why do I list length 2 landlines?
+#
Phony::Countries::Egypt = Phony::Country.configured :local_format => [8],
:local_special_format => [7],
:ndc_fallback_length => 2,
@@ -13,7 +13,7 @@
:landline => [
'1'
],
- :mobile => [], # TODO
+ # TODO :mobile => [],
:service => [
'104',
'105',
@@ -4,102 +4,153 @@
#
Phony::Countries::Italy = Phony::Country.configured :local_format => [3, 4],
:local_special_format => [3, 3],
+ :normalize => false,
:ndc_fallback_length => 3,
:ndc_mapping => {
:landline => [
- '10', # Genoa
- '11', # Turin
- '122', # Sestrieres, Bardonecchia and other Susa Valley mountain resorts
- '125', # Ivrea
- '131', # Alessandria
- '141', # Asti
- '15', # Biella
- '161', # Vercelli
- '165', # Aosta, Courmayeur
- '166', # Cervinia
- '171', # Cuneo
- '185', # Tigullio
- '187', # La Spezia and Cinque Terre
- '19', # Savona
- '2', # Milan
- '30', # Brescia
- '31', # Como
- '321', # Novara
- '331', # Varese
- '341', # Lecco
- '342', # Sondrio
- '35', # Bergamo
- '369', # Mediaset Cologno Monzese and Segrate TV studios, geographical rate (used for polls, television programs, etc.)
- '376', # Mantua
- '382', # Pavia
- '39', # Monza
- '40', # Trieste
- '41', # Venice
- '425', # Rovigo
- '432', # Udine
- '444', # Vicenza
- '45', # Verona
- '461', # Trento
- '471', # Bolzano
- '481', # Gorizia
- '49', # Padua
- '50', # Pisa
- '51', # Bologna
- '521', # Parma
- '522', # Reggio nell'Emilia
- '523', # Piacenza
- '532', # Ferrara
- '536', # Sassuolo
- '541', # Rimini
- '549', # San Marino (Most Serene Republic of San Marino)
- '55', # Florence
- '573', # Pistoia
- '577', # Siena
- '586', # Livorno
- '59', # Modena
- '6', # Rome (including State of Vatican City) and Aprilia
- '70', # Cagliari
- '71', # Ancona
- '75', # Perugia
- '769', # RAI Saxa Rubra Studios, geographical rate (used for polls, television programs, etc.)
- '771', # Fondi
- '773', # Latina
- '775', # Frosinone
- '789', # Olbia and Costa Smeralda
- '79', # Sassari
- '80', # Bari
- '81', # Naples
- '823', # Caserta
- '824', # Benevento
- '825', # Avellino
- '85', # Pescara
- '865', # Isernia
- '871', # Chieti
- '872', # Lanciano
- '873', # Vasto
- '874', # Campobasso
- '875', # Termoli
- '881', # Foggia
- '89', # Salerno
- '90', # Messina
- '91', # Palermo
- '92', # Agrigento
- '95', # Catania
- '961', # Catanzaro
- '965', # Reggio di Calabria
- '971', # Potenza
- '99', # Taranto
- ],
- :mobile => [], # TODO
+ '010', # Genoa
+ '011', # Turin
+ '0122', # Sestrieres, Bardonecchia and other Susa Valley mountain resorts
+ '0125', # Ivrea
+ '0131', # Alessandria
+ '0141', # Asti
+ '015', # Biella
+ '0161', # Vercelli
+ '0165', # Aosta, Courmayeur
+ '0166', # Cervinia
+ '0171', # Cuneo
+ '0185', # Tigullio
+ '0187', # La Spezia and Cinque Terre
+ '019', # Savona
+ '02', # Milan
+ '030', # Brescia
+ '031', # Como
+ '0321', # Novara
+ '0331', # Varese
+ '0341', # Lecco
+ '0342', # Sondrio
+ '035', # Bergamo
+ '0369', # Mediaset Cologno Monzese and Segrate TV studios, geographical rate (used for polls, television programs, etc.)
+ '0376', # Mantua
+ '0382', # Pavia
+ '039', # Monza
+ '040', # Trieste
+ '041', # Venice
+ '0425', # Rovigo
+ '0432', # Udine
+ '0444', # Vicenza
+ '045', # Verona
+ '0461', # Trento
+ '0471', # Bolzano
+ '0481', # Gorizia
+ '049', # Padua
+ '050', # Pisa
+ '051', # Bologna
+ '0521', # Parma
+ '0522', # Reggio nell'Emilia
+ '0523', # Piacenza
+ '0532', # Ferrara
+ '0536', # Sassuolo
+ '0541', # Rimini
+ '0549', # San Marino (Most Serene Republic of San Marino)
+ '055', # Florence
+ '0573', # Pistoia
+ '0577', # Siena
+ '0586', # Livorno
+ '059', # Modena
+ '06', # Rome (including State of Vatican City) and Aprilia
+ '070', # Cagliari
+ '071', # Ancona
+ '075', # Perugia
+ '0769', # RAI Saxa Rubra Studios, geographical rate (used for polls, television programs, etc.)
+ '0771', # Fondi
+ '0773', # Latina
+ '0775', # Frosinone
+ '0789', # Olbia and Costa Smeralda
+ '079', # Sassari
+ '080', # Bari
+ '081', # Naples
+ '0823', # Caserta
+ '0824', # Benevento
+ '0825', # Avellino
+ '085', # Pescara
+ '0865', # Isernia
+ '0871', # Chieti
+ '0872', # Lanciano
+ '0873', # Vasto
+ '0874', # Campobasso
+ '0875', # Termoli
+ '0881', # Foggia
+ '089', # Salerno
+ '090', # Messina
+ '091', # Palermo
+ '092', # Agrigento
+ '095', # Catania
+ '0961', # Catanzaro
+ '0965', # Reggio di Calabria
+ '0971', # Potenza
+ '099', # Taranto
+ ],
+ :mobile => [
+ '310',
+ '31100',
+ '31101',
+ '31102',
+ '31103',
+ '31104',
+ '31105',
+ '313',
+ '319',
+ ('3200'..'3209').to_a,
+ '322',
+ ('3230'..'3239').to_a,
+ ('3270'..'3279').to_a,
+ ('3280'..'3289').to_a,
+ ('3290'..'3299').to_a,
+ ('3300'..'3309').to_a,
+ '331',
+ ('3330'..'3339').to_a,
+ ('3340'..'3349').to_a,
+ ('3350'..'3359').to_a,
+ ('3360'..'3369').to_a,
+ ('3370'..'3379').to_a,
+ ('3380'..'3389').to_a,
+ ('3390'..'3399').to_a,
+ ('3400'..'3409').to_a,
+ '341',
+ ('3430'..'3439').to_a,
+ '345',
+ ('3460'..'3469').to_a,
+ ('3470'..'3479').to_a,
+ ('3480'..'3489').to_a,
+ ('3490'..'3499').to_a,
+ '350',
+ ('3600'..'3609').to_a,
+ '361',
+ '362',
+ ('3630'..'3639').to_a,
+ ('3660'..'3669').to_a,
+ ('3680'..'3689').to_a,
+ '370',
+ '373',
+ '377',
+ ('3800'..'3809').to_a,
+ ('3880'..'3889').to_a,
+ ('3890'..'3899').to_a,
+ ('3900'..'3909').to_a,
+ ('3910'..'3919').to_a,
+ ('3920'..'3929').to_a,
+ ('3930'..'3939').to_a,
+ '397'
+ ].flatten,
:service => [ # Not exhaustive.
- '112',
- '113',
- '115',
- '117',
- '118',
- '878',
- '1515',
- '1518',
- '1530'
- ]
- }
+ '112',
+ '113',
+ '115',
+ '117',
+ '118',
+ '1515',
+ '1518',
+ '1530'
+ ]
+ }
@@ -3,7 +3,7 @@
# http://en.wikipedia.org/wiki/Telephone_numbers_in_Peru
#
Phony::Countries::Peru = Phony::Country.configured :local_format => [4, 4],
- :local_special_format => [3, 3],
+ :service_local_format => [3, 3],
:ndc_fallback_length => 2,
:ndc_mapping => {
:landline => [
@@ -0,0 +1,16 @@
+# Portuguese phone numbers.
+#
+# http://en.wikipedia.org/wiki/Telephone_numbers_in_Portugal
+#
+Phony::Countries::Portugal = Phony::Country.configured :local_format => [3, 4],
+ :local_special_format => [3, 3],
+ :local_mobile_format => [3, 3],
+ :ndc_fallback_length => 3,
+ :ndc_mapping => {
+ :landline => [
+ '21', # Lisboa
+ '22', # Porto
+ ],
+ :mobile => ('90'..'99').to_a,
+ :service => %w{700 800} # Not exhaustive.
+ }
@@ -4,6 +4,7 @@
#
Phony::Countries::Romania = Phony::Country.configured :local_format => [3, 4], # Also captures 3, 3 on a fallback.
:local_special_format => [3, 3],
+ :local_mobile_format => [3, 4],
:ndc_fallback_length => 3,
:ndc_mapping => {
:landline => [
Oops, something went wrong.

0 comments on commit c8173d5

Please sign in to comment.