HubspotCommunity / hubspot-ruby

Ruby wrappers for the HubSpot REST API
https://developers.hubspot.com/docs/endpoints
MIT License
190 stars 257 forks source link

Can this gem check the validity of an email address? #231

Open la-ruby opened 3 years ago

la-ruby commented 3 years ago

We have this error that appears in our logs:

{\"eventErrorEntityType\":\"INVALID_EMAIL_ADDRESS\",\"status\":\"error\",\"message\":\"invalid email: redacted@ymail.con\",\"correlationId\":\"e24c657a-36a6-4885-84dc4ab8111e3123\",\"invalidEmail\":\"redacted@ymail.con\",\"eventErrorEntityType\":\"INVALID_EMAIL_ADDRESS\"}"

It would be nice if the gem can provide a valid? method that uses the same regex Hubspot uses to check the validity of an email address.

Standard regexes like this one: VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-]+(\.[a-z]+)*\.[a-z]+\z/I doesn't the kind of issues Hubspot catches.