phony 2.15.26 → 2.15.27

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6dc9546f0c1ab69bacce07cf38cf9d701687cb34
4
- data.tar.gz: 2f00dad91a57781d914bcc97f8e8ae36ad0d2eba
3
+ metadata.gz: 38db83f2fb323c25ec7338913c408d05750d7ad9
4
+ data.tar.gz: f8f17fb71c57d268d08915724f40fa7669ea511d
5
5
  SHA512:
6
- metadata.gz: 9070cde0719066efe72cef2dd83c259261a1173c1e168170e1653591b71e85df320a48b8de965c8d7617a169ca2171b167984bb55d9c3ea8fbc4e7b551aa9118
7
- data.tar.gz: b019f769da0554cbbd96df850b100848491f7569ca826709a70d76177f301f98171d0031b933107c7cee018f736dd6e6a35d9320e8f9d99b8fd5ab4aede97536
6
+ metadata.gz: 82b290339b1ca372585f524ba0b034ae342371acd1ad84fac1f742ba2796c185d63f87788906b63a62b5f37b2c0fe51030f48b02730a86fa6846860460b124ca
7
+ data.tar.gz: da5b4bd8cf4d77a6f116e559027130341c59cdb3b33c9564b3375ab87149f13003e36e35207d0524e546c5d7427e45c6b9efbe6d00add850193c8b36b03a66e4
data/README.textile CHANGED
@@ -20,7 +20,7 @@ h2. Description
20
20
 
21
21
  This gem normalizes, formats and splits "*E164 phone numbers*":http://en.wikipedia.org/wiki/E.164. A valid E164 phone number *must* include a country code.
22
22
 
23
- E164 numbers are international numbers with a country dial prefix, usually an area code and a subscriber number. For example, the Austalian number number @+61 412 345 678@ can be broken down into the following components:
23
+ E164 numbers are international numbers with a country dial prefix, usually an area code and a subscriber number. For example, the Australian number @+61 412 345 678@ can be broken down into the following components:
24
24
  * Country Code (CC): a country code of @61@
25
25
  * National Destination Code (NDC): a mobile number denoted by the @4@ (specific to Australia)
26
26
  * Local Number Part: a subscriber number of @12 345 678@
@@ -10,20 +10,22 @@ ndcs = [
10
10
  '732' # Linz
11
11
  ]
12
12
 
13
+ corporate_2digit = [
14
+ '57',
15
+ '59'
16
+ ]
17
+
13
18
  corporate = [
14
- '57', # -
15
- '59', # -
16
- '501', # -
17
- '502', # -
18
- '503', # -
19
- '504', # -
20
- '505', # -
21
- '506', # -
22
- '507', # -
23
- '508', # -
24
- '509', # -
25
- '517', # -
26
- '720', #
19
+ '501',
20
+ '502',
21
+ '503',
22
+ '504',
23
+ '505',
24
+ '506',
25
+ '507',
26
+ '508',
27
+ '509',
28
+ '517'
27
29
  ]
28
30
 
29
31
  mobile = [
@@ -86,13 +88,15 @@ service = [
86
88
  # TODO Add more details.
87
89
  #
88
90
  Phony.define do
89
- country '43', trunk('0') |
90
- one_of('1') >> split(3..12) | # Vienna
91
- one_of(service) >> split(9..9) |
92
- one_of(corporate) >> split(5..5) |
93
- one_of(ndcs) >> split(6..10) |
94
- one_of('663') >> split(6..6) | # 6 digit mobile.
95
- one_of(mobile) >> split(4,3..9) |
96
- one_of(mobile_2digit) >> split(7..7) | # Separate as mobile contains 676 - 67 violates the prefix rule.
97
- fixed(4) >> split(3..9) # Number length is 7..13.
91
+ country '43', trunk('0') |
92
+ one_of('1') >> split(3..12) | # Vienna
93
+ one_of(service) >> split(9..9) |
94
+ one_of('720') >> split(6..10) | # VoIP number length is 9..13
95
+ one_of(corporate_2digit) >> split(3..11) | # Corporate number length is 5..13
96
+ one_of(corporate) >> split(2..10) | # Corporate number length is 5..13
97
+ one_of(ndcs) >> split(6..10) |
98
+ one_of('663') >> split(6..6) | # 6 digit mobile.
99
+ one_of(mobile) >> split(4,3..9) |
100
+ one_of(mobile_2digit) >> split(7..7) | # Separate as mobile contains 676 - 67 violates the prefix rule.
101
+ fixed(4) >> split(3..9) # Number length is 7..13.
98
102
  end
@@ -92,7 +92,7 @@ ndcs = /(11|12|13|14|15|16|17|18|19|21|22|24|27|28|31|32|33|34|35|36|37|38|41|42
92
92
  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
93
93
 
94
94
  special_numbers_3_4 = %w{ 0800 }
95
- special_numbers_4 = %w{ 3003 4004 4020 }
95
+ special_numbers_4 = %w{ 3003 4003 4004 4020 }
96
96
 
97
97
  Phony.define do
98
98
  country '55',
@@ -46,6 +46,7 @@ describe 'plausibility' do
46
46
  end
47
47
 
48
48
  context 'specific countries' do
49
+ it_is_correct_for 'Austria', :samples => '+43 720 116987' # VoIP
49
50
  it_is_correct_for 'Congo', :samples => '+242 1234 56789'
50
51
  it_is_correct_for 'Cook Islands', :samples => '+682 71928'
51
52
  it_is_correct_for 'Costa Rica', :samples => '+506 2 234 5678'
@@ -47,6 +47,7 @@ describe 'country descriptions' do
47
47
  it_splits '4367000000000', %w( 43 670 0000 0000 ) # Mobile
48
48
  it_splits '433161234567891', %w( 43 316 1234567891 ) # Graz
49
49
  it_splits '432164123456789', %w( 43 2164 123456789 ) # Rohrau
50
+ it_splits '43720116987', %w( 43 720 116987 ) # VoIP
50
51
 
51
52
  # mobile numbers can have from 7 to 10 digits in the subscriber number
52
53
  it_splits '436641234567', %w( 43 664 1234 567 )
@@ -149,6 +150,7 @@ describe 'country descriptions' do
149
150
  it_splits '5508002221234', ['55', '0800', '222', '1234']
150
151
  it_splits '5530032221', ['55', '3003', '2221']
151
152
  it_splits '5540209999', ['55', '4020', '9999']
153
+ it_splits '5540038999', ['55', '4003', '8999']
152
154
  it_splits '5540048999', ['55', '4004', '8999']
153
155
  end
154
156
 
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.15.26
4
+ version: 2.15.27
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Hanke
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-17 00:00:00.000000000 Z
11
+ date: 2016-07-25 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