Skip to content

Commit a171af1

Browse files
authored
Merge pull request #554 from RamiliaNigmatullina/add-toll-free-number-support-for-colombia-and-ecuador
Add toll-free 1800 number support for Colombia and Ecuador
2 parents 35d114a + 9c88fb7 commit a171af1

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

lib/phony/countries.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@
229229
# Colombia.
230230
# http://www.itu.int/oth/T020200002C/en
231231
country '57',
232+
match(/\A(1800)\d+\z/) >> split(3, 4) | # toll free 1800 numbers
232233
match(/\A(3\d\d)\d+\z/) >> split(3, 4) | # mobile (300 310 311 312 313 315 316)
233234
match(/\A(60\d)\d+\z/) >> split(3, 4) |
234235
fixed(1) >> split(3, 4)
@@ -899,6 +900,7 @@
899900
# https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=EC&current_page=1
900901
# https://en.wikipedia.org/wiki/Telephone_numbers_in_Ecuador
901902
country '593',
903+
match(/\A(1800)\d+\z/) >> split(3, 3) | # toll free 1800 numbers
902904
one_of('9') >> split(4, 4) |
903905
match(/\A([\d]{2})\d{7}\z/) >> split(3, 4) |
904906
fixed(1) >> split(3, 4)

spec/functional/plausibility_spec.rb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,14 +188,16 @@ def self.it_is_correct_for(country_name, options = {})
188188
expect(Phony).to be_plausible('+359 999 123456')
189189
end
190190

191-
it_is_correct_for 'Colombia', samples: ['+57 601 411 1899',
191+
it_is_correct_for 'Colombia', samples: ['+57 300 111 2222',
192+
'+57 601 411 1899',
192193
'+57 602 111 2222',
193194
'+57 603 111 2222',
194195
'+57 604 111 2222',
195196
'+57 605 111 2222',
196197
'+57 606 111 2222',
197198
'+57 607 111 2222',
198-
'+57 608 111 2222']
199+
'+57 608 111 2222',
200+
'+57 1800 111 2222']
199201
it_is_correct_for 'Congo', samples: '+242 1234 56789'
200202
it_is_correct_for 'Cook Islands', samples: '+682 71928'
201203
it_is_correct_for 'Costa Rica', samples: '+506 2 234 5678'
@@ -240,6 +242,7 @@ def self.it_is_correct_for(country_name, options = {})
240242
expect(Phony).to be_plausible('+593 7 400 0000')
241243
expect(Phony).to be_plausible('+593 7 600 0000')
242244
expect(Phony).to be_plausible('+593 9 0000 0000') # mobile
245+
expect(Phony).to be_plausible('+593 1800 000 000') # toll free
243246
end
244247

245248
it_is_correct_for 'Equatorial Guinea', samples: ['+240 222 201 123',

0 commit comments

Comments
 (0)