daddyz / phonelib

Ruby gem for phone validation and formatting using google libphonenumber library data
MIT License
1.08k stars 131 forks source link

Changed bahavior upgrading from 0.8.0 to 0.8.1 #303

Closed tilo closed 4 months ago

tilo commented 8 months ago

looks like the API for PhoneLib changed from version 0.8.0 to 0.8.1

before you could do this:

phone = Phonelib.parse(phone_number, ["US", "CA"])

now you have to do this:

phone = nil
phone ||= Phonelib.parse(phone_number, "US")
phone ||= Phonelib.parse(phone_number, "CA")
tilo commented 5 months ago

@daddyz did you see this?

daddyz commented 4 months ago

@tilo interesting undocumented behavior. I never saw that method being used like that, it's not documented and not tested. I tried it locally on 0.8.9 and it works. Can you specify your ruby version?

tilo commented 4 months ago

@tilo interesting undocumented behavior. I never saw that method being used like that, it's not documented and not tested. I tried it locally on 0.8.9 and it works. Can you specify your ruby version?

@daddyz we're using Ruby 3.2.2

daddyz commented 4 months ago

@tilo can you test latest version?

daddyz commented 4 months ago

regardless, there is a configuration option that allows several countries:

Phonelib.default_country = ['US', 'CA']
phone = Phonelib.parse(phone_number)
daddyz commented 4 months ago

@tilo check version 0.9.1, I saw this happening for possible numbers only, with valid numbers it was working properly

tilo commented 4 months ago

looks like our tests are passing with 0.9.1

daddyz commented 4 months ago

great, closing the issue