class RealRand::OnlineGenerator
Attributes
host[R]
proxy_host[RW]
proxy_port[RW]
proxy_pwd[RW]
proxy_usr[RW]
ssl[RW]
Public Class Methods
new(host,ssl = false)
click to toggle source
# File lib/random/online.rb, line 16 def initialize(host,ssl = false) @host = host @ssl = ssl @proxy_host = nil @proxy_port = -1 @proxy_usr = nil @proxy_pwd = nil end
Protected Instance Methods
check_response(response)
click to toggle source
# File lib/random/online.rb, line 45 def check_response(response) return response end
get_response(script, parameters)
click to toggle source
# File lib/random/online.rb, line 27 def get_response(script, parameters) Net::HTTP::Proxy( @proxy_host, @proxy_port, @proxy_usr, @proxy_pwd ).start(@host,nil,:use_ssl => @ssl) { |h| response = h.get("#{script}?#{parameters}") if response.class == Net::HTTPOK return check_response(response) else handle_response_error(response) end } end
handle_response_error(response)
click to toggle source
# File lib/random/online.rb, line 49 def handle_response_error(response) raise "An HTTP error occured." end