phonelib 0.2.4 → 0.2.5
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.
- data/README.rdoc +11 -6
- data/Rakefile +1 -1
- data/data/PhoneNumberMetaData.xml +39 -45
- data/data/phone_data.yml +6482 -6470
- data/lib/phonelib.rb +2 -1
- data/lib/phonelib/core.rb +30 -29
- data/lib/phonelib/phone.rb +52 -32
- data/lib/phonelib/version.rb +2 -1
- data/lib/tasks/phonelib_tasks.rake +14 -9
- data/lib/validators/phone_validator.rb +1 -1
- data/test/dummy/Rakefile +2 -1
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/development.log +16 -28
- data/test/dummy/log/test.log +1351 -4867
- data/test/phonelib_test.rb +35 -4
- metadata +122 -126
- checksums.yaml +0 -7
data/test/phonelib_test.rb
CHANGED
@@ -96,7 +96,7 @@ class PhonelibTest < Test::Unit::TestCase
|
|
96
96
|
|
97
97
|
context 'valid_for_country?' do
|
98
98
|
context 'with correct data' do
|
99
|
-
['IL', :il].each do |country|
|
99
|
+
['IL', 'il', :il].each do |country|
|
100
100
|
context "with #{country} as country" do
|
101
101
|
should 'be valid' do
|
102
102
|
assert Phonelib.valid_for_country?('972541234567', country)
|
@@ -117,7 +117,7 @@ class PhonelibTest < Test::Unit::TestCase
|
|
117
117
|
end
|
118
118
|
end
|
119
119
|
|
120
|
-
['US', :us].each do |country|
|
120
|
+
['US', 'us', :us].each do |country|
|
121
121
|
context "with #{country} as country" do
|
122
122
|
context 'with incorrect data' do
|
123
123
|
should 'not be valid' do
|
@@ -136,7 +136,7 @@ class PhonelibTest < Test::Unit::TestCase
|
|
136
136
|
|
137
137
|
context '.invalid_for_country?' do
|
138
138
|
context 'with correct data' do
|
139
|
-
['IL', :il].each do |country|
|
139
|
+
['IL', 'il', :il].each do |country|
|
140
140
|
context "with #{country} as country" do
|
141
141
|
should 'not be invalid' do
|
142
142
|
assert !Phonelib.invalid_for_country?('972541234567', country)
|
@@ -146,7 +146,7 @@ class PhonelibTest < Test::Unit::TestCase
|
|
146
146
|
end
|
147
147
|
|
148
148
|
context 'with incorrect data' do
|
149
|
-
['US', :us].each do |country|
|
149
|
+
['US', 'us', :us].each do |country|
|
150
150
|
context "with #{country} as country" do
|
151
151
|
should 'be invalid' do
|
152
152
|
assert Phonelib.invalid_for_country?('972541234567', country)
|
@@ -185,6 +185,37 @@ class PhonelibTest < Test::Unit::TestCase
|
|
185
185
|
end
|
186
186
|
end
|
187
187
|
|
188
|
+
context 'types' do
|
189
|
+
setup { @phone = Phonelib.parse('972541234567') }
|
190
|
+
should 'return :mobile type' do
|
191
|
+
assert_equal :mobile, @phone.type
|
192
|
+
end
|
193
|
+
|
194
|
+
should 'return Mobile human type' do
|
195
|
+
assert_equal 'Mobile', @phone.human_type
|
196
|
+
end
|
197
|
+
|
198
|
+
should 'return [:mobile] as all types' do
|
199
|
+
assert_equal [:mobile], @phone.types
|
200
|
+
end
|
201
|
+
|
202
|
+
should 'return [Mobile] as all human types' do
|
203
|
+
assert_equal %w(Mobile), @phone.human_types
|
204
|
+
end
|
205
|
+
end
|
206
|
+
|
207
|
+
context 'country' do
|
208
|
+
should 'return IL as country' do
|
209
|
+
phone = Phonelib.parse('972541234567')
|
210
|
+
assert 'IL', phone.country
|
211
|
+
end
|
212
|
+
|
213
|
+
should 'return RU as country' do
|
214
|
+
phone = Phonelib.parse('78005500500')
|
215
|
+
assert 'RU', phone.country
|
216
|
+
end
|
217
|
+
end
|
218
|
+
|
188
219
|
context 'default_country' do
|
189
220
|
should 'be invalid with no default country set' do
|
190
221
|
phone = Phonelib.parse('541234567')
|
metadata
CHANGED
@@ -1,87 +1,73 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: phonelib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
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: 2013-
|
12
|
+
date: 2013-11-25 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: rails
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirement: &21069160 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
16
18
|
requirements:
|
17
|
-
- - '>='
|
19
|
+
- - ! '>='
|
18
20
|
- !ruby/object:Gem::Version
|
19
21
|
version: 3.1.0
|
20
22
|
type: :development
|
21
23
|
prerelease: false
|
22
|
-
version_requirements:
|
23
|
-
requirements:
|
24
|
-
- - '>='
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: 3.1.0
|
24
|
+
version_requirements: *21069160
|
27
25
|
- !ruby/object:Gem::Dependency
|
28
26
|
name: sqlite3
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
27
|
+
requirement: &21067140 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
30
29
|
requirements:
|
31
|
-
- - '>='
|
30
|
+
- - ! '>='
|
32
31
|
- !ruby/object:Gem::Version
|
33
32
|
version: '0'
|
34
33
|
type: :development
|
35
34
|
prerelease: false
|
36
|
-
version_requirements:
|
37
|
-
requirements:
|
38
|
-
- - '>='
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
35
|
+
version_requirements: *21067140
|
41
36
|
- !ruby/object:Gem::Dependency
|
42
37
|
name: nokogiri
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
38
|
+
requirement: &21080420 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
44
40
|
requirements:
|
45
|
-
- - '>='
|
41
|
+
- - ! '>='
|
46
42
|
- !ruby/object:Gem::Version
|
47
43
|
version: '0'
|
48
44
|
type: :development
|
49
45
|
prerelease: false
|
50
|
-
version_requirements:
|
51
|
-
requirements:
|
52
|
-
- - '>='
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
46
|
+
version_requirements: *21080420
|
55
47
|
- !ruby/object:Gem::Dependency
|
56
48
|
name: pry
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
49
|
+
requirement: &21079180 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
58
51
|
requirements:
|
59
|
-
- - '>='
|
52
|
+
- - ! '>='
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: '0'
|
62
55
|
type: :development
|
63
56
|
prerelease: false
|
64
|
-
version_requirements:
|
65
|
-
requirements:
|
66
|
-
- - '>='
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
57
|
+
version_requirements: *21079180
|
69
58
|
- !ruby/object:Gem::Dependency
|
70
59
|
name: shoulda-context
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
60
|
+
requirement: &21078100 !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
72
62
|
requirements:
|
73
|
-
- - '>='
|
63
|
+
- - ! '>='
|
74
64
|
- !ruby/object:Gem::Version
|
75
65
|
version: '0'
|
76
66
|
type: :development
|
77
67
|
prerelease: false
|
78
|
-
version_requirements:
|
79
|
-
|
80
|
-
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '0'
|
83
|
-
description: Google libphonenumber library was taken as a basis for this gem. Gem
|
84
|
-
uses its data file for validations and number formatting.
|
68
|
+
version_requirements: *21078100
|
69
|
+
description: ! " Google libphonenumber library was taken as a basis for\n this
|
70
|
+
gem. Gem uses its data file for validations and number formatting.\n"
|
85
71
|
email:
|
86
72
|
- daddyzgm@gmail.com
|
87
73
|
executables: []
|
@@ -90,140 +76,150 @@ extra_rdoc_files: []
|
|
90
76
|
files:
|
91
77
|
- data/phone_data.yml
|
92
78
|
- data/PhoneNumberMetaData.xml
|
93
|
-
- lib/
|
94
|
-
- lib/phonelib/version.rb
|
79
|
+
- lib/validators/phone_validator.rb
|
95
80
|
- lib/phonelib/phone.rb
|
96
81
|
- lib/phonelib/core.rb
|
97
|
-
- lib/
|
82
|
+
- lib/phonelib/version.rb
|
83
|
+
- lib/phonelib.rb
|
98
84
|
- lib/tasks/phonelib_tasks.rake
|
99
85
|
- MIT-LICENSE
|
100
86
|
- Rakefile
|
101
87
|
- README.rdoc
|
102
|
-
- test/
|
103
|
-
- test/dummy/
|
104
|
-
- test/dummy/
|
88
|
+
- test/dummy/db/schema.rb
|
89
|
+
- test/dummy/db/test.sqlite3
|
90
|
+
- test/dummy/db/migrate/20130121173847_create_phones.rb
|
91
|
+
- test/dummy/db/migrate/20130122075331_add_possible_number_to_phone.rb
|
92
|
+
- test/dummy/db/development.sqlite3
|
93
|
+
- test/dummy/config.ru
|
94
|
+
- test/dummy/config/initializers/backtrace_silencers.rb
|
105
95
|
- test/dummy/config/initializers/wrap_parameters.rb
|
106
|
-
- test/dummy/config/initializers/secret_token.rb
|
107
96
|
- test/dummy/config/initializers/mime_types.rb
|
108
|
-
- test/dummy/config/initializers/backtrace_silencers.rb
|
109
97
|
- test/dummy/config/initializers/inflections.rb
|
98
|
+
- test/dummy/config/initializers/session_store.rb
|
99
|
+
- test/dummy/config/initializers/secret_token.rb
|
110
100
|
- test/dummy/config/environments/development.rb
|
111
|
-
- test/dummy/config/environments/test.rb
|
112
101
|
- test/dummy/config/environments/production.rb
|
113
|
-
- test/dummy/config/
|
114
|
-
- test/dummy/config/locales/en.yml
|
115
|
-
- test/dummy/config/boot.rb
|
102
|
+
- test/dummy/config/environments/test.rb
|
116
103
|
- test/dummy/config/application.rb
|
104
|
+
- test/dummy/config/boot.rb
|
105
|
+
- test/dummy/config/environment.rb
|
117
106
|
- test/dummy/config/routes.rb
|
107
|
+
- test/dummy/config/locales/en.yml
|
108
|
+
- test/dummy/config/database.yml
|
109
|
+
- test/dummy/public/422.html
|
110
|
+
- test/dummy/public/404.html
|
111
|
+
- test/dummy/public/favicon.ico
|
112
|
+
- test/dummy/public/500.html
|
113
|
+
- test/dummy/test/fixtures/phones.yml
|
114
|
+
- test/dummy/test/unit/helpers/phones_helper_test.rb
|
115
|
+
- test/dummy/test/unit/phone_test.rb
|
116
|
+
- test/dummy/test/functional/phones_controller_test.rb
|
117
|
+
- test/dummy/README.rdoc
|
118
|
+
- test/dummy/log/development.log
|
119
|
+
- test/dummy/log/test.log
|
120
|
+
- test/dummy/Rakefile
|
121
|
+
- test/dummy/script/rails
|
122
|
+
- test/dummy/app/views/layouts/application.html.erb
|
123
|
+
- test/dummy/app/views/phones/_form.html.erb
|
124
|
+
- test/dummy/app/views/phones/index.html.erb
|
125
|
+
- test/dummy/app/views/phones/show.html.erb
|
126
|
+
- test/dummy/app/views/phones/edit.html.erb
|
127
|
+
- test/dummy/app/views/phones/new.html.erb
|
118
128
|
- test/dummy/app/models/phone.rb
|
119
|
-
- test/dummy/app/
|
129
|
+
- test/dummy/app/helpers/application_helper.rb
|
130
|
+
- test/dummy/app/helpers/phones_helper.rb
|
120
131
|
- test/dummy/app/controllers/phones_controller.rb
|
121
|
-
- test/dummy/app/
|
132
|
+
- test/dummy/app/controllers/application_controller.rb
|
122
133
|
- test/dummy/app/assets/stylesheets/scaffold.css
|
123
134
|
- test/dummy/app/assets/stylesheets/phones.css
|
135
|
+
- test/dummy/app/assets/stylesheets/application.css
|
124
136
|
- test/dummy/app/assets/javascripts/application.js
|
125
137
|
- test/dummy/app/assets/javascripts/phones.js
|
126
|
-
- test/dummy/app/helpers/phones_helper.rb
|
127
|
-
- test/dummy/app/helpers/application_helper.rb
|
128
|
-
- test/dummy/app/views/layouts/application.html.erb
|
129
|
-
- test/dummy/app/views/phones/index.html.erb
|
130
|
-
- test/dummy/app/views/phones/_form.html.erb
|
131
|
-
- test/dummy/app/views/phones/new.html.erb
|
132
|
-
- test/dummy/app/views/phones/edit.html.erb
|
133
|
-
- test/dummy/app/views/phones/show.html.erb
|
134
|
-
- test/dummy/script/rails
|
135
|
-
- test/dummy/db/development.sqlite3
|
136
|
-
- test/dummy/db/migrate/20130121173847_create_phones.rb
|
137
|
-
- test/dummy/db/migrate/20130122075331_add_possible_number_to_phone.rb
|
138
|
-
- test/dummy/db/schema.rb
|
139
|
-
- test/dummy/db/test.sqlite3
|
140
|
-
- test/dummy/config.ru
|
141
|
-
- test/dummy/README.rdoc
|
142
|
-
- test/dummy/Rakefile
|
143
|
-
- test/dummy/log/test.log
|
144
|
-
- test/dummy/log/development.log
|
145
|
-
- test/dummy/public/404.html
|
146
|
-
- test/dummy/public/422.html
|
147
|
-
- test/dummy/public/500.html
|
148
|
-
- test/dummy/public/favicon.ico
|
149
|
-
- test/dummy/test/functional/phones_controller_test.rb
|
150
|
-
- test/dummy/test/fixtures/phones.yml
|
151
|
-
- test/dummy/test/unit/helpers/phones_helper_test.rb
|
152
|
-
- test/dummy/test/unit/phone_test.rb
|
153
138
|
- test/test_helper.rb
|
139
|
+
- test/phonelib_test.rb
|
154
140
|
homepage: https://github.com/daddyz/phonelib
|
155
|
-
licenses:
|
156
|
-
|
157
|
-
post_install_message:
|
141
|
+
licenses:
|
142
|
+
- MIT
|
143
|
+
post_install_message: ! " IMPORTANT NOTICE!\n Phone types were changed from
|
144
|
+
camel case to snake case!\n Example: \":tollFree\" changed to \":toll_free\".\n
|
145
|
+
\ Please update your app in case your are checking types!\n"
|
158
146
|
rdoc_options: []
|
159
147
|
require_paths:
|
160
148
|
- lib
|
161
149
|
required_ruby_version: !ruby/object:Gem::Requirement
|
150
|
+
none: false
|
162
151
|
requirements:
|
163
|
-
- - '>='
|
152
|
+
- - ! '>='
|
164
153
|
- !ruby/object:Gem::Version
|
165
154
|
version: '0'
|
155
|
+
segments:
|
156
|
+
- 0
|
157
|
+
hash: -2851070269880550341
|
166
158
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
159
|
+
none: false
|
167
160
|
requirements:
|
168
|
-
- - '>='
|
161
|
+
- - ! '>='
|
169
162
|
- !ruby/object:Gem::Version
|
170
163
|
version: '0'
|
164
|
+
segments:
|
165
|
+
- 0
|
166
|
+
hash: -2851070269880550341
|
171
167
|
requirements: []
|
172
168
|
rubyforge_project:
|
173
|
-
rubygems_version:
|
169
|
+
rubygems_version: 1.8.17
|
174
170
|
signing_key:
|
175
|
-
specification_version:
|
176
|
-
summary: Gem validates phone numbers with Google libphonenumber database
|
171
|
+
specification_version: 3
|
172
|
+
summary: Gem validates phone numbers with Google libphonenumber database
|
177
173
|
test_files:
|
178
|
-
- test/
|
179
|
-
- test/dummy/
|
180
|
-
- test/dummy/
|
174
|
+
- test/dummy/db/schema.rb
|
175
|
+
- test/dummy/db/test.sqlite3
|
176
|
+
- test/dummy/db/migrate/20130121173847_create_phones.rb
|
177
|
+
- test/dummy/db/migrate/20130122075331_add_possible_number_to_phone.rb
|
178
|
+
- test/dummy/db/development.sqlite3
|
179
|
+
- test/dummy/config.ru
|
180
|
+
- test/dummy/config/initializers/backtrace_silencers.rb
|
181
181
|
- test/dummy/config/initializers/wrap_parameters.rb
|
182
|
-
- test/dummy/config/initializers/secret_token.rb
|
183
182
|
- test/dummy/config/initializers/mime_types.rb
|
184
|
-
- test/dummy/config/initializers/backtrace_silencers.rb
|
185
183
|
- test/dummy/config/initializers/inflections.rb
|
184
|
+
- test/dummy/config/initializers/session_store.rb
|
185
|
+
- test/dummy/config/initializers/secret_token.rb
|
186
186
|
- test/dummy/config/environments/development.rb
|
187
|
-
- test/dummy/config/environments/test.rb
|
188
187
|
- test/dummy/config/environments/production.rb
|
189
|
-
- test/dummy/config/
|
190
|
-
- test/dummy/config/locales/en.yml
|
191
|
-
- test/dummy/config/boot.rb
|
188
|
+
- test/dummy/config/environments/test.rb
|
192
189
|
- test/dummy/config/application.rb
|
190
|
+
- test/dummy/config/boot.rb
|
191
|
+
- test/dummy/config/environment.rb
|
193
192
|
- test/dummy/config/routes.rb
|
193
|
+
- test/dummy/config/locales/en.yml
|
194
|
+
- test/dummy/config/database.yml
|
195
|
+
- test/dummy/public/422.html
|
196
|
+
- test/dummy/public/404.html
|
197
|
+
- test/dummy/public/favicon.ico
|
198
|
+
- test/dummy/public/500.html
|
199
|
+
- test/dummy/test/fixtures/phones.yml
|
200
|
+
- test/dummy/test/unit/helpers/phones_helper_test.rb
|
201
|
+
- test/dummy/test/unit/phone_test.rb
|
202
|
+
- test/dummy/test/functional/phones_controller_test.rb
|
203
|
+
- test/dummy/README.rdoc
|
204
|
+
- test/dummy/log/development.log
|
205
|
+
- test/dummy/log/test.log
|
206
|
+
- test/dummy/Rakefile
|
207
|
+
- test/dummy/script/rails
|
208
|
+
- test/dummy/app/views/layouts/application.html.erb
|
209
|
+
- test/dummy/app/views/phones/_form.html.erb
|
210
|
+
- test/dummy/app/views/phones/index.html.erb
|
211
|
+
- test/dummy/app/views/phones/show.html.erb
|
212
|
+
- test/dummy/app/views/phones/edit.html.erb
|
213
|
+
- test/dummy/app/views/phones/new.html.erb
|
194
214
|
- test/dummy/app/models/phone.rb
|
195
|
-
- test/dummy/app/
|
215
|
+
- test/dummy/app/helpers/application_helper.rb
|
216
|
+
- test/dummy/app/helpers/phones_helper.rb
|
196
217
|
- test/dummy/app/controllers/phones_controller.rb
|
197
|
-
- test/dummy/app/
|
218
|
+
- test/dummy/app/controllers/application_controller.rb
|
198
219
|
- test/dummy/app/assets/stylesheets/scaffold.css
|
199
220
|
- test/dummy/app/assets/stylesheets/phones.css
|
221
|
+
- test/dummy/app/assets/stylesheets/application.css
|
200
222
|
- test/dummy/app/assets/javascripts/application.js
|
201
223
|
- test/dummy/app/assets/javascripts/phones.js
|
202
|
-
- test/dummy/app/helpers/phones_helper.rb
|
203
|
-
- test/dummy/app/helpers/application_helper.rb
|
204
|
-
- test/dummy/app/views/layouts/application.html.erb
|
205
|
-
- test/dummy/app/views/phones/index.html.erb
|
206
|
-
- test/dummy/app/views/phones/_form.html.erb
|
207
|
-
- test/dummy/app/views/phones/new.html.erb
|
208
|
-
- test/dummy/app/views/phones/edit.html.erb
|
209
|
-
- test/dummy/app/views/phones/show.html.erb
|
210
|
-
- test/dummy/script/rails
|
211
|
-
- test/dummy/db/development.sqlite3
|
212
|
-
- test/dummy/db/migrate/20130121173847_create_phones.rb
|
213
|
-
- test/dummy/db/migrate/20130122075331_add_possible_number_to_phone.rb
|
214
|
-
- test/dummy/db/schema.rb
|
215
|
-
- test/dummy/db/test.sqlite3
|
216
|
-
- test/dummy/config.ru
|
217
|
-
- test/dummy/README.rdoc
|
218
|
-
- test/dummy/Rakefile
|
219
|
-
- test/dummy/log/test.log
|
220
|
-
- test/dummy/log/development.log
|
221
|
-
- test/dummy/public/404.html
|
222
|
-
- test/dummy/public/422.html
|
223
|
-
- test/dummy/public/500.html
|
224
|
-
- test/dummy/public/favicon.ico
|
225
|
-
- test/dummy/test/functional/phones_controller_test.rb
|
226
|
-
- test/dummy/test/fixtures/phones.yml
|
227
|
-
- test/dummy/test/unit/helpers/phones_helper_test.rb
|
228
|
-
- test/dummy/test/unit/phone_test.rb
|
229
224
|
- test/test_helper.rb
|
225
|
+
- test/phonelib_test.rb
|
checksums.yaml
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz: 25bc0907fba6780f76bc3a992f5be7aab3707984
|
4
|
-
data.tar.gz: f7113d05fb5638f49c3f108b9f7e1822e1000447
|
5
|
-
SHA512:
|
6
|
-
metadata.gz: c8ff5d16a7db82997b3135eb3423e95945a2f29309ecb3d133b50bed832e660c67c2ece8cb062db0329fcc3c4774738866fbd861a4e38d61cbef11c910367da2
|
7
|
-
data.tar.gz: f445aabafa29908c7e5e1eeb5afcbe4f7796d4c2292c88981b213c114ee8795477a6afd99fce4cdbdd11a5978ca9b4dec7ac51d077709820ea1ec7308a4f7110
|