phone_classifier 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +3 -0
- data/lib/phone_classifier/forbidden.rb +3 -0
- data/lib/phone_classifier/mobile.rb +3 -0
- data/spec/phone_classifier_spec.rb +34 -0
- metadata +1 -1
data/README.md
CHANGED
@@ -40,12 +40,15 @@ Supported Countries
|
|
40
40
|
* +49, Germany
|
41
41
|
* +60, Malaysia
|
42
42
|
* +65, Singapore
|
43
|
+
* +94, Sri Lanka
|
43
44
|
* +98, Iran
|
44
45
|
* +212, Morocco
|
45
46
|
* +213, Algeria
|
46
47
|
* +233, Ghana
|
47
48
|
* +234, Nigeria
|
49
|
+
* +248, Seychelles
|
48
50
|
* +249, Sudan
|
51
|
+
* +255, Tanzania
|
49
52
|
* +350, Gibraltar
|
50
53
|
* +351, Portugal
|
51
54
|
* +352, Luxembourg
|
@@ -23,12 +23,15 @@ module Forbidden
|
|
23
23
|
'49' => %w{ 1. 164 168 169 180 181 19[0-4] 800 900 }, # Germany
|
24
24
|
'60' => %w{ 100 101 102 103 104 108 112 991 994 995 999 }, # Malaysia
|
25
25
|
'65' => %w{ 3... 800 1800 1900 }, # Singapore
|
26
|
+
'94' => %w{ }, # Sri Lanka
|
26
27
|
'98' => %w{ 95. 96. 97. 98. 99.} , #Iran
|
27
28
|
'212' => %w{ 8. }, # Morocco
|
28
29
|
'213' => %w{ 8.. 9.. }, # Algeria
|
29
30
|
'233' => %w{ 1 4 6 7 8 9 }, # Ghana
|
30
31
|
'234' => %w{ 8.. 9.. }, # Nigeria
|
32
|
+
'248' => %w{ 5 6 7 8 9 }, # Seychelles
|
31
33
|
'249' => %w{ }, # Sudan
|
34
|
+
'255' => %w{ 8.. 9.. }, # Tanzania
|
32
35
|
'350' => %w{ 8... }, # Gibraltar
|
33
36
|
'351' => %w{ 800 80. }, # Portugal
|
34
37
|
'352' => %w{ 118 12 13 800 801 900 901 905 }, # Luxembourg
|
@@ -23,12 +23,15 @@
|
|
23
23
|
'49' => %w{ 151 152 157 159 160 162 163 17[0-9] }, # Germany
|
24
24
|
'60' => %w{ 10 11 12 13 14 153 154 156 158 16 17 18 19 }, # Malaysia
|
25
25
|
'65' => %w{ 8... 9... }, # Singapore
|
26
|
+
'94' => %w{ 71 72 75 77 78 }, # Sri Lanka
|
26
27
|
'98' => %w{ 91. 92. 93. } , #Iran
|
27
28
|
'212' => %w{ 6. }, # Morocco
|
28
29
|
'213' => %w{ 55 66 697 699 77 790 796 }, # Algeria
|
29
30
|
'233' => %w{ 20 23 24 26 27 28 50 54 57 }, # Ghana
|
30
31
|
'234' => %w{ 702[1-9] 70[3-9] 8[01][2-9] }, # Nigeria
|
32
|
+
'248' => %w{ 2 }, # Seychelles
|
31
33
|
'249' => %w{ 9. }, # Sudan
|
34
|
+
'255' => %w{ 61 65 68 7. }, # Tanzania
|
32
35
|
'350' => %w{ 5. 6. }, # Gibraltar
|
33
36
|
'351' => %w{ 9. }, # Portugal
|
34
37
|
'352' => %w{ 621 628 661 668 691 698 }, # Luxembourg
|
@@ -332,6 +332,19 @@ describe PhoneClassifier do
|
|
332
332
|
|
333
333
|
end
|
334
334
|
|
335
|
+
context "Seychelle Numbers" do
|
336
|
+
|
337
|
+
it "should set mobile numbers" do
|
338
|
+
phone_number = "248 2 12 34 56"
|
339
|
+
PhoneClassifier.new(phone_number).kind.should == :mobile
|
340
|
+
end
|
341
|
+
|
342
|
+
it "should set service numbers " do
|
343
|
+
phone_number = "248 8 12 34 56"
|
344
|
+
PhoneClassifier.new(phone_number).kind.should == :forbidden
|
345
|
+
end
|
346
|
+
end
|
347
|
+
|
335
348
|
context "Singapore Numbers" do
|
336
349
|
|
337
350
|
it "should set mobile numbers" do
|
@@ -345,6 +358,27 @@ describe PhoneClassifier do
|
|
345
358
|
end
|
346
359
|
end
|
347
360
|
|
361
|
+
context "Sri Lanka Numbers" do
|
362
|
+
|
363
|
+
it "should set mobile numbers" do
|
364
|
+
phone_number = "94 071 123 12 12"
|
365
|
+
PhoneClassifier.new(phone_number).kind.should == :mobile
|
366
|
+
end
|
367
|
+
|
368
|
+
end
|
369
|
+
|
370
|
+
context "Tanzania Numbers" do
|
371
|
+
|
372
|
+
it "should set mobile numbers" do
|
373
|
+
phone_number = "255 61 123 1234"
|
374
|
+
PhoneClassifier.new(phone_number).kind.should == :mobile
|
375
|
+
end
|
376
|
+
|
377
|
+
it "should set service numbers " do
|
378
|
+
phone_number = "255 801 23 1234"
|
379
|
+
PhoneClassifier.new(phone_number).kind.should == :forbidden
|
380
|
+
end
|
381
|
+
end
|
348
382
|
|
349
383
|
context "UK Numbers" do
|
350
384
|
|