phony_rails 0.12.9 → 0.12.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 195043058b5e1e586ad0baf7b4eb4c6427daaa5d
4
- data.tar.gz: 3ef58e04cd57ecbb86041abfd1404d35eadda443
3
+ metadata.gz: 894a8528687a58ddd856bcf0225701de847e88db
4
+ data.tar.gz: c87a623b7bf8c990bfd6d1dd89d1e8a4df3349a5
5
5
  SHA512:
6
- metadata.gz: e28e02f263a44d1d1e88226c2fa85864282d7c43e32a9c52bec51fe802b11a51ced0806fe9a3fd1efcc89acd4f0bcb04b7a2c33c4c47c6cc8c58fe78f6f654e3
7
- data.tar.gz: 8829691aa23f7247ff3a5393332a6f98eaab30a7e3f87ed7e45d4387d647b8dd059ad0d9360ebb301516799aa172e1808c92090e8ae4b3d45b2d7dd31169015b
6
+ metadata.gz: 128e21023c5b47ccb822d8153f0b188b8196e0fb9ec6f3e989207e64be8f2ddcf43206f9c3347a8f6b307827fad4cfd15995f4ba4b89b08575e2eb29fe055297
7
+ data.tar.gz: 44f28ddfb2efacae5d67e61f6a08bc9bd14a5d491b493472b801f4fdda875b887b19bb7e3f5bc9d7feb57d974fb197858e22fc0dba6339b04fa0cd14cde8d7b1
@@ -1,5 +1,23 @@
1
1
  # Change Log
2
2
 
3
+ ## [Unreleased](https://github.com/joost/phony_rails/tree/HEAD)
4
+
5
+ [Full Changelog](https://github.com/joost/phony_rails/compare/v0.12.9...HEAD)
6
+
7
+ **Closed issues:**
8
+
9
+ - Can i skip a validation with another number? [\#110](https://github.com/joost/phony_rails/issues/110)
10
+
11
+ - Consider dropping the dependency on the countries gem and using a YAML file instead [\#108](https://github.com/joost/phony_rails/issues/108)
12
+
13
+ - undefined method `\[\]' for Data:Class [\#106](https://github.com/joost/phony_rails/issues/106)
14
+
15
+ **Merged pull requests:**
16
+
17
+ - Don't re-parse country codes YAML file every time it's needed. [\#111](https://github.com/joost/phony_rails/pull/111) ([jcoleman](https://github.com/jcoleman))
18
+
19
+ - Replace countries dependency with YAML file [\#109](https://github.com/joost/phony_rails/pull/109) ([monfresh](https://github.com/monfresh))
20
+
3
21
  ## [v0.12.9](https://github.com/joost/phony_rails/tree/v0.12.9) (2015-07-13)
4
22
 
5
23
  [Full Changelog](https://github.com/joost/phony_rails/compare/v0.12.8...v0.12.9)
data/Gemfile CHANGED
@@ -1,8 +1,5 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- # Preempt the default loading so that we don't get an unqualified Country class imported.
4
- gem 'countries', :require => 'iso3166'
5
-
6
3
  gemspec # Specify your gem's dependencies in phony_number.gemspec
7
4
 
8
5
  # For testing
@@ -1,9 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- phony_rails (0.12.9)
4
+ phony_rails (0.12.10)
5
5
  activesupport (>= 3.0)
6
- countries (~> 0.11, >= 0.11.5)
7
6
  phony (~> 2.12)
8
7
 
9
8
  GEM
@@ -22,28 +21,24 @@ GEM
22
21
  minitest (~> 5.1)
23
22
  thread_safe (~> 0.3, >= 0.3.4)
24
23
  tzinfo (~> 1.1)
25
- arel (6.0.2)
26
- bson (3.1.2)
24
+ arel (6.0.3)
25
+ bson (3.2.1)
27
26
  builder (3.2.2)
28
27
  coderay (1.1.0)
29
28
  connection_pool (2.2.0)
30
- countries (0.11.5)
31
- currencies (~> 0.4.2)
32
- i18n_data (~> 0.7.0)
33
29
  coveralls (0.8.2)
34
30
  json (~> 1.8)
35
31
  rest-client (>= 1.6.8, < 2)
36
32
  simplecov (~> 0.10.0)
37
33
  term-ansicolor (~> 1.3)
38
34
  thor (~> 0.19.1)
39
- currencies (0.4.2)
40
35
  diff-lcs (1.2.5)
41
36
  docile (1.1.5)
42
37
  domain_name (0.5.24)
43
38
  unf (>= 0.0.5, < 1.0.0)
44
39
  ffi (1.9.10)
45
40
  formatador (0.2.5)
46
- guard (2.12.8)
41
+ guard (2.13.0)
47
42
  formatador (>= 0.2.4)
48
43
  listen (>= 2.7, <= 4.0)
49
44
  lumberjack (~> 1.0)
@@ -57,39 +52,38 @@ GEM
57
52
  guard (~> 2.2)
58
53
  guard-compat (~> 1.1)
59
54
  guard-compat (1.2.1)
60
- guard-rspec (4.6.1)
55
+ guard-rspec (4.6.4)
61
56
  guard (~> 2.1)
62
57
  guard-compat (~> 1.1)
63
58
  rspec (>= 2.99.0, < 4.0)
64
59
  http-cookie (1.0.2)
65
60
  domain_name (~> 0.5)
66
61
  i18n (0.7.0)
67
- i18n_data (0.7.0)
68
62
  json (1.8.3)
69
- listen (3.0.2)
63
+ listen (3.0.3)
70
64
  rb-fsevent (>= 0.9.3)
71
65
  rb-inotify (>= 0.9)
72
66
  lumberjack (1.0.9)
73
67
  method_source (0.8.2)
74
68
  mime-types (2.6.1)
75
- minitest (5.7.0)
69
+ minitest (5.8.0)
76
70
  mongoid (4.0.2)
77
71
  activemodel (~> 4.0)
78
72
  moped (~> 2.0.0)
79
73
  origin (~> 2.1)
80
74
  tzinfo (>= 0.3.37)
81
- moped (2.0.6)
75
+ moped (2.0.7)
82
76
  bson (~> 3.0)
83
77
  connection_pool (~> 2.0)
84
78
  optionable (~> 0.2.0)
85
79
  nenv (0.2.0)
86
80
  netrc (0.10.3)
87
- notiffany (0.0.6)
81
+ notiffany (0.0.7)
88
82
  nenv (~> 0.1)
89
83
  shellany (~> 0.0)
90
84
  optionable (0.2.0)
91
85
  origin (2.1.1)
92
- phony (2.14.7)
86
+ phony (2.14.14)
93
87
  pry (0.10.1)
94
88
  coderay (~> 1.1.0)
95
89
  method_source (~> 0.8.1)
@@ -106,12 +100,12 @@ GEM
106
100
  rspec-core (~> 3.3.0)
107
101
  rspec-expectations (~> 3.3.0)
108
102
  rspec-mocks (~> 3.3.0)
109
- rspec-core (3.3.1)
103
+ rspec-core (3.3.2)
110
104
  rspec-support (~> 3.3.0)
111
- rspec-expectations (3.3.0)
105
+ rspec-expectations (3.3.1)
112
106
  diff-lcs (>= 1.2.0, < 2.0)
113
107
  rspec-support (~> 3.3.0)
114
- rspec-mocks (3.3.1)
108
+ rspec-mocks (3.3.2)
115
109
  diff-lcs (>= 1.2.0, < 2.0)
116
110
  rspec-support (~> 3.3.0)
117
111
  rspec-support (3.3.0)
@@ -127,7 +121,7 @@ GEM
127
121
  tins (~> 1.0)
128
122
  thor (0.19.1)
129
123
  thread_safe (0.3.5)
130
- tins (1.5.4)
124
+ tins (1.6.0)
131
125
  tzinfo (1.2.2)
132
126
  thread_safe (~> 0.1)
133
127
  unf (0.1.4)
@@ -139,7 +133,6 @@ PLATFORMS
139
133
 
140
134
  DEPENDENCIES
141
135
  activerecord (>= 3.0)
142
- countries
143
136
  coveralls
144
137
  guard
145
138
  guard-bundler
@@ -0,0 +1,501 @@
1
+ ---
2
+ AD:
3
+ country_code: '376'
4
+ AE:
5
+ country_code: '971'
6
+ AF:
7
+ country_code: '93'
8
+ AG:
9
+ country_code: '1'
10
+ AI:
11
+ country_code: '1'
12
+ AL:
13
+ country_code: '355'
14
+ AM:
15
+ country_code: '374'
16
+ AN:
17
+ country_code: '599'
18
+ AO:
19
+ country_code: '244'
20
+ AQ:
21
+ country_code: '672'
22
+ AR:
23
+ country_code: '54'
24
+ AS:
25
+ country_code: '1'
26
+ AT:
27
+ country_code: '43'
28
+ AU:
29
+ country_code: '61'
30
+ AW:
31
+ country_code: '297'
32
+ AX:
33
+ country_code: '358'
34
+ AZ:
35
+ country_code: '994'
36
+ BA:
37
+ country_code: '387'
38
+ BB:
39
+ country_code: '1'
40
+ BD:
41
+ country_code: '880'
42
+ BE:
43
+ country_code: '32'
44
+ BF:
45
+ country_code: '226'
46
+ BG:
47
+ country_code: '359'
48
+ BH:
49
+ country_code: '973'
50
+ BI:
51
+ country_code: '257'
52
+ BJ:
53
+ country_code: '229'
54
+ BL:
55
+ country_code: '590'
56
+ BM:
57
+ country_code: '1'
58
+ BN:
59
+ country_code: '673'
60
+ BO:
61
+ country_code: '591'
62
+ BQ:
63
+ country_code: '599'
64
+ BR:
65
+ country_code: '55'
66
+ BS:
67
+ country_code: '1'
68
+ BT:
69
+ country_code: '975'
70
+ BV:
71
+ country_code: ''
72
+ BW:
73
+ country_code: '267'
74
+ BY:
75
+ country_code: '375'
76
+ BZ:
77
+ country_code: '501'
78
+ CA:
79
+ country_code: '1'
80
+ CC:
81
+ country_code: '61'
82
+ CD:
83
+ country_code: '243'
84
+ CF:
85
+ country_code: '236'
86
+ CG:
87
+ country_code: '242'
88
+ CH:
89
+ country_code: '41'
90
+ CI:
91
+ country_code: '225'
92
+ CK:
93
+ country_code: '682'
94
+ CL:
95
+ country_code: '56'
96
+ CM:
97
+ country_code: '237'
98
+ CN:
99
+ country_code: '86'
100
+ CO:
101
+ country_code: '57'
102
+ CR:
103
+ country_code: '506'
104
+ CU:
105
+ country_code: '53'
106
+ CV:
107
+ country_code: '238'
108
+ CW:
109
+ country_code: '599'
110
+ CX:
111
+ country_code: '61'
112
+ CY:
113
+ country_code: '357'
114
+ CZ:
115
+ country_code: '420'
116
+ DE:
117
+ country_code: '49'
118
+ DJ:
119
+ country_code: '253'
120
+ DK:
121
+ country_code: '45'
122
+ DM:
123
+ country_code: '1'
124
+ DO:
125
+ country_code: '1'
126
+ DZ:
127
+ country_code: '213'
128
+ EC:
129
+ country_code: '593'
130
+ EE:
131
+ country_code: '372'
132
+ EG:
133
+ country_code: '20'
134
+ EH:
135
+ country_code: '212'
136
+ ER:
137
+ country_code: '291'
138
+ ES:
139
+ country_code: '34'
140
+ ET:
141
+ country_code: '251'
142
+ FI:
143
+ country_code: '358'
144
+ FJ:
145
+ country_code: '679'
146
+ FK:
147
+ country_code: '500'
148
+ FM:
149
+ country_code: '691'
150
+ FO:
151
+ country_code: '298'
152
+ FR:
153
+ country_code: '33'
154
+ GA:
155
+ country_code: '241'
156
+ GB:
157
+ country_code: '44'
158
+ GD:
159
+ country_code: '1'
160
+ GE:
161
+ country_code: '995'
162
+ GF:
163
+ country_code: '594'
164
+ GG:
165
+ country_code: '44'
166
+ GH:
167
+ country_code: '233'
168
+ GI:
169
+ country_code: '350'
170
+ GL:
171
+ country_code: '299'
172
+ GM:
173
+ country_code: '220'
174
+ GN:
175
+ country_code: '224'
176
+ GP:
177
+ country_code: '590'
178
+ GQ:
179
+ country_code: '240'
180
+ GR:
181
+ country_code: '30'
182
+ GS:
183
+ country_code: '500'
184
+ GT:
185
+ country_code: '502'
186
+ GU:
187
+ country_code: '1'
188
+ GW:
189
+ country_code: '245'
190
+ GY:
191
+ country_code: '592'
192
+ HK:
193
+ country_code: '852'
194
+ HM:
195
+ country_code: ''
196
+ HN:
197
+ country_code: '504'
198
+ HR:
199
+ country_code: '385'
200
+ HT:
201
+ country_code: '509'
202
+ HU:
203
+ country_code: '36'
204
+ ID:
205
+ country_code: '62'
206
+ IE:
207
+ country_code: '353'
208
+ IL:
209
+ country_code: '972'
210
+ IM:
211
+ country_code: '44'
212
+ IN:
213
+ country_code: '91'
214
+ IO:
215
+ country_code: '246'
216
+ IQ:
217
+ country_code: '964'
218
+ IR:
219
+ country_code: '98'
220
+ IS:
221
+ country_code: '354'
222
+ IT:
223
+ country_code: '39'
224
+ JE:
225
+ country_code: '44'
226
+ JM:
227
+ country_code: '1'
228
+ JO:
229
+ country_code: '962'
230
+ JP:
231
+ country_code: '81'
232
+ KE:
233
+ country_code: '254'
234
+ KG:
235
+ country_code: '996'
236
+ KH:
237
+ country_code: '855'
238
+ KI:
239
+ country_code: '686'
240
+ KM:
241
+ country_code: '269'
242
+ KN:
243
+ country_code: '1'
244
+ KP:
245
+ country_code: '850'
246
+ KR:
247
+ country_code: '82'
248
+ KW:
249
+ country_code: '965'
250
+ KY:
251
+ country_code: '1'
252
+ KZ:
253
+ country_code: '7'
254
+ LA:
255
+ country_code: '856'
256
+ LB:
257
+ country_code: '961'
258
+ LC:
259
+ country_code: '1'
260
+ LI:
261
+ country_code: '423'
262
+ LK:
263
+ country_code: '94'
264
+ LR:
265
+ country_code: '231'
266
+ LS:
267
+ country_code: '266'
268
+ LT:
269
+ country_code: '370'
270
+ LU:
271
+ country_code: '352'
272
+ LV:
273
+ country_code: '371'
274
+ LY:
275
+ country_code: '218'
276
+ MA:
277
+ country_code: '212'
278
+ MC:
279
+ country_code: '377'
280
+ MD:
281
+ country_code: '373'
282
+ ME:
283
+ country_code: '382'
284
+ MF:
285
+ country_code: '590'
286
+ MG:
287
+ country_code: '261'
288
+ MH:
289
+ country_code: '692'
290
+ MK:
291
+ country_code: '389'
292
+ ML:
293
+ country_code: '223'
294
+ MM:
295
+ country_code: '95'
296
+ MN:
297
+ country_code: '976'
298
+ MO:
299
+ country_code: '853'
300
+ MP:
301
+ country_code: '1'
302
+ MQ:
303
+ country_code: '596'
304
+ MR:
305
+ country_code: '222'
306
+ MS:
307
+ country_code: '1'
308
+ MT:
309
+ country_code: '356'
310
+ MU:
311
+ country_code: '230'
312
+ MV:
313
+ country_code: '960'
314
+ MW:
315
+ country_code: '265'
316
+ MX:
317
+ country_code: '52'
318
+ MY:
319
+ country_code: '60'
320
+ MZ:
321
+ country_code: '258'
322
+ NA:
323
+ country_code: '264'
324
+ NC:
325
+ country_code: '687'
326
+ NE:
327
+ country_code: '227'
328
+ NF:
329
+ country_code: '672'
330
+ NG:
331
+ country_code: '234'
332
+ NI:
333
+ country_code: '505'
334
+ NL:
335
+ country_code: '31'
336
+ 'NO':
337
+ country_code: '47'
338
+ NP:
339
+ country_code: '977'
340
+ NR:
341
+ country_code: '674'
342
+ NU:
343
+ country_code: '683'
344
+ NZ:
345
+ country_code: '64'
346
+ OM:
347
+ country_code: '968'
348
+ PA:
349
+ country_code: '507'
350
+ PE:
351
+ country_code: '51'
352
+ PF:
353
+ country_code: '689'
354
+ PG:
355
+ country_code: '675'
356
+ PH:
357
+ country_code: '63'
358
+ PK:
359
+ country_code: '92'
360
+ PL:
361
+ country_code: '48'
362
+ PM:
363
+ country_code: '508'
364
+ PN:
365
+ country_code: ''
366
+ PR:
367
+ country_code: '1'
368
+ PS:
369
+ country_code: '970'
370
+ PT:
371
+ country_code: '351'
372
+ PW:
373
+ country_code: '680'
374
+ PY:
375
+ country_code: '595'
376
+ QA:
377
+ country_code: '974'
378
+ RE:
379
+ country_code: '262'
380
+ RO:
381
+ country_code: '40'
382
+ RS:
383
+ country_code: '381'
384
+ RU:
385
+ country_code: '7'
386
+ RW:
387
+ country_code: '250'
388
+ SA:
389
+ country_code: '966'
390
+ SB:
391
+ country_code: '677'
392
+ SC:
393
+ country_code: '248'
394
+ SD:
395
+ country_code: '249'
396
+ SE:
397
+ country_code: '46'
398
+ SG:
399
+ country_code: '65'
400
+ SH:
401
+ country_code: '290'
402
+ SI:
403
+ country_code: '386'
404
+ SJ:
405
+ country_code: '47'
406
+ SK:
407
+ country_code: '421'
408
+ SL:
409
+ country_code: '232'
410
+ SM:
411
+ country_code: '378'
412
+ SN:
413
+ country_code: '221'
414
+ SO:
415
+ country_code: '252'
416
+ SR:
417
+ country_code: '597'
418
+ SS:
419
+ country_code: '211'
420
+ ST:
421
+ country_code: '239'
422
+ SV:
423
+ country_code: '503'
424
+ SX:
425
+ country_code: '1'
426
+ SY:
427
+ country_code: '963'
428
+ SZ:
429
+ country_code: '268'
430
+ TC:
431
+ country_code: '1'
432
+ TD:
433
+ country_code: '235'
434
+ TF:
435
+ country_code: ''
436
+ TG:
437
+ country_code: '228'
438
+ TH:
439
+ country_code: '66'
440
+ TJ:
441
+ country_code: '992'
442
+ TK:
443
+ country_code: '690'
444
+ TL:
445
+ country_code: '670'
446
+ TM:
447
+ country_code: '993'
448
+ TN:
449
+ country_code: '216'
450
+ TO:
451
+ country_code: '676'
452
+ TR:
453
+ country_code: '90'
454
+ TT:
455
+ country_code: '1'
456
+ TV:
457
+ country_code: '688'
458
+ TW:
459
+ country_code: '886'
460
+ TZ:
461
+ country_code: '255'
462
+ UA:
463
+ country_code: '380'
464
+ UG:
465
+ country_code: '256'
466
+ UM:
467
+ country_code: ''
468
+ US:
469
+ country_code: '1'
470
+ UY:
471
+ country_code: '598'
472
+ UZ:
473
+ country_code: '998'
474
+ VA:
475
+ country_code: '39'
476
+ VC:
477
+ country_code: '1'
478
+ VE:
479
+ country_code: '58'
480
+ VG:
481
+ country_code: '1'
482
+ VI:
483
+ country_code: '1'
484
+ VN:
485
+ country_code: '84'
486
+ VU:
487
+ country_code: '678'
488
+ WF:
489
+ country_code: '681'
490
+ WS:
491
+ country_code: '685'
492
+ YE:
493
+ country_code: '967'
494
+ YT:
495
+ country_code: '262'
496
+ ZA:
497
+ country_code: '27'
498
+ ZM:
499
+ country_code: '260'
500
+ ZW:
501
+ country_code: '263'
@@ -1,13 +1,19 @@
1
1
  require 'phony'
2
- require 'iso3166'
3
2
  require 'phony_rails/string_extensions'
4
3
  require 'validators/phony_validator'
5
4
  require 'phony_rails/version'
5
+ require 'yaml'
6
6
 
7
7
  module PhonyRails
8
8
 
9
9
  def self.country_number_for(country_code)
10
- ISO3166::Country[country_code.to_s.upcase].try(:data).try(:[], 'country_code')
10
+ return if country_code.nil?
11
+
12
+ country_codes_hash[country_code.to_s.upcase]['country_code']
13
+ end
14
+
15
+ def self.country_codes_hash
16
+ @country_codes_hash ||= YAML.load_file(File.join(File.dirname(File.expand_path(__FILE__)), 'data/country_codes.yaml'))
11
17
  end
12
18
 
13
19
  # This method requires a country_code attribute (eg. NL) and phone_number to be set.
@@ -1,3 +1,3 @@
1
1
  module PhonyRails
2
- VERSION = "0.12.9"
2
+ VERSION = "0.12.10"
3
3
  end
@@ -20,7 +20,6 @@ Gem::Specification.new do |gem|
20
20
  gem.post_install_message = "It now ads a '+' to the normalized number when it starts with a country number!"
21
21
 
22
22
  gem.add_dependency "phony", '~> 2.12'
23
- gem.add_dependency "countries", '~> 0.11', '>= 0.11.5'
24
23
  gem.add_dependency "activesupport", ">= 3.0"
25
24
  gem.add_development_dependency "activerecord", ">= 3.0"
26
25
  gem.add_development_dependency "mongoid", ">= 3.0"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phony_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.9
4
+ version: 0.12.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joost Hietbrink
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-13 00:00:00.000000000 Z
11
+ date: 2015-08-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: phony
@@ -24,26 +24,6 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '2.12'
27
- - !ruby/object:Gem::Dependency
28
- name: countries
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: '0.11'
34
- - - ">="
35
- - !ruby/object:Gem::Version
36
- version: 0.11.5
37
- type: :runtime
38
- prerelease: false
39
- version_requirements: !ruby/object:Gem::Requirement
40
- requirements:
41
- - - "~>"
42
- - !ruby/object:Gem::Version
43
- version: '0.11'
44
- - - ">="
45
- - !ruby/object:Gem::Version
46
- version: 0.11.5
47
27
  - !ruby/object:Gem::Dependency
48
28
  name: activesupport
49
29
  requirement: !ruby/object:Gem::Requirement
@@ -104,6 +84,7 @@ files:
104
84
  - LICENSE
105
85
  - README.md
106
86
  - Rakefile
87
+ - lib/data/country_codes.yaml
107
88
  - lib/phony_rails.rb
108
89
  - lib/phony_rails/locales/de.yml
109
90
  - lib/phony_rails/locales/en.yml