==(other)
click to toggle source
def ==(other)
other.kind_of?(self.class) && as_json == other.as_json
end
as_json(opts = nil)
click to toggle source
def as_json(opts = nil)
json_result = {
"proxyType" => TYPES[type]
}
json_result["ftpProxy"] = ftp if ftp
json_result["httpProxy"] = http if http
json_result["noProxy"] = no_proxy if no_proxy
json_result["proxyAutoconfigUrl"] = pac if pac
json_result["sslProxy"] = ssl if ssl
json_result["autodetect"] = auto_detect if auto_detect
json_result["socksProxy"] = socks if socks
json_result["socksUsername"] = socks_username if socks_username
json_result["socksPassword"] = socks_password if socks_password
json_result if json_result.length > 1
end
auto_detect=(bool)
click to toggle source
def auto_detect=(bool)
self.type = :auto_detect
@auto_detect = bool
end
ftp=(value)
click to toggle source
def ftp=(value)
self.type = :manual
@ftp = value
end
http=(value)
click to toggle source
def http=(value)
self.type = :manual
@http = value
end
no_proxy=(value)
click to toggle source
def no_proxy=(value)
self.type = :manual
@no_proxy = value
end
pac=(url)
click to toggle source
def pac=(url)
self.type = :pac
@pac = url
end
socks=(value)
click to toggle source
def socks=(value)
self.type = :manual
@socks = value
end
socks_password=(value)
click to toggle source
def socks_password=(value)
self.type = :manual
@socks_password = value
end
socks_username=(value)
click to toggle source
def socks_username=(value)
self.type = :manual
@socks_username = value
end
ssl=(value)
click to toggle source
def ssl=(value)
self.type = :manual
@ssl = value
end
to_json(*args)
click to toggle source
def to_json(*args)
WebDriver.json_dump as_json
end
type=(type)
click to toggle source
def type=(type)
unless TYPES.has_key? type
raise ArgumentError, "invalid proxy type: #{type.inspect}, expected one of #{TYPES.keys.inspect}"
end
if defined?(@type) && type != @type
raise ArgumentError, "incompatible proxy type #{type.inspect} (already set to #{@type.inspect})"
end
@type = type
end