phonelib 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -48,13 +48,16 @@ Please note that passing blank value also fails.
48
48
 
49
49
  Additional options:
50
50
 
51
- validates :attribute, phone: { possible: true, allow_blank: true }
51
+ validates :attribute, phone: { possible: true, allow_blank: true, types: [:voip, :mobile] }
52
52
 
53
53
  <tt>possible: true</tt> - enables validation to check whether the passed number is a possible phone number (not strict check).
54
54
  Refer to {Google libphonenumber}[http://code.google.com/p/libphonenumber/] for more information on it.
55
55
 
56
56
  <tt>allow_blank: true</tt> - when no value passed then validation passes
57
57
 
58
+ <tt>types: :mobile</tt> or <tt>types: [:voip, :mobile]</tt> - allows to validate against specific phone types patterns,
59
+ if mixed with <tt>possible</tt> will check if number is possible for specified type
60
+
58
61
  === Basic usage
59
62
 
60
63
  To check if phone number is valid simply run:
@@ -93,8 +96,9 @@ Returned value is object of <tt>Phonelib::Phone</tt> class which have following
93
96
 
94
97
  You can also fetch matched valid phone types
95
98
 
96
- phone.types # returns array of all valid types
97
- phone.type # returns first element from array of all valid types
99
+ phone.types # returns array of all valid types
100
+ phone.type # returns first element from array of all valid types
101
+ phone.possible_types # returns array of all possible types
98
102
 
99
103
  Possible types:
100
104
  * <tt>:premium_rate</tt> - Premium Rate
@@ -134,3 +138,17 @@ Phone class has following attributes
134
138
  Gem includes data from Google libphonenumber which has regex patterns for validations.
135
139
  Valid patterns are more specific to phone type and country.
136
140
  Possible patterns as usual are patterns with number of digits in number.
141
+
142
+ === Development and tests
143
+
144
+ Everyone can do whatever he wants, the only limit is your imagination.
145
+ Just don't forget to write test before the pull request.
146
+ In order to run test without Rails functionality simply use
147
+
148
+ bundle exec rake spec
149
+
150
+ If you want to run including Rails environment, you need to set <tt>BUNDLE_GEMFILE</tt> while running the spec task, for example:
151
+
152
+ BUNDLE_GEMFILE=gemfiles/Gemfile.rails-3.2.x bundle exec rake spec
153
+
154
+ Gemfiles can be found in <tt>gemfiles</tt> folder, there are gemfiles for Rails 3.1, 3.2 and 4.
@@ -781,8 +781,8 @@
781
781
  )
782
782
  )
783
783
  </leadingDigits>
784
- <!-- We exclude here several 294X four-digit area codes: 2940, 2942, 2945, 2946 and 2948 -
785
- and several 38[3578]X four-digit area codes. -->
784
+ <!-- We exclude here several 294X four-digit area codes: 2940, 2942, 2945, 2946 and 2948,
785
+ 2983, and several 38[3578]X four-digit area codes. -->
786
786
  <leadingDigits>
