Skip to content

Instantly share code, notes, and snippets.

@ytkhs
Created May 22, 2014 12:53
Show Gist options
  • Select an option

  • Save ytkhs/dc333b353d093cf189a1 to your computer and use it in GitHub Desktop.

Select an option

Save ytkhs/dc333b353d093cf189a1 to your computer and use it in GitHub Desktop.
pushover ruby sample
# usage
# $ ruby pushover_sample.rb hogehoge
require "net/https"
url = URI.parse("https://api.pushover.net/1/messages")
req = Net::HTTP::Post.new(url.path)
req.set_form_data({
:token => "YOUR_TOKEN",
:user => "YOUR_NAME",
:message => ARGV[0] ||= 'EMPTY_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) }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment