phonelib 0.6.54 → 0.6.57

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
  SHA256:
3
- metadata.gz: e14b66f811632e1127f59129e7ae723e5414578f1d792a9bdbb7b56322e542d7
4
- data.tar.gz: 9869b24e806b4452e793fe11b4f99ce1cfdbf245479ef6c132fe6ab622f658e8
3
+ metadata.gz: f18f3a063d8059ddaaadcdf93350da7722596deb8eceedc3fff2582a92cbb51b
4
+ data.tar.gz: 0a00eff81cad4d498ddc60a3080813ea9df7d7f6089fd9eba0ba50b8419e0b73
5
5
  SHA512:
6
- metadata.gz: 457f7d9ed48b836d75f595ffee60cffc50ba5191ea86e1c0f0dc2600aa98bb1a7d6f2a56e7784323916635c6927f4231cf4ae552c7b343a471e1067e2dcb7608
7
- data.tar.gz: eb5396872ae956a2b6611b7d6df5f7f2d05f8d965d27368eacd9efb5c38627c312eef8582d0894908e06e5944a43f8fd880e6346fe3fefe5ada6ef4e1499f85b
6
+ metadata.gz: 2c54689fada25b70ecf4a8c2dafd0cca72f74d4b7909103c12b6fe02590095a40ce4051fb54eff06eaf198ca66a0b64e3f65e68e25907e872cd7c0cc530c6f12
7
+ data.tar.gz: 6313294668d0cb684aaa312cd350f3ac4b4f791a1ceb1ebfd19c0cd3c7815cc4a15b09711c05cf7ad7d0fd775691f0f1ea4f7680cf5c42c99014f41e45aa5fae
Binary file
data/data/phone_data.dat CHANGED
Binary file
@@ -19,6 +19,47 @@ module Phonelib
19
19
 
20
20
  # countries that can have double country prefix in number
21
21
  DOUBLE_COUNTRY_CODES_COUNTRIES = %w(IN DE BR IT NO PL CU VN)
22
+ FORMAT_SHARING = {
23
+ 'CA' => 'US',
24
+ 'CC' => 'AU',
25
+ 'CX' => 'AU',
26
+ 'DM' => 'US',
27
+ 'DO' => 'US',
28
+ 'EH' => 'MA',
29
+ 'GD' => 'US',
30
+ 'GG' => 'GB',
31
+ 'GU' => 'US',
32
+ 'IM' => 'GB',
33
+ 'JE' => 'GB',
34
+ 'JM' => 'US',
35
+ 'KN' => 'US',
36
+ 'KY' => 'US',
37
+ 'KZ' => 'RU',
38
+ 'LC' => 'US',
39
+ 'MF' => 'GP',
40
+ 'MP' => 'US',
41
+ 'MS' => 'US',
42
+ 'PR' => 'US',
43
+ 'SJ' => 'NO',
44
+ 'SX' => 'US',
45
+ 'TA' => 'SH',
46
+ 'TC' => 'US',
47
+ 'TT' => 'US',
48
+ 'VA' => 'IT',
49
+ 'VC' => 'US',
50
+ 'VG' => 'US',
51
+ 'VI' => 'US',
52
+ 'YT' => 'RE',
53
+ 'AG' => 'US',
54
+ 'AI' => 'US',
55
+ 'AS' => 'US',
56
+ 'AX' => 'FI',
57
+ 'BB' => 'US',
58
+ 'BL' => 'GP',
59
+ 'BM' => 'US',
60
+ 'BQ' => 'CW',
61
+ 'BS' => 'US',
62
+ }
22
63
 
23
64
  # main data file in repo
24
65
  MAIN_FILE = 'resources/PhoneNumberMetadata.xml'
@@ -55,6 +96,7 @@ module Phonelib
55
96
  import_main_data
56
97
  import_short_data
57
98
  import_alternate_formats
99
+ process_format_links
58
100
  import_geocoding_data
59
101
  import_timezone_data
60
102
  import_carrier_data
@@ -115,6 +157,14 @@ module Phonelib
115
157
  end
116
158
  end
117
159
 
160
+ # some countries missing formats, and are linking them to another countries
161
+ def process_format_links
162
+ FORMAT_SHARING.each do |destination, source|
163
+ @data[destination][:formats] ||= []
164
+ @data[destination][:formats] = @data[destination][:formats] + @data[source][:formats]
165
+ end
166
+ end
167
+
118
168
  # method parses geocoding data dir
119
169
  def import_geocoding_data
120
170
  puts 'IMPORTING GEOCODING DATA'
@@ -1,4 +1,4 @@
1
1
  module Phonelib
2
2
  # @private
3
- VERSION = '0.6.54'
3
+ VERSION = '0.6.57'
4
4
  end
@@ -62,7 +62,7 @@ class PhoneValidator < ActiveModel::EachValidator
62
62
  @phone = parse(value, specified_country(record))
63
63
  valid = phone_valid? && valid_types? && valid_country? && valid_extensions?
64
64
 
65
- record.errors.add(attribute, message, options) unless valid
65
+ record.errors.add(attribute, message, **options) unless valid
66
66
  end
67
67
 
68
68
  private
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phonelib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.54
4
+ version: 0.6.57
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vadim Senderovich
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-11-09 00:00:00.000000000 Z
11
+ date: 2022-02-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.10.8
33
+ version: 1.13.0
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 1.10.8
40
+ version: 1.13.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: pry
43
43
  requirement: !ruby/object:Gem::Requirement