sendgrid / sendgrid-ruby

The Official Twilio SendGrid Led, Community Driven Ruby API Library
https://sendgrid.com
MIT License
625 stars 322 forks source link

Fix: trying to add a nil substitution to a personalization throws an error #430

Closed traviskroberts closed 4 years ago

traviskroberts commented 4 years ago

Fixes

If you create a substitution with a nil value, the codebase throws an error if you try to add that substitution to a personalization.

personalization = SendGrid::Personalization.new
personalization.add_substitution(Sendgrid::Substitution.new(key: '%FIRST_NAME%", value: nil))

=> TypeError (no implicit conversion of nil into Hash)

My change will ignore any nil substitutions.

Checklist

If you have questions, please file a support ticket, or create a GitHub Issue in this repository.