phony 2.15.13 → 2.15.14

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: 7f96bfbdf7d8396522e35eb71add389ef5a51eff
4
- data.tar.gz: bc48eaac2fda894921d48bb0ff1de85607a39355
3
+ metadata.gz: 28f5c0b5684c5f506251bad1b139cf44ac250772
4
+ data.tar.gz: 61a27e28030fb4d1dd0c2520dbbf05e18a95acc5
5
5
  SHA512:
6
- metadata.gz: c24cfe4be6e31c5ff4a37857a1528546e4d234086def93a452acdfb43d5a2bbb247f1e8967c756707387d572f306848eedb191e7d248f8744ebe27cc254f40cb
7
- data.tar.gz: 7938d62c6936874ab474eda0f0ff30596b3a8f3c833bec4cbd0ca3daf06adc6c7a2024f08ad6cebd64b3be7448b3c73f32337bb23d591c44f4cc47050467187c
6
+ metadata.gz: 16d30f1271262d00659c959eab6cb8955a6f1834eeeffce58717ed82a7df06ea395321d87259528c7533606657dcdec797c4556b6483baaa31e033903bdea075
7
+ data.tar.gz: 2df9bb504e9ebcd9739dcdf8f41892486b2ac5c0d423ce3c03076754db2a6354a41b785f91dcc81897508d8c8d31ae9fa698d91fd6d0924fb06ab1b526abbd78
data/lib/phony.rb CHANGED
@@ -48,6 +48,7 @@ require File.expand_path '../phony/countries/netherlands', __FILE__
48
48
  require File.expand_path '../phony/countries/pakistan', __FILE__
49
49
  require File.expand_path '../phony/countries/paraguay', __FILE__
50
50
  require File.expand_path '../phony/countries/russia_kazakhstan_abkhasia_south_ossetia', __FILE__
51
+ require File.expand_path '../phony/countries/saudi_arabia', __FILE__
51
52
  require File.expand_path '../phony/countries/serbia', __FILE__
52
53
  require File.expand_path '../phony/countries/somalia', __FILE__
53
54
  require File.expand_path '../phony/countries/south_korea', __FILE__
@@ -1048,14 +1048,7 @@ Phony.define do
1048
1048
  /\A8\d+\z/ => [3,3], # geographic
1049
1049
  )
1050
1050
 
1051
- # Saudi Arabia (Kingdom of)
1052
- # http://www.wtng.info/wtng-966-sa.html
1053
- # http://www.citc.gov.sa/English/MediaCenter/awarenesscampaigns/Pages/PR_AWR_004.aspx
1054
- # http://en.wikipedia.org/wiki/Telephone_numbers_in_Saudi_Arabia
1055
- # https://answers.yahoo.com/question/index?qid=20090303142622AAQBoZ0
1056
- country '966',
1057
- match(/\A(5[0-9])\d+\z/) >> split(3,4) | # mobile numbers
1058
- fixed(3) >> split(3,4)
1051
+ # country '966' # Saudi Arabia (Kingdom of), see special file.
1059
1052
 
1060
1053
  # Yemen (Republic of)
1061
1054
  # https://www.numberingplans.com/?page=dialling&sub=areacodes
@@ -0,0 +1,37 @@
1
+ # References:
2
+ # http://www.itu.int/oth/T02020000B7/en
3
+ # https://en.wikipedia.org/wiki/Telephone_numbers_in_Saudi_Arabia
4
+
5
+ ndcs_with_7_subscriber_digits = [
6
+ '11', # Riyadh & the greater central region
7
+ '12', # Western region, includes Makkah, Jeddah, Taif, Rabigh
8
+ '13', # The Eastern Province, which includes, Dammam, Khobar, Qatif, Jubail, Dhahran, Hafar Al-Batin & others
9
+ '14', # Al-Madinah, Tabuk, Al-Jawf, Yanbu, Turaif, Skaka and Northern Borders Region
10
+ '16', # Al-Qassim, Buraidah, Majma & Hail
11
+ '17', # Southern regions like Asir, Al-Baha, Jizan, Najran & Khamis Mushait
12
+ '50', # Mobile: STC
13
+ '51', # Mobile: Trunking services
14
+ '53', # Mobile: STC
15
+ '54', # Mobile: Mobily
16
+ '55', # Mobile: STC
17
+ '56', # Mobile: Mobily
18
+ '57', # Mobile
19
+ '58', # Mobile: Zain
20
+ '59', # Mobile: Zain
21
+ ]
22
+
23
+ toll_free = [
24
+ '800'
25
+ ]
26
+
27
+ universal_access = [
28
+ '9200'
29
+ ]
30
+
31
+ Phony.define do
32
+ country '966', trunk('0') |
33
+ one_of(ndcs_with_7_subscriber_digits) >> split(3,4) |
34
+ one_of(toll_free) >> split(3,4) |
35
+ one_of(universal_access) >> split(5) |
36
+ fixed(3) >> split(3,4)
37
+ end
@@ -1065,8 +1065,11 @@ describe 'country descriptions' do
1065
1065
  it_splits '3785123456789', ['378', false, '512', '345', '6789']
1066
1066
  end
1067
1067
  describe 'Saudi Arabia (Kingdom of)' do
1068
- it_splits '9660208528423', %w(966 020 852 8423)
1069
- it_splits '966506306201', %w(966 50 630 6201)
1068
+ it_splits '9660208528423', %w(966 020 852 8423) # Fixed
1069
+ it_splits '966506306201', %w(966 50 630 6201) # NDC Mobile
1070
+ it_splits '966112345678', %w(966 11 234 5678) # NDC Region
1071
+ it_splits '9668001234567', %w(966 800 123 4567) # Toll Free
1072
+ it_splits '966920012345', %w(966 9200 12345) # Univeral Access
1070
1073
  end
1071
1074
  describe 'Senegal' do
1072
1075
  it_splits '221123456789', ['221', false, '1234', '56789']
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.13
4
+ version: 2.15.14
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-01-05 00:00:00.000000000 Z
11
+ date: 2016-01-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
@@ -50,6 +50,7 @@ files:
50
50
  - lib/phony/countries/pakistan.rb
51
51
  - lib/phony/countries/paraguay.rb
52
52
  - lib/phony/countries/russia_kazakhstan_abkhasia_south_ossetia.rb
53
+ - lib/phony/countries/saudi_arabia.rb
53
54
  - lib/phony/countries/serbia.rb
54
55
  - lib/phony/countries/somalia.rb
55
56
  - lib/phony/countries/south_korea.rb