phony 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/lib/phony.rb CHANGED
@@ -26,6 +26,7 @@ require File.expand_path '../phony/countries/germany', __FILE__
26
26
  require File.expand_path '../phony/countries/greece', __FILE__
27
27
  require File.expand_path '../phony/countries/hungary', __FILE__
28
28
  require File.expand_path '../phony/countries/italy', __FILE__
29
+ require File.expand_path '../phony/countries/netherlands', __FILE__
29
30
 
30
31
  require File.expand_path '../phony/country_codes', __FILE__
31
32
 
@@ -45,7 +45,7 @@ module Phony
45
45
  ),
46
46
 
47
47
  '30' => Countries::Greece,
48
- '31' => fixed(2), # Netherlands
48
+ '31' => Countries::Netherlands,
49
49
  '32' => fixed(1, # Belgium
50
50
  :local_format => [3, 4]
51
51
  ),
@@ -0,0 +1,57 @@
1
+ # The Netherlands use a variable-length ndc code, thus we use a separate file to not let all_other.rb explode.
2
+ #
3
+ # Note: Greece uses a variable ndc format from length 2 to 3.
4
+ # To save space, we only use ndcs of length 2 (and use the fallback of 3 to handle the rest).
5
+ #
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
+ :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 => [ # TODO Check.
43
+ '6' # Mobiele nummers en Semafoondiensten
44
+ ],
45
+ :service => [ # TODO Check.
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
+ }
@@ -8,6 +8,12 @@ describe Phony do
8
8
  it "should handle austrian numbers" do
9
9
  Phony.split('43198110').should == ['43', '1', '98110']
10
10
  end
11
+ it "should handle dutch numbers" do
12
+ Phony.split('31201234567').should == ['31', '20', '1234567']
13
+ end
14
+ it "should handle dutch mobile numbers" do
15
+ Phony.split('31612345678').should == ['31', '6', '12345678']
16
+ end
11
17
  it "should handle egyptian numbers" do
12
18
  Phony.split('20233453756').should == ['20', '2', '33453756']
13
19
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 1
8
- - 0
9
- version: 1.1.0
8
+ - 1
9
+ version: 1.1.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Florian Hanke
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-11-26 00:00:00 +01:00
17
+ date: 2010-11-29 00:00:00 +01:00
18
18
  default_executable:
19
19
  dependencies: []
20
20
 
@@ -34,6 +34,7 @@ files:
34
34
  - lib/phony/countries/greece.rb
35
35
  - lib/phony/countries/hungary.rb
36
36
  - lib/phony/countries/italy.rb
37
+ - lib/phony/countries/netherlands.rb
37
38
  - lib/phony/country.rb
38
39
  - lib/phony/country_codes.rb
39
40
  - lib/phony/local_splitter.rb