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 42 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 55 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 70 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 132 def as_json(*) json_result = { 'proxyType' => TYPES[type], 'ftpProxy' => ftp, 'httpProxy' => http, 'noProxy' => no_proxy, 'proxyAutoconfigUrl' => pac, 'sslProxy' => ssl, 'autodetect' => auto_detect, 'socksProxy' => socks, 'socksUsername' => socks_username, 'socksPassword' => socks_password }.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 100 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 75 def ftp=(value) self.type = :manual @ftp = value end
http=(value)
click to toggle source
# File lib/selenium/webdriver/common/proxy.rb, line 80 def http=(value) self.type = :manual @http = value end
no_proxy=(value)
click to toggle source
# File lib/selenium/webdriver/common/proxy.rb, line 85 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 95 def pac=(url) self.type = :pac @pac = url end
socks=(value)
click to toggle source
# File lib/selenium/webdriver/common/proxy.rb, line 105 def socks=(value) self.type = :manual @socks = value end
socks_password=(value)
click to toggle source
# File lib/selenium/webdriver/common/proxy.rb, line 115 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 110 def socks_username=(value) self.type = :manual @socks_username = value end
ssl=(value)
click to toggle source
# File lib/selenium/webdriver/common/proxy.rb, line 90 def ssl=(value) self.type = :manual @ssl = value end
to_json(*)
click to toggle source
# File lib/selenium/webdriver/common/proxy.rb, line 149 def to_json(*) JSON.generate as_json end
type=(type)
click to toggle source
# File lib/selenium/webdriver/common/proxy.rb, line 120 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