phony 2.2.13 → 2.2.14
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 +1 -1
- data/lib/phony.rb +1 -0
- data/lib/phony/countries.rb +1 -4
- data/lib/phony/countries/croatia.rb +25 -0
- data/spec/functional/plausibility_spec.rb +20 -6
- data/spec/lib/phony/countries_spec.rb +3 -2
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NWUyMTkyYzI5ZGQyMGI3YjczZWQzNDJjY2U1NzZjYWQ2ZWJlNGFkYw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OGU1NjMxZDk2OTQzYTM4OWUyNTNmNTUwYmI0NjliMTdhYWZkZDJkYw==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
OThkNWQ5OWQ1NzAxYjNmZDdlYzUyZTlkZjExN2Q0MDg3N2JhNmRlNzdmY2Y4
|
10
|
+
NjEwYjViMjljMmQ0N2RlZTg5MzM0NWYxMzlmOWNiOTEzYWM2MTM1ODc0MTQw
|
11
|
+
NDg2ZjFjYzA0OTJjZmY0MzM5MmY0MzMzNTg0ZmZhN2NhMjI5YzA=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NjRjNGQxOWIwYzcyNjk0ZTcwMWFjN2YxZmIyZjRjYjUyMGUyZjZlMjgxNTUw
|
14
|
+
MTMzYTNhMjM5Y2YyYTI1MmNlZTdlMTY5ZTg4NDE4NDM2OWI4MjIyODZjM2Mz
|
15
|
+
YTk5NGFiMmQyMWM4MTY3ZDBhNjc1OGUyY2YzYzRlNjg3ZGE4NTQ=
|
data/README.textile
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
"!{float:right}https://secure.travis-ci.org/floere/phony.png!":http://travis-ci.org/floere/phony
|
2
2
|
"!https://codeclimate.com/github/floere/phony.png!":https://codeclimate.com/github/floere/phony
|
3
|
-
!http://inch-
|
3
|
+
!http://inch-ci.org/github/floere/phony.png!:http://inch-ci.org/github/floere/phony
|
4
4
|
|
5
5
|
h1. Phony
|
6
6
|
|
data/lib/phony.rb
CHANGED
@@ -25,6 +25,7 @@ require File.expand_path '../phony/countries/bangladesh', __FILE__
|
|
25
25
|
require File.expand_path '../phony/countries/belarus', __FILE__
|
26
26
|
require File.expand_path '../phony/countries/brazil', __FILE__
|
27
27
|
require File.expand_path '../phony/countries/cambodia', __FILE__
|
28
|
+
require File.expand_path '../phony/countries/croatia', __FILE__
|
28
29
|
require File.expand_path '../phony/countries/china', __FILE__
|
29
30
|
require File.expand_path '../phony/countries/georgia', __FILE__
|
30
31
|
require File.expand_path '../phony/countries/germany', __FILE__
|
data/lib/phony/countries.rb
CHANGED
@@ -624,10 +624,7 @@ Phony.define do
|
|
624
624
|
country '383', todo # -
|
625
625
|
country '384', todo # -
|
626
626
|
|
627
|
-
# Croatia.
|
628
|
-
#
|
629
|
-
country = country '385', one_of('1') >> split(3, 5) | # Zagreb
|
630
|
-
fixed(2) >> split(3, 5) # 2-digit NDCs
|
627
|
+
# country '385' # Croatia, see special file.
|
631
628
|
|
632
629
|
country '386', fixed(2) >> split(3, 2, 2) # Slovenia
|
633
630
|
country '387', fixed(2) >> split(3,2,2) # Bosnia and Herzegovina
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# Croatia
|
2
|
+
#
|
3
|
+
# http://en.wikipedia.org/wiki/Telephone_numbers_in_Croatia
|
4
|
+
# http://dialcode.org/Europe/Croatia/
|
5
|
+
# http://www.howtocallabroad.com/croatia/
|
6
|
+
#
|
7
|
+
# Landline numbers are composed by a 2 digits area code + 6 fixed digits
|
8
|
+
# Mobile numbers are composed by a 2 digits prefix + 7 fixed digits
|
9
|
+
#
|
10
|
+
|
11
|
+
mobile = %w(
|
12
|
+
91
|
13
|
+
92
|
14
|
+
95
|
15
|
+
97
|
16
|
+
977
|
17
|
+
98
|
18
|
+
99
|
19
|
+
)
|
20
|
+
|
21
|
+
Phony.define do
|
22
|
+
country '385', one_of(mobile) >> split(3, 4) |
|
23
|
+
one_of('1') >> split(4, 3) | # Zagreb
|
24
|
+
fixed(2) >> split(3, 3) # 2-digit NDCs
|
25
|
+
end
|
@@ -259,13 +259,27 @@ describe 'plausibility' do
|
|
259
259
|
Phony.plausible?("+85523123456").should be_false # Fixed line (NDC + invalid A)
|
260
260
|
end
|
261
261
|
|
262
|
-
it
|
262
|
+
it 'is correct for Croatia' do
|
263
|
+
# Landline
|
264
|
+
expect(Phony.plausible?('+385 21 695900')).to be_true
|
265
|
+
expect(Phony.plausible?('+385 1 4566 666')).to be_true
|
266
|
+
|
267
|
+
expect(Phony.plausible?('+385 21 12345')).to be_false, "too short"
|
268
|
+
expect(Phony.plausible?('+385 21 1234567')).to be_false, "too long"
|
269
|
+
|
270
|
+
# Mobile
|
271
|
+
expect(Phony.plausible?('+385 91 896 7509')).to be_true
|
272
|
+
|
273
|
+
expect(Phony.plausible?('+385 91 123456')).to be_false, "too short"
|
274
|
+
end
|
275
|
+
|
276
|
+
it "is correct for Denmark" do
|
263
277
|
Phony.plausible?('+45 44 11 12 23 34').should be_false
|
264
278
|
Phony.plausible?('+45 44 11 12 2').should be_false
|
265
279
|
Phony.plausible?('+45 44 55 22 33').should be_true
|
266
280
|
end
|
267
281
|
|
268
|
-
it 'is correct for
|
282
|
+
it 'is correct for Netherlands' do
|
269
283
|
Phony.plausible?('+31 6 12 34 56 78').should be_true
|
270
284
|
Phony.plausible?('+31 6 12 34 56 7').should be_false
|
271
285
|
Phony.plausible?('+31 20 123 5678').should be_true
|
@@ -278,7 +292,7 @@ describe 'plausibility' do
|
|
278
292
|
Phony.plausible?('+31 900 001 00').should be_false
|
279
293
|
end
|
280
294
|
|
281
|
-
it 'is correct for
|
295
|
+
it 'is correct for Egypt' do
|
282
296
|
Phony.plausible?('+20 800 1234567').should be_true
|
283
297
|
Phony.plausible?('+20 800 12345678').should be_false
|
284
298
|
Phony.plausible?('+20 2 12345678').should be_true
|
@@ -287,7 +301,7 @@ describe 'plausibility' do
|
|
287
301
|
Phony.plausible?('+20 40 1234567').should be_false
|
288
302
|
end
|
289
303
|
|
290
|
-
it 'is correct for
|
304
|
+
it 'is correct for Germany' do
|
291
305
|
Phony.plausible?('+49 209 169 - 0').should be_true # Gelsenkirchen
|
292
306
|
Phony.plausible?('+49 209 169 - 3530').should be_true # Gelsenkirchen
|
293
307
|
Phony.plausible?('+49 40 123 45678').should be_true
|
@@ -326,12 +340,12 @@ describe 'plausibility' do
|
|
326
340
|
Phony.plausible?('+49 40 12345678901').should be_true
|
327
341
|
end
|
328
342
|
|
329
|
-
it 'is correct for
|
343
|
+
it 'is correct for Israel' do
|
330
344
|
Phony.plausible?('+972 2 123 1234').should be_true
|
331
345
|
Phony.plausible?('+972 59 123 1234').should be_true
|
332
346
|
end
|
333
347
|
|
334
|
-
it 'is correct for
|
348
|
+
it 'is correct for Italy' do
|
335
349
|
Phony.plausible?('+39 06 1234 4567').should be_true
|
336
350
|
|
337
351
|
Phony.plausible?('+39 035 00000').should be_false
|
@@ -147,8 +147,9 @@ describe 'country descriptions' do
|
|
147
147
|
it_splits '573101234567', ['57', '310', '123', '4567'] # mobile
|
148
148
|
end
|
149
149
|
describe 'Croatia' do
|
150
|
-
it_splits '
|
151
|
-
it_splits '
|
150
|
+
it_splits '38521695900', %w( 385 21 695 900 ) # Landline
|
151
|
+
it_splits '38514566666', %w( 385 1 4566 666 ) # Landline (Zagreb)
|
152
|
+
it_splits '385918967509', %w( 385 91 896 7509 ) # Mobile
|
152
153
|
end
|
153
154
|
describe 'Cuba' do
|
154
155
|
it_splits '5351231234', ['53', '5123', '1234'] # Mobile
|
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.14
|
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-
|
11
|
+
date: 2014-08-04 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
|
@@ -25,6 +25,7 @@ files:
|
|
25
25
|
- lib/phony/countries/brazil.rb
|
26
26
|
- lib/phony/countries/cambodia.rb
|
27
27
|
- lib/phony/countries/china.rb
|
28
|
+
- lib/phony/countries/croatia.rb
|
28
29
|
- lib/phony/countries/georgia.rb
|
29
30
|
- lib/phony/countries/germany.rb
|
30
31
|
- lib/phony/countries/india.rb
|