787
787
  9(?:
788
788
  2(?:
@@ -792,8 +792,9 @@
792
792
  6[01346]|
793
793
  80|
794
794
  9(?:
795
- [17-9]|
796
- 4[13479]
795
+ [179]|
796
+ 4[13479]|
797
+ 8[0-24-9]
797
798
  )
798
799
  )|
799
800
  3(?:
@@ -2419,8 +2420,7 @@
2419
2420
  <mobile>
2420
2421
  <nationalNumberPattern>
2421
2422
  6(?:
2422
- [0-24-689]\d|
2423
- 3[0-7]|
2423
+ [0-689]\d|
2424
2424
  7[0-2]
2425
2425
  )\d{5}|
2426
2426
  7\d{7}
@@ -2966,9 +2966,9 @@
2966
2966
  <!-- http://en.wikipedia.org/wiki/%2B55 -->
2967
2967
  <!-- http://www.itu.int/oth/T020200001D/en -->
2968
2968
  <territory id="BR" countryCode="55"
2969
- internationalPrefix="00(?:1[45]|2[135]|[34]1|43)"
2969
+ internationalPrefix="00(?:1[45]|2[135]|31|4[13])"
2970
2970
  nationalPrefix="0"
2971
- nationalPrefixForParsing="0(?:(1[245]|2[135]|[34]1)(\d{10,11}))?"
2971
+ nationalPrefixForParsing="0(?:(1[245]|2[135]|31|4[13])(\d{10,11}))?"
2972
2972
  nationalPrefixTransformRule="$2" mobileNumberPortableRegion="true">
2973
2973
  <!-- The national prefix for parsing here also contains a capturing group for the main number,
2974
2974
  since the carrier codes here may also be area codes, so we want to check the length of
@@ -3123,6 +3123,7 @@
3123
3123
  461|
3124
3124
  502|
3125
3125
  6(?:
3126
+ 0[12]|
3126
3127
  12|
3127
3128
  7[67]|
3128
3129
  8[78]|
@@ -4102,7 +4103,7 @@
4102
4103
  <numberFormat pattern="(\d)(\d{4})(\d{4})"
4103
4104
  nationalPrefixFormattingRule="($FG)"
4104
4105
  carrierCodeFormattingRule="$CC ($FG)">
4105
- <leadingDigits>2</leadingDigits>
4106
+ <leadingDigits>22</leadingDigits>
4106
4107
  <format>$1 $2 $3</format>
4107
4108
  </numberFormat>
4108
4109
  <numberFormat pattern="(\d{2})(\d{3})(\d{4})"
@@ -4148,6 +4149,12 @@
4148
4149
  <leadingDigits>1</leadingDigits>
4149
4150
  <format>$1 $2 $3</format>
4150
4151
  </numberFormat>
4152
+ <numberFormat pattern="(\d{5})(\d{4})"
4153
+ nationalPrefixFormattingRule="($FG)"
4154
+ carrierCodeFormattingRule="$CC ($FG)">
4155
+ <leadingDigits>219</leadingDigits>
4156
+ <format>$1 $2</format>
4157
+ </numberFormat>
4151
4158
  <!-- Format some short numbers as a block. -->
4152
4159
  <numberFormat nationalPrefixFormattingRule="$FG"
4153
4160
  pattern="(\d{4,5})">
@@ -4184,8 +4191,11 @@
4184
4191
  http://www.subtel.cl/index.php?option=com_content&view=article&id=3081:&catid=3:noticias
4185
4192
  -->
4186
4193
  <nationalNumberPattern>
4194
+ 2(?:
4195
+ 2\d{7}|
4196
+ 1962\d{4}
4197
+ )|
4187
4198
  (?:
4188
- 22|
4189
4199
  3[2-5]|
4190
4200
  [47][1-35]|
4191
4201
  5[1-3578]|
@@ -4491,8 +4501,8 @@
4491
4501
  </leadingDigits>
4492
4502
  <format>$1 $2 $3</format>
4493
4503
  </numberFormat>
4494
- <numberFormat pattern="(1[3-58]\d)(\d{4})(\d{4})" carrierCodeFormattingRule="$CC $FG">
4495
- <leadingDigits>1[3-58]</leadingDigits>
4504
+ <numberFormat pattern="(\d{3})(\d{4})(\d{4})" carrierCodeFormattingRule="$CC $FG">
4505
+ <leadingDigits>1[3-578]</leadingDigits>
4496
4506
  <format>$1 $2 $3</format>
4497
4507
  </numberFormat>
4498
4508
  <numberFormat pattern="(10800)(\d{3})(\d{4})">
@@ -4644,11 +4654,13 @@
4644
4654
  <exampleNumber>1012345678</exampleNumber>
4645
4655
  </fixedLine>
4646
4656
  <mobile>
4657
+ <!-- 170, 176, 177 and 178 prefixes are introduced in early 2014 for 4G networks. -->
4647
4658
  <nationalNumberPattern>
4648
4659
  1(?:
4649
4660
  [38]\d|
4650
4661
  4[57]|
4651
- 5[0-35-9]
4662
+ 5[0-35-9]|
4663
+ 7[06-8]
4652
4664
  )\d{8}
4653
4665
  </nationalNumberPattern>
4654
4666
  <possibleNumberPattern>\d{11}</possibleNumberPattern>
@@ -4806,10 +4818,7 @@
4806
4818
  </fixedLine>
4807
4819
  <mobile>
4808
4820
  <nationalNumberPattern>
4809
- 5(?:
4810
- 0[0-4]|
4811
- 7[0-3]
4812
- )\d{5}|
4821
+ 57[0-3]\d{5}|
4813
4822
  6(?:
4814
4823
  [0-2]\d|
4815
4824
  30
@@ -5386,10 +5395,14 @@
5386
5395
  (?:
5387
5396
  18|
5388
5397
  90
5389
- )0
5398
+ )0|
5399
+ 137
5390
5400
  </leadingDigits>
5391
5401
  <leadingDigits>
5392
- 180|
5402
+ 1(?:
5403
+ 37|
5404
+ 80
5405
+ )|
5393
5406
  900[1359]
5394
5407
  </leadingDigits>
5395
5408
  <format>$1 $2 $3</format>
@@ -5420,6 +5433,10 @@
5420
5433
  <leadingDigits>700</leadingDigits>
5421
5434
  <format>$1 $2 $3</format>
5422
5435
  </numberFormat>
5436
+ <numberFormat pattern="(138)(\d{4})">
5437
+ <leadingDigits>138</leadingDigits>
5438
+ <format>$1 $2</format>
5439
+ </numberFormat>
5423
5440
  </availableFormats>
5424
5441
  <generalDesc>
5425
5442
  <!-- When deciding whether to assume a leading 49 is a country code or not, the number is
@@ -5513,7 +5530,10 @@
5513
5530
  <exampleNumber>8001234567890</exampleNumber>
5514
5531
  </tollFree>
5515
5532
  <premiumRate>
5533
+ <!-- Includes the more expensive of the "televoting" line numbers. See the shared cost
5534
+ section for more information. -->
5516
5535
  <nationalNumberPattern>
5536
+ 137[7-9]\d{6}|
5517
5537
  900(?:
5518
5538
  [135]\d{6}|
5519
5539
  9\d{7}
@@ -5523,8 +5543,23 @@
5523
5543
  <exampleNumber>9001234567</exampleNumber>
5524
5544
  </premiumRate>
5525
5545
  <sharedCost>
5526
- <nationalNumberPattern>180\d{5,11}</nationalNumberPattern>
5527
- <possibleNumberPattern>\d{8,14}</possibleNumberPattern>
5546
+ <!-- Includes some mass-traffic numbers, used for e.g. phone voting, raffles, since their
5547
+ costs when dialling from a fixed-line phone is similar.
5548
+ Prices:
5549
+ http://www.billiger-telefonieren.de/0180-0137-0900-sonderrufnummern/
5550
+ Documentation:
5551
+ http://www.bundesnetzagentur.de/SharedDocs/Downloads/DE/Sachgebiete/Telekommunikation/Unternehmen_Institutionen/Nummerierung/Rufnummern/0137/0137_Nummernplan.pdf?__blob=publicationFile&v=2
5552
+ -->
5553
+ <nationalNumberPattern>
5554
+ 1(?:
5555
+ 3(?:
5556
+ 7[1-6]\d{6}|
5557
+ 8\d{4}
5558
+ )|
5559
+ 80\d{5,11}
5560
+ )
5561
+ </nationalNumberPattern>
5562
+ <possibleNumberPattern>\d{7,14}</possibleNumberPattern>
5528
5563
  <exampleNumber>18012345</exampleNumber>
5529
5564
  </sharedCost>
5530
5565
  <personalNumber>
@@ -5644,7 +5679,8 @@
5644
5679
  2[01]|
5645
5680
  4[0-25-9]
5646
5681
  )|
5647
- 50[0-4]
5682
+ 50[0-4]|
5683
+ 70[1-3]
5648
5684
  )\d{4}
5649
5685
  </nationalNumberPattern>
5650
5686
  <exampleNumber>7674201234</exampleNumber>
@@ -6156,7 +6192,7 @@
6156
6192
  092 and with 5 and 6 for 96. -->
6157
6193
  <nationalNumberPattern>
6158
6194
  (?:
6159
- 1(
6195
+ 1(?:
6160
6196
  3[23]\d|
6161
6197
  5(?:
6162
6198
  [23]|
@@ -6905,26 +6941,38 @@
6905
6941
  <!-- Gabon -->
6906
6942
  <!-- http://www.itu.int/oth/T020200004E/en -->
6907
6943
  <!-- www.arcep.ga -->
6908
- <territory id="GA" countryCode="241" internationalPrefix="00" leadingZeroPossible="true">
6944
+ <!-- Note: We cannot set nationalPrefix="0" while fixed line numbers can start with a zero
6945
+ as this breaks parsing (it treats all leading zeros as national prefixes. -->
6946
+ <territory id="GA" countryCode="241" internationalPrefix="00" leadingZeroPossible="true" >
6909
6947
  <availableFormats>
6910
- <numberFormat pattern="(0\d)(\d{2})(\d{2})(\d{2})">
6948
+ <!-- If no leading zero was supplied, format with the national prefix. -->
6949
+ <numberFormat pattern="(\d)(\d{2})(\d{2})(\d{2})" nationalPrefixFormattingRule="0$FG">
6950
+ <leadingDigits>[2-7]</leadingDigits>
6911
6951
  <format>$1 $2 $3 $4</format>
6912
6952
  </numberFormat>
6953
+ <!-- This already has a leading zero so we format is "as is". -->
6954
+ <numberFormat pattern="(\d{2})(\d{2})(\d{2})(\d{2})">
6955
+ <leadingDigits>0</leadingDigits>
6956
+ <format>$1 $2 $3 $4</format>
6957
+ </numberFormat>
6913
6958
  </availableFormats>
6914
6959
  <generalDesc>
6915
- <nationalNumberPattern>0\d{7}</nationalNumberPattern>
6916
- <possibleNumberPattern>\d{8}</possibleNumberPattern>
6960
+ <nationalNumberPattern>0?\d{7}</nationalNumberPattern>
6961
+ <possibleNumberPattern>\d{7,8}</possibleNumberPattern>
6917
6962
  </generalDesc>
6918
6963
  <!-- A 7-digit fixed-line plan was scheduled to be implemented on June 17, 2012 to unify fixed
6919
- line and mobile numbering. However, it seems that this has not happened; their own
6920
- website now lists numbers as "+241 01 44 68 11" and upon ringing numbers they will not
6921
- connect without the 0 from outside the country. This was last tested June 2013. -->
6964
+ line and mobile numbering. However, this has only partially happened; mobile numbers can
6965
+ now be dialed without a leading zero, but fixed line numbers still require it. Their own
6966
+ website still lists fixed line numbers as "+241 01 44 68 11" and upon ringing they will
6967
+ not connect from outside the country without the 0. This was last tested March 2014. -->
6922
6968
  <fixedLine>
6923
6969
  <nationalNumberPattern>01\d{6}</nationalNumberPattern>
6970
+ <possibleNumberPattern>\d{8}</possibleNumberPattern>
6924
6971
  <exampleNumber>01441234</exampleNumber>
6925
6972
  </fixedLine>
6926
6973
  <mobile>
6927
- <nationalNumberPattern>0[2-7]\d{6}</nationalNumberPattern>
6974
+ <!-- Mobile numbers can be 7 or 8 digits (with or without a leading zero). -->
6975
+ <nationalNumberPattern>0?[2-7]\d{6}</nationalNumberPattern>
6928
6976
  <exampleNumber>06031234</exampleNumber>
6929
6977
  </mobile>
6930
6978
  </territory>
@@ -7552,6 +7600,7 @@
7552
7600
  58|
7553
7601
  84
7554
7602
  )|
7603
+ 800|
7555
7604
  938
7556
7605
  )\d{4}
7557
7606
  </nationalNumberPattern>
@@ -7561,7 +7610,7 @@
7561
7610
  <nationalNumberPattern>
7562
7611
  473(?:
7563
7612
  4(?:
7564
- 0[3-79]|
7613
+ 0[2-79]|
7565
7614
  1[04-9]|
7566
7615
  20|
7567
7616
  58
@@ -7569,7 +7618,8 @@
7569
7618
  5(?:
7570
7619
  2[01]|
7571
7620
  3[3-8]
7572
- )
7621
+ )|
7622
+ 901
7573
7623
  )\d{4}
7574
7624
  </nationalNumberPattern>
7575
7625
  <possibleNumberPattern>\d{10}</possibleNumberPattern>
@@ -7917,9 +7967,12 @@
7917
7967
  <mobile>
7918
7968
  <nationalNumberPattern>
7919
7969
  (?:
7920
- 2[034678]|
7921
- 5[047]
7922
- )\d{7}
7970
+ 2[034678]\d|
7971
+ 5(?:
7972
+ [047]\d|
7973
+ 54
7974
+ )
7975
+ )\d{6}
7923
7976
  </nationalNumberPattern>
7924
7977
  <possibleNumberPattern>\d{9}</possibleNumberPattern>
7925
7978
  <exampleNumber>231234567</exampleNumber>
@@ -8977,6 +9030,11 @@
8977
9030
  <nationalNumberPattern>[1-9]\d{7,8}</nationalNumberPattern>
8978
9031
  <possibleNumberPattern>\d{6,9}</possibleNumberPattern>
8979
9032
  </generalDesc>
9033
+ <noInternationalDialling>
9034
+ <nationalNumberPattern>[48]0\d{6}</nationalNumberPattern>
9035
+ <possibleNumberPattern>\d{8}</possibleNumberPattern>
9036
+ <exampleNumber>80123456</exampleNumber>
9037
+ </noInternationalDialling>
8980
9038
  <fixedLine>
8981
9039
  <!-- Includes numbers for corporate networks. -->
8982
9040
  <nationalNumberPattern>
@@ -9034,7 +9092,7 @@
9034
9092
  nationalPrefix="0" nationalPrefixFormattingRule="$NP$FG">
9035
9093
  <availableFormats>
9036
9094
  <numberFormat nationalPrefixFormattingRule="($NP$FG)"
9037
- pattern="(\d{2})(\d{7,8})">
9095
+ pattern="(\d{2})(\d{5,8})">
9038
9096
  <leadingDigits>
9039
9097
  2[124]|
9040
9098
  [36]1
@@ -9064,8 +9122,8 @@
9064
9122
  <leadingDigits>800</leadingDigits>
9065
9123
  <format>$1 $2</format>
9066
9124
  </numberFormat>
9067
- <numberFormat pattern="(809)(\d)(\d{3})(\d{3})">
9068
- <leadingDigits>809</leadingDigits>
9125
+ <numberFormat pattern="(80\d)(\d)(\d{3})(\d{3})">
9126
+ <leadingDigits>80[79]</leadingDigits>
9069
9127
  <format>$1 $2 $3 $4</format>
9070
9128
  </numberFormat>
9071
9129
  </availableFormats>
@@ -9078,10 +9136,15 @@
9078
9136
  http://www.telkom.co.id/customer-services/area-and-country-code/?type=area.
9079
9137
  We also added 0770 after user feedback because it seems to be used on Bintan island.
9080
9138
  Where known, fixed mobile prefixes have been represented as Mobile. -->
9139
+ <!-- Very short (5/6 digit) local numbers in Jakarta seem to be special cases for various
9140
+ well known companies (Mc Donalds, KFC etc...). Some of these are listed in:
9141
+ http://cms.binus.edu/datapage/file/io/Spring2014SE/International_Student_Handbook_BINUS.pdf -->
9081
9142
  <nationalNumberPattern>
9082
9143
  2(?:
9083
9144
  1(?:
9145
+ 14\d{3}|
9084
9146
  [0-8]\d{6,7}|
9147
+ 500\d{3}|
9085
9148
  9\d{6}
9086
9149
  )|
9087
9150
  [24]\d{7,8}
@@ -9243,6 +9306,16 @@
9243
9306
  <possibleNumberPattern>\d{8,11}</possibleNumberPattern>
9244
9307
  <exampleNumber>8001234567</exampleNumber>
9245
9308
  </tollFree>
9309
+ <uan>
9310
+ <nationalNumberPattern>8071\d{6}</nationalNumberPattern>
9311
+ <possibleNumberPattern>\d{10}</possibleNumberPattern>
9312
+ <exampleNumber>8071123456</exampleNumber>
9313
+ </uan>
9314
+ <noInternationalDialling>
9315
+ <nationalNumberPattern>8071\d{6}</nationalNumberPattern>
9316
+ <possibleNumberPattern>\d{10}</possibleNumberPattern>
9317
+ <exampleNumber>8071123456</exampleNumber>
9318
+ </noInternationalDialling>
9246
9319
  <!-- The information below is provided by an Indonesian -->
9247
9320
  <premiumRate>
9248
9321
  <nationalNumberPattern>809\d{7}</nationalNumberPattern>
@@ -9564,7 +9637,7 @@
9564
9637
  47\d|
9565
9638
  6(?:
9566
9639
  5\d|
9567
- 8[08]
9640
+ 8[068]
9568
9641
  )|
9569
9642
  7\d{2}|
9570
9643
  8(?:
@@ -9697,6 +9770,7 @@
9697
9770
  <numberFormat pattern="(\d{2})(\d{2})(\d{6})">
9698
9771
  <leadingDigits>
9699
9772
  7(?:
9773
+ 0[2-4]|
9700
9774
  2[0579]|
9701
9775
  3[057-9]|
9702
9776
  4[0-389]|
@@ -9719,6 +9793,11 @@
9719
9793
  </leadingDigits>
9720
9794
  <leadingDigits>
9721
9795
  7(?:
9796
+ 0(?:
9797
+ 2[2-9]|
9798
+ 3|
9799
+ 4[0-7]
9800
+ )|
9722
9801
  2(?:
9723
9802
  0[04-9]|
9724
9803
  5[09]|
@@ -10183,6 +10262,11 @@
10183
10262
  <nationalNumberPattern>
10184
10263
  (?:
10185
10264
  7(?:
10265
+ 0(?:
10266
+ 2[2-9]|
10267
+ 3\d|
10268
+ 4[0-7]
10269
+ )|
10186
10270
  2(?:
10187
10271
  0[04-9]|
10188
10272
  5[09]|
@@ -12567,7 +12651,8 @@
12567
12651
  started issuing fixed-line numbers like this. Apparently, mobile-company-issued
12568
12652
  fixed-line numbers are one digit longer than government-issued numbers. Moreover, the
12569
12653
  range beginning with 6 seems to include some numbers that are one digit longer as well.
12570
- Allowing 238\d{6} based on information from Cambodia Yellow Pages. -->
12654
+ Allowing 238\d{6} and 234[234]\d{4} based on information from Cambodia Yellow Pages.
12655
+ Note that numbers beginning with 234 are split across two patterns. -->
12571
12656
  <nationalNumberPattern>
12572
12657
  (?:
12573
12658
  2[3-6]|
@@ -12580,7 +12665,10 @@
12580
12665
  5\d|
12581
12666
  6\d?
12582
12667
  )\d{5}|
12583
- 238\d{6}
12668
+ 23(?:
12669
+ 4[234]|
12670
+ 8\d{2}
12671
+ )\d{4}
12584
12672
  </nationalNumberPattern>
12585
12673
  <possibleNumberPattern>\d{6,9}</possibleNumberPattern>
12586
12674
  <exampleNumber>23756789</exampleNumber>
@@ -12652,7 +12740,8 @@
12652
12740
  <!-- Numbers should be formatted as a block." -->
12653
12741
  <generalDesc>
12654
12742
  <nationalNumberPattern>
12655
- [2-58]\d{4}|
12743
+ [2458]\d{4}|
12744
+ 3\d{4,7}|
12656
12745
  7\d{7}
12657
12746
  </nationalNumberPattern>
12658
12747
  <possibleNumberPattern>\d{5,8}</possibleNumberPattern>
@@ -12682,6 +12771,11 @@
12682
12771
  <possibleNumberPattern>\d{8}</possibleNumberPattern>
12683
12772
  <exampleNumber>72012345</exampleNumber>
12684
12773
  </mobile>
12774
+ <premiumRate>
12775
+ <!-- ITU refers to these as "Telemedia and audiotext". -->
12776
+ <nationalNumberPattern>3001\d{4}</nationalNumberPattern>
12777
+ <exampleNumber>30010000</exampleNumber>
12778
+ </premiumRate>
12685
12779
  </territory>
12686
12780
 
12687
12781
  <!-- Comoros -->
@@ -12744,7 +12838,7 @@
12744
12838
  )|
12745
12839
  302|
12746
12840
  4(?:
12747
- 6[5-9]|
12841
+ 6[015-9]|
12748
12842
  70
12749
12843
  )
12750
12844
  )\d{4}
@@ -12764,7 +12858,8 @@
12764
12858
  )\d{4}
12765
12859
  </nationalNumberPattern>
12766
12860
  <possibleNumberPattern>\d{10}</possibleNumberPattern>
12767
- <exampleNumber>8695561234</exampleNumber>
12861
+ <!-- Example number from the ITU document. -->
12862
+ <exampleNumber>8697652917</exampleNumber>
12768
12863
  </mobile>
12769
12864
  <tollFree>
12770
12865
  <nationalNumberPattern>
@@ -13421,25 +13516,36 @@
13421
13516
  <numberFormat pattern="([2-8]\d)(\d{3})(\d{3})">
13422
13517
  <leadingDigits>
13423
13518
  2[13]|
13424
- [3-8]
13519
+ 3[14]|
13520
+ [4-8]
13425
13521
  </leadingDigits>
13426
13522
  <format>$1 $2 $3</format>
13427
13523
  </numberFormat>
13524
+ <numberFormat pattern="(30)(\d{2})(\d{2})(\d{3})">
13525
+ <leadingDigits>30</leadingDigits>
13526
+ <format>$1 $2 $3 $4</format>
13527
+ </numberFormat>
13428
13528
  </availableFormats>
13429
13529
  <generalDesc>
13430
13530
  <nationalNumberPattern>[2-8]\d{7,9}</nationalNumberPattern>
13431
13531
  <possibleNumberPattern>\d{6,10}</possibleNumberPattern>
13432
13532
  </generalDesc>
13433
13533
  <fixedLine>
13534
+ <!-- The Lonely Planet says that newer WIN phones (fixed phones without a physical landline)
13535
+ start with 030 (and are longer). There are plenty of examples online. -->
13434
13536
  <nationalNumberPattern>
13435
13537
  (?:
13436
13538
  2[13]|
13437
- [35-7][14]|
13539
+ 3(?:
13540
+ 0\d|
13541
+ [14]
13542
+ )|
13543
+ [5-7][14]|
13438
13544
  41|
13439
13545
  8[1468]
13440
13546
  )\d{6}
13441
13547
  </nationalNumberPattern>
13442
- <possibleNumberPattern>\d{6,8}</possibleNumberPattern>
13548
+ <possibleNumberPattern>\d{6,9}</possibleNumberPattern>
13443
13549
  <exampleNumber>21212862</exampleNumber>
13444
13550
  </fixedLine>
13445
13551
  <mobile>
@@ -13545,26 +13651,22 @@
13545
13651
  <possibleNumberPattern>\d{7}(?:\d{3})?</possibleNumberPattern>
13546
13652
  </generalDesc>
13547
13653
  <fixedLine>
13548
- <!-- Adding 430 and 572 since numbers have been found with these prefixes online. -->
13654
+ <!-- Adding 430 since numbers have been found with these prefixes online. -->
13549
13655
  <nationalNumberPattern>
13550
13656
  758(?:
13551
- 234|
13552
13657
  4(?:
13553
13658
  30|
13554
13659
  5[0-9]|
13555
13660
  6[2-9]|
13556
13661
  8[0-2]
13557
13662
  )|
13558
- 572|
13559
- 638|
13560
- 758
13663
+ 57[0-2]|
13664
+ 638
13561
13665
  )\d{4}
13562
13666
  </nationalNumberPattern>
13563
- <exampleNumber>7582345678</exampleNumber>
13667
+ <exampleNumber>7584305678</exampleNumber>
13564
13668
  </fixedLine>
13565
13669
  <mobile>
13566
- <!-- Adding 72[1256] as these prefixes are found widely on the internet and SMS messages
13567
- have been successfully delivered to these numbers. -->
13568
13670
  <nationalNumberPattern>
13569
13671
  758(?:
13570
13672
  28[4-7]|
@@ -13580,7 +13682,7 @@
13580
13682
  )|
13581
13683
  7(?:
13582
13684
  1[2-9]|
13583
- 2[0-6]
13685
+ 2[0-8]
13584
13686
  )
13585
13687
  )\d{4}
13586
13688
  </nationalNumberPattern>
@@ -13815,12 +13917,12 @@
13815
13917
  <availableFormats>
13816
13918
  <!-- Formatting from Ministry of Agriculture,
13817
13919
  http://www.moa.gov.lr/content.php?sub=Email&?related=Contacts -->
13818
- <numberFormat pattern="([279]\d)(\d{3})(\d{3})">
13819
- <leadingDigits>[279]</leadingDigits>
13920
+ <numberFormat pattern="(2\d)(\d{3})(\d{3})">
13921
+ <leadingDigits>2</leadingDigits>
13820
13922
  <format>$1 $2 $3</format>
13821
13923
  </numberFormat>
13822
- <numberFormat pattern="(7\d{2})(\d{3})(\d{3})">
13823
- <leadingDigits>7</leadingDigits>
13924
+ <numberFormat pattern="([79]\d{2})(\d{3})(\d{3})">
13925
+ <leadingDigits>[79]</leadingDigits>
13824
13926
  <format>$1 $2 $3</format>
13825
13927
  </numberFormat>
13826
13928
  <numberFormat pattern="([4-6])(\d{3})(\d{3})">
@@ -13834,12 +13936,9 @@
13834
13936
  </availableFormats>
13835
13937
  <generalDesc>
13836
13938
  <nationalNumberPattern>
13837
- (?:
13838
- [29]\d|
13839
- [4-6]|
13840
- 7\d{1,2}|
13841
- [38]\d{2}
13842
- )\d{6}
13939
+ 2\d{7}|
13940
+ [37-9]\d{8}|
13941
+ [45]\d{6}
13843
13942
  </nationalNumberPattern>
13844
13943
  <possibleNumberPattern>\d{7,9}</possibleNumberPattern>
13845
13944
  </generalDesc>
@@ -13849,34 +13948,38 @@
13849
13948
  <exampleNumber>21234567</exampleNumber>
13850
13949
  </fixedLine>
13851
13950
  <mobile>
13852
- <!-- According to information from Lonestar Communications Corporation, the prefix 6 is
13853
- being removed, but as of June 2012 is in parallel running with their new prefix 88.
13854
- According to Cellcom Liberia, they have issued 9 digit numbers starting with 77. -->
13951
+ <!-- West Africa Telecom seems to be a mobile company from their website. Adding Atlantic
13952
+ Wireless from the document, even though from online news reports it is not clear they
13953
+ are still operating. -->
13855
13954
  <nationalNumberPattern>
13856
13955
  (?:
13956
+ 330\d|
13857
13957
  4[67]|
13858
13958
  5\d|
13859
- 6[4-8]|
13860
- 77?\d{2}|
13861
- 88\d{2}
13959
+ 77\d{2}|
13960
+ 88\d{2}|
13961
+ 994\d
13862
13962
  )\d{5}
13863
13963
  </nationalNumberPattern>
13864
- <exampleNumber>4612345</exampleNumber>
13964
+ <exampleNumber>770123456</exampleNumber>
13865
13965
  </mobile>
13866
13966
  <premiumRate>
13867
- <!-- Telemedia service is listed under premium rate. -->
13868
- <!-- Note that as of March 2013, the ITU document talks about the withdrawal of the range
13869
- (90) 0 XXX XXX. This is a 9 digit range and one we have never supported, but this could
13870
- be a mistake in the ITU document and refer to (90) 0XX XXX. However as this is unclear
13871
- at the moment, we decided to leave the (90) range unchanged for now. -->
13872
- <nationalNumberPattern>90\d{6}</nationalNumberPattern>
13873
- <possibleNumberPattern>\d{8}</possibleNumberPattern>
13874
- <exampleNumber>90123456</exampleNumber>
13967
+ <!-- Telelinks and Interactive media service are listed under premium rate. -->
13968
+ <nationalNumberPattern>90[03]\d{6}</nationalNumberPattern>
13969
+ <possibleNumberPattern>\d{9}</possibleNumberPattern>
13970
+ <exampleNumber>900123456</exampleNumber>
13875
13971
  </premiumRate>
13876
13972
  <voip>
13877
13973
  <!-- The plan lists the following range as being assigned to TEMAS. On their homepage they
13878
- say they are involved in the VoIP sector. -->
13879
- <nationalNumberPattern>33200\d{4}</nationalNumberPattern>
13974
+ say they are involved in the VoIP sector. Adding WASSCOM and Atlantic Realty &
13975
+ Investment Corporation here as well; no numbers can be found online, nor company
13976
+ information. -->
13977
+ <nationalNumberPattern>
13978
+ 332(?:
13979
+ 0[02]|
13980
+ 5\d
13981
+ )\d{4}
13982
+ </nationalNumberPattern>
13880
13983
  <possibleNumberPattern>\d{9}</possibleNumberPattern>
13881
13984
  <exampleNumber>332001234</exampleNumber>
13882
13985
  </voip>
@@ -15623,7 +15726,7 @@
15623
15726
  [013568]\d|
15624
15727
  2[4-7]
15625
15728
  )|
15626
- 5(
15729
+ 5(?:
15627
15730
  44\d|
15628
15731
  471
15629
15732
  )|
@@ -16129,7 +16232,7 @@
16129
16232
  <numberFormat pattern="([28]\d)(\d{3})(\d{3,4})">
16130
16233
  <leadingDigits>
16131
16234
  2|
16132
- 8[246]
16235
+ 8[2-7]
16133
16236
  </leadingDigits>
16134
16237
  <format>$1 $2 $3</format>
16135
16238
  </numberFormat>
@@ -16155,7 +16258,7 @@
16155
16258
  <exampleNumber>21123456</exampleNumber>
16156
16259
  </fixedLine>
16157
16260
  <mobile>
16158
- <nationalNumberPattern>8[246]\d{7}</nationalNumberPattern>
16261
+ <nationalNumberPattern>8[23467]\d{7}</nationalNumberPattern>
16159
16262
  <possibleNumberPattern>\d{9}</possibleNumberPattern>
16160
16263
  <exampleNumber>821234567</exampleNumber>
16161
16264
  </mobile>
@@ -16309,7 +16412,7 @@
16309
16412
  <voip>
16310
16413
  <!-- Including virtual telephone and VOIP services. -->
16311
16414
  <nationalNumberPattern>
16312
- 8(
16415
+ 8(?:
16313
16416
  3\d{2}|
16314
16417
  86
16315
16418
  )\d{5}
@@ -16412,12 +16515,12 @@
16412
16515
  <exampleNumber>20201234</exampleNumber>
16413
16516
  </fixedLine>
16414
16517
  <mobile>
16415
- <!-- Added 90, 91, 92, 97, 98 & 99 from online data. Airtel have confirmed that they use the
16416
- 89 and 97 prefixes, and Orange use 92. -->
16518
+ <!-- Added 90, 91, 92, 95, 97, 98 & 99 from online data. Airtel have confirmed that they use the
16519
+ 89 and 97 prefixes, and Orange use 92. MOOV started using 95 in Jan 2014. -->
16417
16520
  <nationalNumberPattern>
16418
16521
  (?:
16419
16522
  89|
16420
- 9[0-46-9]
16523
+ 9\d
16421
16524
  )\d{6}
16422
16525
  </nationalNumberPattern>
16423
16526
  <exampleNumber>93123456</exampleNumber>
@@ -17499,8 +17602,7 @@
17499
17602
  <mobile>
17500
17603
  <nationalNumberPattern>
17501
17604
  (?:
17502
- [27]\d{2}|
17503
- 3[0-79]\d|
17605
+ [237]\d{2}|
17504
17606
  411|
17505
17607
  89\d{3}
17506
17608
  )\d{3}
@@ -18071,17 +18173,9 @@
18071
18173
  </leadingDigits>
18072
18174
  <format>$1 $2 $3 $4</format>
18073
18175
  </numberFormat>
18074
- <numberFormat pattern="(\d{2})(\d{4,6})">
18075
- <!-- Pattern for shorter fixed-line numbers. -->
18076
- <leadingDigits>
18077
- [124]|
18078
- 3[2-4]|
18079
- 5[24-689]|
18080
- 6[1-3578]|
18081
- 7[14-7]|
18082
- 8[1-7]
18083
- </leadingDigits>
18084
- <format>$1 $2</format>
18176
+ <numberFormat pattern="(\d{2})(\d{1})(\d{4})">
18177
+ <leadingDigits>[12]2</leadingDigits>
18178
+ <format>$1 $2 $3</format>
18085
18179
  </numberFormat>
18086
18180
  <!-- We are formatting 70 numbers as per mobile numbers, based on information from some
18087
18181
  Poles that this is more usual. -->
@@ -18107,14 +18201,16 @@
18107
18201
  </availableFormats>
18108
18202
  <generalDesc>
18109
18203
  <nationalNumberPattern>
18110
- [1-58]\d{6,8}|
18111
- 9\d{8}|
18112
- [67]\d{5,8}
18204
+ [12]\d{6,8}|
18205
+ [3-57-9]\d{8}|
18206
+ 6\d{5,8}
18113
18207
  </nationalNumberPattern>
18114
18208
  <possibleNumberPattern>\d{6,9}</possibleNumberPattern>
18115
18209
  </generalDesc>
18116
18210
  <fixedLine>
18117
- <!-- Grouped by prefix-length. -->
18211
+ <!-- The plan says all geographical numbers are 9 digits; but in at least Warsaw (22) and
18212
+ Krakow (12) we have found internationally diallable numbers that are 7 digits instead,
18213
+ so we support those too. -->
18118
18214
  <nationalNumberPattern>
18119
18215
  (?:
18120
18216
  1[2-8]|
@@ -18123,14 +18219,11 @@
18123
18219
  4[1-468]|
18124
18220
  5[24-689]|
18125
18221
  6[1-3578]|
18126
- 7[14-6]|
18127
- 8[1-7]
18128
- )\d{5,7}|
18129
- 77\d{4,7}|
18130
- (?:
18131
- 89|
18222
+ 7[14-7]|
18223
+ 8[1-79]|
18132
18224
  9[145]
18133
- )\d{7}
18225
+ )\d{7}|
18226
+ [12]2\d{5}
18134
18227
  </nationalNumberPattern>
18135
18228
  <exampleNumber>123456789</exampleNumber>
18136
18229
  </fixedLine>
@@ -18147,8 +18240,8 @@
18147
18240
  <exampleNumber>512345678</exampleNumber>
18148
18241
  </mobile>
18149
18242
  <pager>
18150
- <nationalNumberPattern>642\d{3,6}</nationalNumberPattern>
18151
- <exampleNumber>642123456</exampleNumber>
18243
+ <nationalNumberPattern>64\d{4,7}</nationalNumberPattern>
18244
+ <exampleNumber>641234567</exampleNumber>
18152
18245
  </pager>
18153
18246
  <tollFree>
18154
18247
  <nationalNumberPattern>800\d{6}</nationalNumberPattern>
@@ -20778,9 +20871,11 @@
20778
20871
  <exampleNumber>1100</exampleNumber>
20779
20872
  </noInternationalDialling>
20780
20873
  <fixedLine>
20874
+ <!-- Numbers online have been found that start with 20, despite the ITU doc not covering
20875
+ these. -->
20781
20876
  <nationalNumberPattern>
20782
20877
  (?:
20783
- 2[1-9]|
20878
+ 2\d|
20784
20879
  3[2-9]|
20785
20880
  4[2-5]|
20786
20881
  5[2-6]|
@@ -20808,8 +20903,8 @@
20808
20903
  </premiumRate>
20809
20904
  <voip>
20810
20905
  <!-- The ITU document says that the 89 prefix is also VOIP but there are lots of numbers
20811
- online to suggest they are actually used as mobile numbers -->
20812
- <nationalNumberPattern>60\d{7}</nationalNumberPattern>
20906
+ online to suggest they are actually used as mobile numbers. -->
20907
+ <nationalNumberPattern>6[08]\d{7}</nationalNumberPattern>
20813
20908
  <possibleNumberPattern>\d{9}</possibleNumberPattern>
20814
20909
  <exampleNumber>601234567</exampleNumber>
20815
20910
  </voip>
@@ -21407,8 +21502,8 @@
21407
21502
  <availableFormats>
21408
21503
  <numberFormat pattern="([2-8])(\d{3,4})(\d{4})">
21409
21504
  <leadingDigits>
21410
- [2-7]|
21411
- 8[1-9]
21505
+ [2-6]|
21506
+ [78][1-9]
21412
21507
  </leadingDigits>
21413
21508
  <format>$1 $2 $3</format>
21414
21509
  </numberFormat>
@@ -21419,10 +21514,17 @@
21419
21514
  </leadingDigits>
21420
21515
  <format>$1 $2 $3</format>
21421
21516
  </numberFormat>
21517
+ <numberFormat pattern="(70)(\d{4})(\d{4})">
21518
+ <leadingDigits>70</leadingDigits>
21519
+ <format>$1 $2 $3</format>
21520
+ </numberFormat>
21422
21521
  </availableFormats>
21423
21522
  <generalDesc>
21424
- <nationalNumberPattern>[2-9]\d{7,8}</nationalNumberPattern>
21425
- <possibleNumberPattern>\d{8,9}</possibleNumberPattern>
21523
+ <nationalNumberPattern>
21524
+ [2-689]\d{7,8}|
21525
+ 7\d{7,9}
21526
+ </nationalNumberPattern>
21527
+ <possibleNumberPattern>\d{8,10}</possibleNumberPattern>
21426
21528
  </generalDesc>
21427
21529
  <fixedLine>
21428
21530
  <nationalNumberPattern>[2-8]\d{7,8}</nationalNumberPattern>
@@ -21444,6 +21546,12 @@
21444
21546
  <possibleNumberPattern>\d{9}</possibleNumberPattern>
21445
21547
  <exampleNumber>900123456</exampleNumber>
21446
21548
  </premiumRate>
21549
+ <!-- http://www.chief.com.tw/telecom_eng/front/bin/ptlist.phtml?Category=107 -->
21550
+ <voip>
21551
+ <nationalNumberPattern>70\d{8}</nationalNumberPattern>
21552
+ <possibleNumberPattern>\d{10}</possibleNumberPattern>
21553
+ <exampleNumber>7012345678</exampleNumber>
21554
+ </voip>
21447
21555
  </territory>
21448
21556
 
21449
21557
  <!-- Tanzania -->
@@ -22266,7 +22374,7 @@
22266
22374
  7[079]
22267
22375
  )
22268
22376
  )|
22269
- 9(
22377
+ 9(?:
22270
22378
  2(?:
22271
22379
  1[1267]|
22272
22380
  5\d|
@@ -22448,8 +22556,8 @@
22448
22556
  <mobile>
22449
22557
  <!-- We have no information on mobile numbers from the Vatican. It is probable that they use
22450
22558
  Italian mobile contracts. -->
22451
- <nationalNumberPattern>N/A</nationalNumberPattern>
22452
- <possibleNumberPattern>N/A</possibleNumberPattern>
22559
+ <nationalNumberPattern>NA</nationalNumberPattern>
22560
+ <possibleNumberPattern>NA</possibleNumberPattern>
22453
22561
  </mobile>
22454
22562
  <!-- No information exists about other types of numbers. -->
22455
22563
  </territory>
@@ -22463,6 +22571,8 @@
22463
22571
  <nationalNumberPattern>[5789]\d{9}</nationalNumberPattern>
22464
22572
  <possibleNumberPattern>\d{7}(?:\d{3})?</possibleNumberPattern>
22465
22573
  </generalDesc>
22574
+ <!-- For 570, 571 and 572 prefixes, we believe the ITU doc incorrectly listed them to be under
22575
+ area code 758, which should be 784. -->
22466
22576
  <fixedLine>
22467
22577
  <nationalNumberPattern>
22468
22578
  784(?:
@@ -22475,10 +22585,13 @@
22475
22585
  4(?:
22476
22586
  38|
22477
22587
  5[0-36-8]|
22478
- 8\d|
22479
- 9[01]
22588
+ 8[0-8]
22589
+ )|
22590
+ 5(?:
22591
+ 55|
22592
+ 7[0-2]|
22593
+ 93
22480
22594
  )|
22481
- 555|
22482
22595
  638|
22483
22596
  784
22484
22597
  )\d{4}
@@ -22486,19 +22599,17 @@
22486
22599
  <exampleNumber>7842661234</exampleNumber>
22487
22600
  </fixedLine>
22488
22601
  <mobile>
22489
- <!-- Adding 784 433 and 784 534 since online numbers can be found with these prefixes, and
22490
- the latter seems, according to some online sources, to be assigned to Digicell. -->
22491
22602
  <nationalNumberPattern>
22492
22603
  784(?:
22493
22604
  4(?:
22494
22605
  3[0-4]|
22495
22606
  5[45]|
22496
- 9[2-5]
22607
+ 89|
22608
+ 9[0-5]
22497
22609
  )|
22498
22610
  5(?:
22499
22611
  2[6-9]|
22500
- 3[0-4]|
22501
- 93
22612
+ 3[0-4]
22502
22613
  )
22503
22614
  )\d{4}
22504
22615
  </nationalNumberPattern>
data/data/phone_data.dat CHANGED
Binary file
data/lib/phonelib/core.rb CHANGED
@@ -143,7 +143,7 @@ module Phonelib
143
143
  # Load data file into memory
144
144
  def load_data
145
145
  data_file = File.dirname(__FILE__) + '/../../data/phone_data.dat'
146
- Marshal.load(File.read(data_file))
146
+ Marshal.load(File.binread(data_file))
147
147
  end
148
148
  end
149
149
  end
@@ -37,6 +37,11 @@ module Phonelib
37
37
  @data.flat_map { |iso2, data| data[:valid] }.uniq
38
38
  end
39
39
 
40
+ # Returns all possible types that matched possible patterns
41
+ def possible_types
42
+ @data.flat_map { |iso2, data| data[:possible] }.uniq
43
+ end
44
+
40
45
  # Returns first phone type that matched
41
46
  def type
42
47
  types.first
@@ -17,7 +17,7 @@ module Phonelib
17
17
 
18
18
  result = try_to_parse_single_country(phone, country)
19
19
  # if previous parsing failed, trying for all countries
20
- if result.nil? || result.values.first[:valid].empty?
20
+ if result.nil? || result.empty? || result.values.first[:valid].empty?
21
21
  result = detect_and_parse phone
22
22
  end
23
23
  result
@@ -1,5 +1,5 @@
1
1
  # :nodoc:
2
2
  module Phonelib
3
3
  # :nodoc:
4
- VERSION = '0.3.0'
4
+ VERSION = '0.3.1'
5
5
  end
@@ -25,16 +25,43 @@
25
25
  # attr_accessible :number
26
26
  # validates :number, phone: { allow_blank: true }
27
27
  # end
28
+ #
29
+ # Validates that attribute is a valid phone number of specified type(s).
30
+ # It is also possible to check that attribute is a possible number of specified
31
+ # type(s). Symbol or array accepted.
32
+ #
33
+ # class Phone < ActiveRecord::Base
34
+ # attr_accessible :number, :mobile
35
+ # validates :number, phone: { types: [:mobile, :fixed], allow_blank: true }
36
+ # validates :mobile, phone: { possible: true, types: :mobile }
37
+ # end
38
+ #
39
+
28
40
  class PhoneValidator < ActiveModel::EachValidator
29
41
  # Include all core methods
30
42
  include Phonelib::Core
31
43
 
32
44
  # Validation method
33
45
  def validate_each(record, attribute, value)
46
+ return if options[:allow_blank] && value.blank?
47
+
34
48
  phone = parse(value)
35
- valid = options[:possible] ? phone.possible? : phone.valid?
36
- valid = true if options[:allow_blank] && phone.original.blank?
49
+ if options[:types]
50
+ method = options[:possible] ? :possible_types : :types
51
+ valid = (phone.send(method) & types).size > 0
52
+ else
53
+ method = options[:possible] ? :possible? : :valid?
54
+ valid = phone.send(method)
55
+ end
37
56
 
38
57
  record.errors.add(attribute, options[:message] || :invalid) unless valid
39
58
  end
59
+
60
+ private
61
+
62
+ def types
63
+ types = options[:types].is_a?(Array) ? options[:types] : [options[:types]]
64
+ types.map &:to_sym
65
+ end
66
+
40
67
  end
metadata CHANGED
@@ -1,74 +1,82 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phonelib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Vadim Senderovich
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2014-03-09 00:00:00.000000000 Z
12
+ date: 2014-05-21 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: rake
15
16
  requirement: !ruby/object:Gem::Requirement
17
+ none: false
16
18
  requirements:
17
- - - '>='
19
+ - - ! '>='
18
20
  - !ruby/object:Gem::Version
19
21
  version: '0'
20
22
  type: :development
21
23
  prerelease: false
22
24
  version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
23
26
  requirements:
24
- - - '>='
27
+ - - ! '>='
25
28
  - !ruby/object:Gem::Version
26
29
  version: '0'
27
30
  - !ruby/object:Gem::Dependency
28
31
  name: nokogiri
29
32
  requirement: !ruby/object:Gem::Requirement
33
+ none: false
30
34
  requirements:
31
- - - '>='
35
+ - - ! '>='
32
36
  - !ruby/object:Gem::Version
33
37
  version: '0'
34
38
  type: :development
35
39
  prerelease: false
36
40
  version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
37
42
  requirements:
38
- - - '>='
43
+ - - ! '>='
39
44
  - !ruby/object:Gem::Version
40
45
  version: '0'
41
46
  - !ruby/object:Gem::Dependency
42
47
  name: pry
43
48
  requirement: !ruby/object:Gem::Requirement
49
+ none: false
44
50
  requirements:
45
- - - '>='
51
+ - - ! '>='
46
52
  - !ruby/object:Gem::Version
47
53
  version: '0'
48
54
  type: :development
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
51
58
  requirements:
52
- - - '>='
59
+ - - ! '>='
53
60
  - !ruby/object:Gem::Version
54
61
  version: '0'
55
62
  - !ruby/object:Gem::Dependency
56
63
  name: rspec
57
64
  requirement: !ruby/object:Gem::Requirement
65
+ none: false
58
66
  requirements:
59
- - - '>='
67
+ - - ! '>='
60
68
  - !ruby/object:Gem::Version
61
69
  version: '0'
62
70
  type: :development
63
71
  prerelease: false
64
72
  version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
65
74
  requirements:
66
- - - '>='
75
+ - - ! '>='
67
76
  - !ruby/object:Gem::Version
68
77
  version: '0'
69
- description: |2
70
- Google libphonenumber library was taken as a basis for
71
- this gem. Gem uses its data file for validations and number formatting.
78
+ description: ! " Google libphonenumber library was taken as a basis for\n this
79
+ gem. Gem uses its data file for validations and number formatting.\n"
72
80
  email:
73
81
  - daddyzgm@gmail.com
74
82
  executables: []
@@ -77,42 +85,47 @@ extra_rdoc_files: []
77
85
  files:
78
86
  - data/phone_data.dat
79
87
  - data/PhoneNumberMetaData.xml
80
- - lib/phonelib.rb
81
- - lib/phonelib/version.rb
82
- - lib/phonelib/phone_analyzer.rb
83
- - lib/phonelib/phone.rb
84
- - lib/phonelib/core.rb
85
88
  - lib/validators/phone_validator.rb
86
89
  - lib/tasks/phonelib_tasks.rake
90
+ - lib/phonelib/phone.rb
91
+ - lib/phonelib/core.rb
92
+ - lib/phonelib/version.rb
93
+ - lib/phonelib/phone_analyzer.rb
94
+ - lib/phonelib.rb
87
95
  - MIT-LICENSE
88
96
  - Rakefile
89
97
  - README.rdoc
90
98
  homepage: https://github.com/daddyz/phonelib
91
99
  licenses:
92
100
  - MIT
93
- metadata: {}
94
- post_install_message: |2
95
- IMPORTANT NOTICE!
96
- Phone types were changed from camel case to snake case!
97
- Example: ":tollFree" changed to ":toll_free".
98
- Please update your app in case you are checking types!
101
+ post_install_message: ! " IMPORTANT NOTICE!\n Phone types were changed from
102
+ camel case to snake case!\n Example: \":tollFree\" changed to \":toll_free\".\n
103
+ \ Please update your app in case you are checking types!\n"
99
104
  rdoc_options: []
100
105
  require_paths:
101
106
  - lib
102
107
  required_ruby_version: !ruby/object:Gem::Requirement
108
+ none: false
103
109
  requirements:
104
- - - '>='
110
+ - - ! '>='
105
111
  - !ruby/object:Gem::Version
106
112
  version: '0'
113
+ segments:
114
+ - 0
115
+ hash: -1226309370824333791
107
116
  required_rubygems_version: !ruby/object:Gem::Requirement
117
+ none: false
108
118
  requirements:
109
- - - '>='
119
+ - - ! '>='
110
120
  - !ruby/object:Gem::Version
111
121
  version: '0'
122
+ segments:
123
+ - 0
124
+ hash: -1226309370824333791
112
125
  requirements: []
113
126
  rubyforge_project:
114
- rubygems_version: 2.0.3
127
+ rubygems_version: 1.8.23
115
128
  signing_key:
116
- specification_version: 4
129
+ specification_version: 3
117
130
  summary: Gem validates phone numbers with Google libphonenumber database
118
131
  test_files: []
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 29055d1498d5685ac059d21d2ab2fef9a6041a32
4
- data.tar.gz: 8d5047983bdac17132ad444f953522b3271fe593
5
- SHA512:
6
- metadata.gz: ac7f6c81df3e37071500ad19757b105b6937b87b6cae4d43d3ea944c85fc3f093dcad848c176ca00f59d33e2cd5ced6ece6d04e48f69aa3e2b5b044c632fb3a4
7
- data.tar.gz: 0af44748bfe52bc18dfae1c36ee1f1de8870b04f318db8bc9a07a3c0c1dc1acf27653ed5aeaa3eacd0812c2a091787ee5f445bf7f16a8725f6eb9366e5d257a3