Sends out the notice to Hoptoad
# File lib/hoptoad_notifier/sender.rb, line 7 def initialize(options = {}) [:proxy_host, :proxy_port, :proxy_user, :proxy_pass, :protocol, :host, :port, :secure, :http_open_timeout, :http_read_timeout].each do |option| instance_variable_set("@#{option}", options[option]) end end
Sends the notice data off to Hoptoad for processing.
@param [String] data The XML notice to be sent off
# File lib/hoptoad_notifier/sender.rb, line 17 def send_to_hoptoad(data) logger.debug { "Sending request to #{url.to_s}:\n#{data}" } if logger http = Net::HTTP::Proxy(proxy_host, proxy_port, proxy_user, proxy_pass). new(url.host, url.port) http.read_timeout = http_read_timeout http.open_timeout = http_open_timeout http.use_ssl = secure response = begin http.post(url.path, data, HEADERS) rescue TimeoutError => e log :error, "Timeout while contacting the Hoptoad server." nil end case response when Net::HTTPSuccess then log :info, "Success: #{response.class}", response else log :error, "Failure: #{response.class}", response end end
Generated with the Darkfish Rdoc Generator 2.