phony 2.0.0.beta13 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/phony/countries/brazil.rb +10 -3
- data/spec/lib/phony/countries_spec.rb +19 -4
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NzVjNGJlYTgwN2Q5NzFmODAzYzY5YjUzZmVkY2FkNjc2MjRkOTQwMg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MjdjMWU2ZjBiODg2YjE2MThiNGQyZDlkODE2OGM1MGJkNjAyNTE0NA==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZTM3NDM2MGM3MjVhZmVjYjBjZTQ0YTEwNmEzYWUwMDk4NDRhNDZlNDU0NjU0
|
10
|
+
ODRjZTQ4ZTQ0YTA1NjAxMzlkODQyOTJiMzFkYTZmYWYzYmNiNGNkZWMxZmIx
|
11
|
+
MjQyYzUwNWE2MTMxNDJkZDU3MTY5MTY1MmRjZTg4ZTExOGQ1MTA=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MjY4Zjk0MjdjNWQ1NzZmNjEyMjQyMzhjY2M5YTNjZTA5MDlmMDY2NjI4MmRk
|
14
|
+
ZTY2ZjdhY2U2ZDNhZjZlMTJlMDY4NGM2OGRlMTI1ZTIzYzI1YjU5ZjdlNDVm
|
15
|
+
YmE0Njk0NGI4NDRhYTAzYmQ1ZTI0MDYzMThmYzQ1MzkyMGU1MTE=
|
@@ -5,6 +5,7 @@
|
|
5
5
|
# Note: São Paulo recently added an extra 9 digit to all mobile phones in the 11 area code
|
6
6
|
#
|
7
7
|
ndcs = [
|
8
|
+
|
8
9
|
'11', #Sao Paulo
|
9
10
|
'12', #Sao Paulo
|
10
11
|
'13', #Sao Paulo
|
@@ -94,8 +95,14 @@ ndcs = [
|
|
94
95
|
]
|
95
96
|
service = %w{ 100, 128, 190 191 192 193 194 197 198 199 } # State specific numbers were not added. See http://www.brasil.gov.br/navegue_por/aplicativos/agenda
|
96
97
|
|
98
|
+
special_numbers_3_4 = %w{ 0800 }
|
99
|
+
special_numbers_4 = %w{ 3003 4004 4020 }
|
100
|
+
|
97
101
|
Phony.define do
|
98
|
-
country '55',
|
99
|
-
one_of(
|
100
|
-
|
102
|
+
country '55', match(/^(11|12|13|14|15|16|17|18|19|21|22|24|27|28)9\d+$/) >> split(5,4) |
|
103
|
+
one_of(special_numbers_3_4) >> split(3,4) |
|
104
|
+
one_of(special_numbers_4) >> split(4) |
|
105
|
+
one_of(service) >> split(3,3) |
|
106
|
+
one_of(ndcs) >> split(4,4) |
|
107
|
+
fixed(3) >> split(4,4)
|
101
108
|
end
|
@@ -7,11 +7,11 @@ describe 'country descriptions' do
|
|
7
7
|
def self.it_splits number, expected
|
8
8
|
it { Phony.split(number).should == expected }
|
9
9
|
end
|
10
|
-
|
10
|
+
|
11
11
|
describe 'regression' do
|
12
12
|
it_splits '33630588659', ["33", "6", "30", "58", "86", "59"]
|
13
13
|
end
|
14
|
-
|
14
|
+
|
15
15
|
describe 'splitting' do
|
16
16
|
describe 'Ascension Island' do
|
17
17
|
it_splits '2473551', ['247', false, '3551']
|
@@ -102,7 +102,22 @@ describe 'country descriptions' do
|
|
102
102
|
end
|
103
103
|
describe 'Brazil' do
|
104
104
|
it_splits '551112341234', ['55', '11', '1234', '1234']
|
105
|
-
it_splits '5511981231234', ['55', '11', '
|
105
|
+
it_splits '5511981231234', ['55', '11', '98123', '1234'] # São Paulo's 9 digits mobile
|
106
|
+
it_splits '552181231234', ['55', '21', '8123', '1234']
|
107
|
+
it_splits '5521981231234', ['55', '21', '98123', '1234'] # Rio de Janeiro's 9 digits mobile
|
108
|
+
|
109
|
+
context "special states with 9 in mobile" do
|
110
|
+
%w{ 11 12 13 14 15 16 17 18 19 21 22 24 27 28}.each do |state_code|
|
111
|
+
it_splits "55#{state_code}993051123", ['55', state_code, '99305', '1123']
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
context "special numbers" do
|
116
|
+
it_splits '5508002221234', ['55', '0800', '222', '1234']
|
117
|
+
it_splits '5530032221', ['55', '3003', '2221']
|
118
|
+
it_splits '5540209999', ['55', '4020', '9999']
|
119
|
+
it_splits '5540048999', ['55', '4004', '8999']
|
120
|
+
end
|
106
121
|
end
|
107
122
|
describe 'Cambodia' do
|
108
123
|
it_splits '85512236142', ["855", "12", "236", "142"] # mobile (Mobitel)
|
@@ -273,7 +288,7 @@ describe 'country descriptions' do
|
|
273
288
|
it_splits '912212345678', ['91', '22', '123', '45', '678'] # New Delhi
|
274
289
|
it_splits '911411234567', ['91', '141', '123', '45', '67'] # Jaipur
|
275
290
|
it_splits '913525123456', ['91', '3525', '123', '456'] # DALKHOLA
|
276
|
-
it_splits '914433993939', ['91', '44', '339', '93', '939'] #
|
291
|
+
it_splits '914433993939', ['91', '44', '339', '93', '939'] #
|
277
292
|
end
|
278
293
|
|
279
294
|
describe 'Iran' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: phony
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.0
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Florian Hanke
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-11
|
11
|
+
date: 2013-12-11 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: ! 'Fast international phone number (E164 standard) normalizing, splitting
|
14
14
|
and formatting. Lots of formatting options: International (+.., 00..), national
|
@@ -100,9 +100,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
100
100
|
version: '0'
|
101
101
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
102
102
|
requirements:
|
103
|
-
- - ! '
|
103
|
+
- - ! '>='
|
104
104
|
- !ruby/object:Gem::Version
|
105
|
-
version:
|
105
|
+
version: '0'
|
106
106
|
requirements: []
|
107
107
|
rubyforge_project:
|
108
108
|
rubygems_version: 2.0.3
|