Skip to content

Instantly share code, notes, and snippets.

@phwelo
Forked from milligramme/pushover.rb
Last active February 5, 2018 19:16
Show Gist options
  • Save phwelo/347b0b1e34cce5be4cca to your computer and use it in GitHub Desktop.
Save phwelo/347b0b1e34cce5be4cca to your computer and use it in GitHub Desktop.
[Pushover for Ruby] Pushover script for sending message to pushover from Ruby #Ruby #Pushover
require "net/https"
url = URI.parse("https://api.pushover.net/1/messages")
req = Net::HTTP::Post.new(url.path)
req.set_form_data({
:token => "abc123",
:user => "user123",
:message => "hello world",
})
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) }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment