phonelib 0.2.9 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/data/PhoneNumberMetaData.xml +158 -125
- data/data/phone_data.dat +0 -0
- data/lib/phonelib.rb +1 -3
- data/lib/phonelib/core.rb +9 -63
- data/lib/phonelib/phone.rb +41 -27
- data/lib/phonelib/phone_analyzer.rb +175 -47
- data/lib/phonelib/version.rb +1 -1
- data/lib/tasks/phonelib_tasks.rake +3 -2
- metadata +28 -41
data/lib/phonelib/version.rb
CHANGED
@@ -16,6 +16,7 @@ namespace :phonelib do
|
|
16
16
|
# get metadata from google
|
17
17
|
url = 'http://libphonenumber.googlecode.com/svn/trunk/resources/PhoneNumberMetadata.xml'
|
18
18
|
xml_data = Net::HTTP.get_response(URI.parse(url)).body
|
19
|
+
xml_data.force_encoding("utf-8")
|
19
20
|
|
20
21
|
# save in file for debug
|
21
22
|
File.open('data/PhoneNumberMetaData.xml', 'w+') do |f|
|
@@ -26,7 +27,7 @@ namespace :phonelib do
|
|
26
27
|
doc = Nokogiri::XML(xml_data)
|
27
28
|
|
28
29
|
main = doc.elements.first.elements.first
|
29
|
-
countries =
|
30
|
+
countries = {}
|
30
31
|
main.elements.each do |el|
|
31
32
|
# each country
|
32
33
|
country = {}
|
@@ -71,7 +72,7 @@ namespace :phonelib do
|
|
71
72
|
end
|
72
73
|
end
|
73
74
|
|
74
|
-
countries
|
75
|
+
countries[country[:id]] = country
|
75
76
|
end
|
76
77
|
File.open('data/phone_data.dat', 'wb+') do |f|
|
77
78
|
Marshal.dump(countries, f)
|
metadata
CHANGED
@@ -1,82 +1,74 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: phonelib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.3.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Vadim Senderovich
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2014-
|
11
|
+
date: 2014-03-09 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: rake
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - '>='
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '0'
|
22
20
|
type: :development
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - '>='
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '0'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: nokogiri
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - '>='
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: '0'
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - '>='
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: '0'
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: pry
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - '>='
|
52
46
|
- !ruby/object:Gem::Version
|
53
47
|
version: '0'
|
54
48
|
type: :development
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- -
|
52
|
+
- - '>='
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: '0'
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: rspec
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
|
-
- -
|
59
|
+
- - '>='
|
68
60
|
- !ruby/object:Gem::Version
|
69
61
|
version: '0'
|
70
62
|
type: :development
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
|
-
- -
|
66
|
+
- - '>='
|
76
67
|
- !ruby/object:Gem::Version
|
77
68
|
version: '0'
|
78
|
-
description:
|
79
|
-
|
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.
|
80
72
|
email:
|
81
73
|
- daddyzgm@gmail.com
|
82
74
|
executables: []
|
@@ -85,47 +77,42 @@ extra_rdoc_files: []
|
|
85
77
|
files:
|
86
78
|
- data/phone_data.dat
|
87
79
|
- data/PhoneNumberMetaData.xml
|
88
|
-
- lib/
|
89
|
-
- lib/tasks/phonelib_tasks.rake
|
90
|
-
- lib/phonelib/phone.rb
|
91
|
-
- lib/phonelib/core.rb
|
80
|
+
- lib/phonelib.rb
|
92
81
|
- lib/phonelib/version.rb
|
93
82
|
- lib/phonelib/phone_analyzer.rb
|
94
|
-
- lib/phonelib.rb
|
83
|
+
- lib/phonelib/phone.rb
|
84
|
+
- lib/phonelib/core.rb
|
85
|
+
- lib/validators/phone_validator.rb
|
86
|
+
- lib/tasks/phonelib_tasks.rake
|
95
87
|
- MIT-LICENSE
|
96
88
|
- Rakefile
|
97
89
|
- README.rdoc
|
98
90
|
homepage: https://github.com/daddyz/phonelib
|
99
91
|
licenses:
|
100
92
|
- MIT
|
101
|
-
|
102
|
-
|
103
|
-
|
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!
|
104
99
|
rdoc_options: []
|
105
100
|
require_paths:
|
106
101
|
- lib
|
107
102
|
required_ruby_version: !ruby/object:Gem::Requirement
|
108
|
-
none: false
|
109
103
|
requirements:
|
110
|
-
- -
|
104
|
+
- - '>='
|
111
105
|
- !ruby/object:Gem::Version
|
112
106
|
version: '0'
|
113
|
-
segments:
|
114
|
-
- 0
|
115
|
-
hash: -3579515089575950219
|
116
107
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
117
|
-
none: false
|
118
108
|
requirements:
|
119
|
-
- -
|
109
|
+
- - '>='
|
120
110
|
- !ruby/object:Gem::Version
|
121
111
|
version: '0'
|
122
|
-
segments:
|
123
|
-
- 0
|
124
|
-
hash: -3579515089575950219
|
125
112
|
requirements: []
|
126
113
|
rubyforge_project:
|
127
|
-
rubygems_version:
|
114
|
+
rubygems_version: 2.0.3
|
128
115
|
signing_key:
|
129
|
-
specification_version:
|
116
|
+
specification_version: 4
|
130
117
|
summary: Gem validates phone numbers with Google libphonenumber database
|
131
118
|
test_files: []
|