class Selenium::WebDriver::Proxy
Constants
- ALLOWED
- TYPES
Public Class Methods
json_create(data)
click to toggle source
# File lib/selenium/webdriver/common/proxy.rb, line 45 def self.json_create(data) data['proxyType'] = data['proxyType'].downcase.to_sym return if data['proxyType'] == :unspecified proxy = new ALLOWED.each do |k, v| proxy.send("#{k}=", data[v]) if data.key?(v) end proxy end
new(opts = {})
click to toggle source
# File lib/selenium/webdriver/common/proxy.rb, line 58 def initialize(opts = {}) not_allowed = [] opts.each do |k, v| if ALLOWED.key?(k) send("#{k}=", v) else not_allowed << k end end return if not_allowed.empty? raise ArgumentError, "unknown option#{'s' if not_allowed.size != 1}: #{not_allowed.inspect}" end
Public Instance Methods
==(other)
click to toggle source
# File lib/selenium/webdriver/common/proxy.rb, line 74 def ==(other) other.is_a?(self.class) && as_json == other.as_json end
Also aliased as: eql?
as_json(*)
click to toggle source
# File lib/selenium/webdriver/common/proxy.rb, line 142 def as_json(*) json_result = { 'proxyType' => TYPES[type].downcase, 'ftpProxy' => ftp, 'httpProxy' => http, 'noProxy' => no_proxy.is_a?(String) ? no_proxy.split(', ') : no_proxy, 'proxyAutoconfigUrl' => pac, 'sslProxy' => ssl, 'autodetect' => auto_detect, 'socksProxy' => socks, 'socksUsername' => socks_username, 'socksPassword' => socks_password, 'socksVersion' => socks_version }.delete_if { |_k, v| v.nil? } json_result if json_result.length > 1 end
auto_detect=(bool)
click to toggle source
# File lib/selenium/webdriver/common/proxy.rb, line 104 def auto_detect=(bool) self.type = :auto_detect @auto_detect = bool end
ftp=(value)
click to toggle source
# File lib/selenium/webdriver/common/proxy.rb, line 79 def ftp=(value) self.type = :manual @ftp = value end
http=(value)
click to toggle source
# File lib/selenium/webdriver/common/proxy.rb, line 84 def http=(value) self.type = :manual @http = value end
no_proxy=(value)
click to toggle source
# File lib/selenium/webdriver/common/proxy.rb, line 89 def no_proxy=(value) self.type = :manual @no_proxy = value end
pac=(url)
click to toggle source
# File lib/selenium/webdriver/common/proxy.rb, line 99 def pac=(url) self.type = :pac @pac = url end
socks=(value)
click to toggle source
# File lib/selenium/webdriver/common/proxy.rb, line 109 def socks=(value) self.type = :manual @socks = value end
socks_password=(value)
click to toggle source
# File lib/selenium/webdriver/common/proxy.rb, line 119 def socks_password=(value) self.type = :manual @socks_password = value end
socks_username=(value)
click to toggle source
# File lib/selenium/webdriver/common/proxy.rb, line 114 def socks_username=(value) self.type = :manual @socks_username = value end
socks_version=(value)
click to toggle source
# File lib/selenium/webdriver/common/proxy.rb, line 124 def socks_version=(value) self.type = :manual @socks_version = value end
ssl=(value)
click to toggle source
# File lib/selenium/webdriver/common/proxy.rb, line 94 def ssl=(value) self.type = :manual @ssl = value end
to_json(*)
click to toggle source
# File lib/selenium/webdriver/common/proxy.rb, line 160 def to_json(*) JSON.generate as_json end
type=(type)
click to toggle source
# File lib/selenium/webdriver/common/proxy.rb, line 129 def type=(type) unless TYPES.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