Skip to content

Instantly share code, notes, and snippets.

@simo2409
Created May 21, 2014 23:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save simo2409/3121ce8a4e6235b028ad to your computer and use it in GitHub Desktop.
Save simo2409/3121ce8a4e6235b028ad to your computer and use it in GitHub Desktop.
Pushover integration class for ruby
require "net/https"
class Pushover
def self.notify!(message)
url = URI.parse("https://api.pushover.net/1/messages.json")
req = Net::HTTP::Post.new(url.path)
req.set_form_data({
:token => "your-api-token",
:user => "your-user-key",
:message => message,
})
res = Net::HTTP.new(url.host, url.port)
res.use_ssl = true
res.verify_mode = OpenSSL::SSL::VERIFY_PEER
res.start {|http| http.request(req) }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment