telephone_number 1.1.1 → 1.2.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -0
- data/Gemfile +2 -0
- data/README.md +1 -1
- data/data/telephone_number_data_file.dat +0 -0
- data/data/telephone_number_data_file.xml +3534 -3406
- data/lib/active_model/telephone_number_validator.rb +9 -0
- data/lib/telephone_number/class_methods.rb +23 -3
- data/lib/telephone_number/country.rb +67 -0
- data/lib/telephone_number/data_importer.rb +7 -8
- data/lib/telephone_number/formatter.rb +27 -64
- data/lib/telephone_number/number.rb +5 -4
- data/lib/telephone_number/number_format.rb +14 -0
- data/lib/telephone_number/number_validation.rb +10 -0
- data/lib/telephone_number/parser.rb +22 -51
- data/lib/telephone_number/test_data_generator.rb +28 -3
- data/lib/telephone_number/version.rb +1 -1
- data/lib/telephone_number.rb +9 -40
- data/lib/utilities/hash.rb +9 -0
- data/telephone_number.gemspec +1 -1
- metadata +13 -10
- data/lib/telephone_number/phone_data.rb +0 -50
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: telephone_number
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- MOBI Wireless Management
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-08-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -67,7 +67,7 @@ dependencies:
|
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: nokogiri
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - ">="
|
@@ -81,7 +81,7 @@ dependencies:
|
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: httparty
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - ">="
|
@@ -95,19 +95,19 @@ dependencies:
|
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
98
|
+
name: activemodel
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '0'
|
103
|
+
version: '4.0'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: '0'
|
110
|
+
version: '4.0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: minitest-focus
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -159,13 +159,16 @@ files:
|
|
159
159
|
- bin/setup
|
160
160
|
- data/telephone_number_data_file.dat
|
161
161
|
- data/telephone_number_data_file.xml
|
162
|
+
- lib/active_model/telephone_number_validator.rb
|
162
163
|
- lib/telephone_number.rb
|
163
164
|
- lib/telephone_number/class_methods.rb
|
165
|
+
- lib/telephone_number/country.rb
|
164
166
|
- lib/telephone_number/data_importer.rb
|
165
167
|
- lib/telephone_number/formatter.rb
|
166
168
|
- lib/telephone_number/number.rb
|
169
|
+
- lib/telephone_number/number_format.rb
|
170
|
+
- lib/telephone_number/number_validation.rb
|
167
171
|
- lib/telephone_number/parser.rb
|
168
|
-
- lib/telephone_number/phone_data.rb
|
169
172
|
- lib/telephone_number/test_data_generator.rb
|
170
173
|
- lib/telephone_number/version.rb
|
171
174
|
- lib/utilities/hash.rb
|
@@ -185,9 +188,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
185
188
|
version: '0'
|
186
189
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
187
190
|
requirements:
|
188
|
-
- - "
|
191
|
+
- - ">"
|
189
192
|
- !ruby/object:Gem::Version
|
190
|
-
version:
|
193
|
+
version: 1.3.1
|
191
194
|
requirements: []
|
192
195
|
rubyforge_project:
|
193
196
|
rubygems_version: 2.4.5.1
|
@@ -1,50 +0,0 @@
|
|
1
|
-
module TelephoneNumber
|
2
|
-
class PhoneData
|
3
|
-
AREA_CODE_OPTIONAL = :area_code_optional
|
4
|
-
COUNTRY_CODE = :country_code
|
5
|
-
FIXED_LINE = :fixed_line
|
6
|
-
FORMATS = :formats
|
7
|
-
FORMAT = :format
|
8
|
-
GENERAL = :general_desc
|
9
|
-
INTERNATIONAL_PREFIX = :international_prefix
|
10
|
-
INTL_FORMAT = :intl_format
|
11
|
-
LEADING_DIGITS = :leading_digits
|
12
|
-
MAIN_COUNTRY_FOR_CODE = :main_country_for_code
|
13
|
-
MOBILE = :mobile
|
14
|
-
MOBILE_TOKEN_COUNTRIES = { AR: '9' }.freeze
|
15
|
-
NATIONAL_PREFIX = :national_prefix
|
16
|
-
NATIONAL_PREFIX_FOR_PARSING = :national_prefix_for_parsing
|
17
|
-
NATIONAL_PREFIX_FORMATTING_RULE = :national_prefix_formatting_rule
|
18
|
-
NO_INTERNATIONAL_DIALING = :no_international_dialling
|
19
|
-
PATTERN = :pattern
|
20
|
-
PERSONAL_NUMBER = :personal_number
|
21
|
-
PREMIUM_RATE = :premium_rate
|
22
|
-
SHARED_COST = :shared_cost
|
23
|
-
TOLL_FREE = :toll_free
|
24
|
-
UAN = :uan
|
25
|
-
VALIDATIONS = :validations
|
26
|
-
VALID_PATTERN = :national_number_pattern
|
27
|
-
VOICEMAIL = :voicemail
|
28
|
-
VOIP = :voip
|
29
|
-
|
30
|
-
attr_reader :country_data, :country
|
31
|
-
|
32
|
-
def self.phone_data
|
33
|
-
@phone_data ||= load_data
|
34
|
-
end
|
35
|
-
|
36
|
-
def self.load_data
|
37
|
-
data_file = "#{File.dirname(__FILE__)}/../../data/telephone_number_data_file.dat"
|
38
|
-
main_data = Marshal.load(File.binread(data_file))
|
39
|
-
override_data = {}
|
40
|
-
override_data = Marshal.load(File.binread(TelephoneNumber.override_file)) if TelephoneNumber.override_file
|
41
|
-
return main_data.deep_deep_merge!(override_data)
|
42
|
-
end
|
43
|
-
|
44
|
-
def initialize(country)
|
45
|
-
@country = country.to_s.upcase.to_sym
|
46
|
-
@country_data = self.class.phone_data[@country]
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|