lib/integrity/notifier/notifyio.rb in integrity-notifyio-0.1.6 vs lib/integrity/notifier/notifyio.rb in integrity-notifyio-0.2.0
- old
+ new
@@ -19,17 +19,19 @@
end
private
def post(emails, api_key, title, body)
+ return if emails.nil? || email.empty? || api_key.nil? || api_key.empty?
emails.split(',').each do |email|
email_hash = MD5.hexdigest(email.strip!)
- HTTParty.post "http://api.notify.io/v1/notify/#{email_hash}?api_key=#{api_key}", :body => {
- :type => 'regular',
- :title => title,
- :body => body,
- :generator => 'integrity-notifyio notifier'
- }
+ HTTParty.post "http://api.notify.io/v1/notify/#{email_hash}", :headers => {'content-type' => 'application/x-www-form-urlencoded'},
+ :body => {:api_key => api_key},
+ :query => {
+ :api_key => api_key,
+ :title => title,
+ :text => body
+ }
end
end
end