#! /usr/bin/ruby# A ruby class for sending notifications to Prowl.require'uri'require'net/http'require'net/https'classStringdefurlencodegsub(/[^a-zA-Z0-9\-_\.!~*'()]/n){|x|sprintf('%%%02x',x[0])}endendclassHashdefurlencodecollect{|k,v|"#{k.to_s.urlencode}=#{v.to_s.urlencode}"}.join('&')endendclassProwlerdefinitializeuser,pass@url=URI.parse('https://prowl.weks.net/api/add_notification.php')@username=user@password=pass@http=Net::HTTP.new(@url.host,@url.port)@http.use_ssl=trueenddefsend_notificationapp,evt,descoptions={'application'=>app,'event'=>evt,'description'=>desc}req=Net::HTTP::Get.new("#{@url.path}?#{options.urlencode}")req.basic_auth@username,@password@http.request(req)endend# How to use?# p = Prowler.new('username', 'password')# p.send_notification('App','Event','Desc')