phony_rails 0.12.1 → 0.12.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +7 -0
- data/Gemfile +0 -14
- data/Gemfile.lock +1 -4
- data/README.md +1 -1
- data/lib/phony_rails/version.rb +1 -1
- data/lib/phony_rails.rb +6 -1
- data/spec/lib/phony_rails_spec.rb +8 -3
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 69276a65ab509580ebd6b96adb01c6ae03ff2bf8
|
4
|
+
data.tar.gz: 3faddbca4183fee934927c93787223f8a46b4c00
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 852574f157477ddf3d38658f778f394e423db680ba326cd182ac691619eabf652aeee20612f51744d971bdfecd0e880edfa338928c0750c5b6cba10bf42867bb
|
7
|
+
data.tar.gz: 58d821718858e450291e23a006099630eb259284186e2aeb3c60fdc717cb12f406f2ba535b71de7c432d8bacc60be3a5944b7b81e79ee2792672cc10d320d8fd
|
data/.travis.yml
ADDED
data/Gemfile
CHANGED
@@ -13,17 +13,3 @@ gem 'rspec', '~> 2.14.0'
|
|
13
13
|
gem 'guard', '~> 2.10.1'
|
14
14
|
gem 'guard-bundler', '~> 2.0.0'
|
15
15
|
gem 'guard-rspec', '~> 4.2.0'
|
16
|
-
|
17
|
-
case RbConfig::CONFIG['host_os']
|
18
|
-
when /darwin/i
|
19
|
-
gem 'growl'
|
20
|
-
gem 'rb-fsevent'
|
21
|
-
when /linux/i
|
22
|
-
gem 'libnotify'
|
23
|
-
gem 'rb-inotify'
|
24
|
-
when /mswin|windows/i
|
25
|
-
gem 'rb-fchange'
|
26
|
-
gem 'rb-notifu'
|
27
|
-
gem 'win32console'
|
28
|
-
end
|
29
|
-
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
phony_rails (0.12.
|
4
|
+
phony_rails (0.12.1)
|
5
5
|
activesupport (>= 3.0)
|
6
6
|
countries (~> 0.8, >= 0.8.2)
|
7
7
|
phony (~> 2.12)
|
@@ -36,7 +36,6 @@ GEM
|
|
36
36
|
diff-lcs (1.2.5)
|
37
37
|
ffi (1.9.8)
|
38
38
|
formatador (0.2.5)
|
39
|
-
growl (1.0.3)
|
40
39
|
guard (2.10.5)
|
41
40
|
formatador (>= 0.2.4)
|
42
41
|
listen (~> 2.7)
|
@@ -105,13 +104,11 @@ PLATFORMS
|
|
105
104
|
DEPENDENCIES
|
106
105
|
activerecord (>= 3.0)
|
107
106
|
countries
|
108
|
-
growl
|
109
107
|
guard (~> 2.10.1)
|
110
108
|
guard-bundler (~> 2.0.0)
|
111
109
|
guard-rspec (~> 4.2.0)
|
112
110
|
mongoid (>= 3.0)
|
113
111
|
phony_rails!
|
114
112
|
rake
|
115
|
-
rb-fsevent
|
116
113
|
rspec (~> 2.14.0)
|
117
114
|
sqlite3
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# PhonyRails
|
1
|
+
# PhonyRails [![Build Status](https://travis-ci.org/joost/phony_rails.svg?branch=master)](https://travis-ci.org/joost/phony_rails)
|
2
2
|
|
3
3
|
This small Gem adds useful methods to your Rails app to validate, display and save phone numbers.
|
4
4
|
It uses the super awesome Phony gem (https://github.com/floere/phony).
|
data/lib/phony_rails/version.rb
CHANGED
data/lib/phony_rails.rb
CHANGED
@@ -33,7 +33,12 @@ module PhonyRails
|
|
33
33
|
end
|
34
34
|
elsif _default_country_number = options[:default_country_number] || country_number_for(options[:default_country_code])
|
35
35
|
options[:add_plus] = true if options[:add_plus].nil?
|
36
|
-
|
36
|
+
# We try to add the default country number and see if it is a
|
37
|
+
# correct phone number. See https://github.com/joost/phony_rails/issues/87#issuecomment-89324426
|
38
|
+
if Phony.plausible?("#{_default_country_number}#{number}") || !Phony.plausible?(number) || country_code_from_number(number).nil?
|
39
|
+
number = "#{_default_country_number}#{number}"
|
40
|
+
end
|
41
|
+
# number = "#{_default_country_number}#{number}" unless Phony.plausible?(number)
|
37
42
|
end
|
38
43
|
normalized_number = Phony.normalize(number)
|
39
44
|
options[:add_plus] = true if options[:add_plus].nil? && Phony.plausible?(normalized_number)
|
@@ -89,19 +89,24 @@ describe PhonyRails do
|
|
89
89
|
describe "specific tests from issues" do
|
90
90
|
|
91
91
|
# https://github.com/joost/phony_rails/issues/79
|
92
|
-
it "should pass
|
92
|
+
it "should pass Github issue #42" do
|
93
93
|
"8887716095".phony_formatted(format: :international, normalize: 'US', raise: true).should eq('+1 888 771 6095')
|
94
94
|
end
|
95
95
|
|
96
96
|
# https://github.com/joost/phony_rails/issues/42
|
97
|
-
it "should pass
|
97
|
+
it "should pass Github issue #42" do
|
98
98
|
PhonyRails.normalize_number("0606060606", default_country_code: 'FR').should eq('+33606060606')
|
99
99
|
end
|
100
100
|
|
101
|
-
it "should pass
|
101
|
+
it "should pass Github issue #85" do
|
102
102
|
PhonyRails.normalize_number("47386160", default_country_code: 'NO').should eq('+4747386160')
|
103
103
|
PhonyRails.normalize_number("47386160", country_number: '47').should eq('+4747386160')
|
104
104
|
end
|
105
|
+
|
106
|
+
it "should pass Github issue #87" do
|
107
|
+
PhonyRails.normalize_number('2318725305', country_code: 'US').should eq('+12318725305')
|
108
|
+
PhonyRails.normalize_number('2318725305', default_country_code: 'US').should eq('+12318725305')
|
109
|
+
end
|
105
110
|
end
|
106
111
|
|
107
112
|
it "should not change original String" do
|
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.
|
4
|
+
version: 0.12.2
|
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-04-
|
11
|
+
date: 2015-04-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: phony
|
@@ -96,6 +96,7 @@ extra_rdoc_files: []
|
|
96
96
|
files:
|
97
97
|
- ".gitignore"
|
98
98
|
- ".rspec"
|
99
|
+
- ".travis.yml"
|
99
100
|
- Gemfile
|
100
101
|
- Gemfile.lock
|
101
102
|
- Guardfile
|