phony 2.2.14 → 2.2.15
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.
- checksums.yaml +8 -8
- data/README.textile +22 -0
- data/lib/phony/countries/netherlands.rb +1 -1
- data/spec/functional/plausibility_spec.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MDVjMDIxMGQ4ZTkyZGM3MWQ0YzAzNTAzMjM3OTA1OTc3MzU4Y2Q0ZA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZTU1MjQ2YWM2NGVjN2YxNTFjZjIyMmY4MjQ2MGUzYTMzMzRhNTQ3Yw==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NDA4YjdhYTk0MGE4MTkxMzNhZWE5MDZiOWJlMTRkMGQ1YWJiZDVmZjdhNTc4
|
10
|
+
ZDA2YjliYTYyMzc2NWEzYzljYWMyYWVjNjFmMjA2YmY5Y2ZkZjI3OTA2NWNl
|
11
|
+
MmY3Y2UzODg3MWY2OGMwYTMxYzQ1NzAyZDdiMzk4MjRlMzFmMmU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NDI1NGJjOWQ5MDgyZDhhZGRiMGI0MjE4OWZhNDAzYmViZGZlMTBjYTFjMmQx
|
14
|
+
N2JlMzIyY2U3OTIxNDYxOTk4NDkxNmViZGJiZjFjNWM3ZDg4ODljZTJkNzVm
|
15
|
+
ZjEyOWNiM2Y2Zjg0OGI3MThiOWRmMGY0YjI0MDIwODc5ZjZiYzk=
|
data/README.textile
CHANGED
@@ -4,6 +4,8 @@
|
|
4
4
|
|
5
5
|
h1. Phony
|
6
6
|
|
7
|
+
Warning: International numbers only, such as @+61 412 345 678@!
|
8
|
+
|
7
9
|
The (admittedly crazy) goal of this Gem is to be able to format/split all phone numbers in the world.
|
8
10
|
|
9
11
|
Used in: "airbnb.com":http://airbnb.com, "restorm.com":http://restorm.com, "socialcam.com":http://socialcam.com, "zendesk.com":http://www.zendesk.com/ (and many, many others).
|
@@ -51,6 +53,8 @@ Note that you can add constraints to the plausibility check like the country cod
|
|
51
53
|
|
52
54
|
@Phony.plausible?('hello').should be_false@
|
53
55
|
|
56
|
+
Always use it with a country code, as Phony needs it to know what country to check:
|
57
|
+
|
54
58
|
@Phony.plausible?('+41 44 111 22 33').should be_true@
|
55
59
|
|
56
60
|
@Phony.plausible?('+41 44 111 22 33', cc: '41').should be_true@
|
@@ -71,6 +75,12 @@ h3(#normalizing). Normalizing
|
|
71
75
|
|
72
76
|
This will often raise an error if you try normalizing a non E164-izable number (a number that does not contain enough information to be normalized into an E164 conform number). Use @Phony.plausible?@ for checking if it can be normalized first.
|
73
77
|
|
78
|
+
Example:
|
79
|
+
|
80
|
+
@Phony.normalize('364 35 33')@ No. Wrong. Nada.
|
81
|
+
|
82
|
+
Always use it with a country code, as Phony needs it to know what country to normalize for:
|
83
|
+
|
74
84
|
@Phony.normalize('41443643533').should == '41443643533'@
|
75
85
|
|
76
86
|
@Phony.normalize('+41 44 364 35 33').should == '41443643533'@
|
@@ -93,6 +103,12 @@ h3(#formatting). Formatting
|
|
93
103
|
|
94
104
|
Aliased as @Phony.formatted(number_string)@.
|
95
105
|
|
106
|
+
You really need to give it a normalized phone number WITH country code, so:
|
107
|
+
|
108
|
+
@Phony.format('3643532')@ This is bad.
|
109
|
+
|
110
|
+
These, however, are splendid:
|
111
|
+
|
96
112
|
@Phony.format('41443643532').should == '+41 44 364 35 32'@
|
97
113
|
|
98
114
|
@Phony.format('41800112233').should == '+41 800 11 22 33'@
|
@@ -159,6 +175,12 @@ h4(#local). Local
|
|
159
175
|
|
160
176
|
h3(#splitting). Splitting
|
161
177
|
|
178
|
+
You really need to give it a normalized phone number WITH country code, so:
|
179
|
+
|
180
|
+
@Phony.split('3643532')@ This … no.
|
181
|
+
|
182
|
+
Phony is happy with these:
|
183
|
+
|
162
184
|
@Phony.split('43198110').should == ['43', '1', '98110']@
|
163
185
|
|
164
186
|
@Phony.split('33112345678').should == ['33', '1', '12','34','56','78']@
|
@@ -56,7 +56,7 @@ service3 = [
|
|
56
56
|
Phony.define do
|
57
57
|
country '31',
|
58
58
|
one_of(service) >> split(4,3) |
|
59
|
-
one_of(service3) >> split(
|
59
|
+
one_of(service3) >> split(4,3) |
|
60
60
|
one_of('6') >> split(2,2,2,2) | # mobile
|
61
61
|
one_of(ndcs) >> split(3,4) | # landline (geographic region)
|
62
62
|
fixed(3) >> split(3,3) # 3 digit ndc
|
@@ -288,7 +288,7 @@ describe 'plausibility' do
|
|
288
288
|
Phony.plausible?('+31 221 123 56').should be_false
|
289
289
|
Phony.plausible?('+31 880 450 245').should be_true
|
290
290
|
Phony.plausible?('+31 880 450 24').should be_false
|
291
|
-
Phony.plausible?('+31 900
|
291
|
+
Phony.plausible?('+31 900 123 4567').should be_true
|
292
292
|
Phony.plausible?('+31 900 001 00').should be_false
|
293
293
|
end
|
294
294
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: phony
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Florian Hanke
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-08-
|
11
|
+
date: 2014-08-28 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: ! 'Fast international phone number (E164 standard) normalizing, splitting
|
14
14
|
and formatting. Lots of formatting options: International (+.., 00..), national
|