lib/mailgun/client.rb in mailgun-ruby-1.1.3 vs lib/mailgun/client.rb in mailgun-ruby-1.1.4
- old
+ new
@@ -60,9 +60,14 @@
)
end
case data
when Hash
+ # Remove nil values from the data hash
+ # Submitting nils to the API will likely cause an error.
+ # See also: https://github.com/mailgun/mailgun-ruby/issues/32
+ data = data.select { |k, v| v != nil }
+
if data.key?(:message)
if data[:message].is_a?(String)
data[:message] = convert_string_to_file(data[:message])
end
return post("#{working_domain}/messages.mime", data)