A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://seleniumhq.github.io/selenium/docs/api/rb/Selenium/WebDriver/Proxy.html below:

Proxy — Documentation by YARD 0.9.37

Class: Selenium::WebDriver::Proxy
Inherits:
Object show all
Defined in:
rb/lib/selenium/webdriver/common/proxy.rb
Constant Summary collapse
TYPES =
{
  direct: 'DIRECT',   manual: 'MANUAL',   pac: 'PAC',   auto_detect: 'AUTODETECT',   system: 'SYSTEM' }.freeze
ALLOWED =
{type: 'proxyType',
ftp: 'ftpProxy',
http: 'httpProxy',
no_proxy: 'noProxy',
pac: 'proxyAutoconfigUrl',
ssl: 'sslProxy',
auto_detect: 'autodetect',
socks: 'socksProxy',
socks_username: 'socksUsername',
socks_password: 'socksPassword',
socks_version: 'socksVersion'}.freeze
Class Method Summary collapse Instance Method Summary collapse Constructor Details #initialize(opts = {}) ⇒ Proxy

Returns a new instance of Proxy.

58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'rb/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
Class Method Details .json_create(data) ⇒ Object
45
46
47
48
49
50
51
52
53
54
55
56
# File 'rb/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
Instance Method Details #==(other) ⇒ Object Also known as: eql?
74
75
76
# File 'rb/lib/selenium/webdriver/common/proxy.rb', line 74

def ==(other)
  other.is_a?(self.class) && as_json == other.as_json
end
#as_json ⇒ Object
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
# File 'rb/lib/selenium/webdriver/common/proxy.rb', line 143

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
  }.compact

  json_result if json_result.length > 1
end
#auto_detect=(bool) ⇒ Object
105
106
107
108
# File 'rb/lib/selenium/webdriver/common/proxy.rb', line 105

def auto_detect=(bool)
  self.type = :auto_detect
  @auto_detect = bool
end
#ftp=(value) ⇒ Object
79
80
81
82
83
# File 'rb/lib/selenium/webdriver/common/proxy.rb', line 79

def ftp=(value)
  WebDriver.logger.deprecate('FTP proxy support', nil, id: :ftp_proxy)
  self.type = :manual
  @ftp = value
end
#http=(value) ⇒ Object
85
86
87
88
# File 'rb/lib/selenium/webdriver/common/proxy.rb', line 85

def http=(value)
  self.type = :manual
  @http = value
end
#no_proxy=(value) ⇒ Object
90
91
92
93
# File 'rb/lib/selenium/webdriver/common/proxy.rb', line 90

def no_proxy=(value)
  self.type = :manual
  @no_proxy = value
end
#pac=(url) ⇒ Object
100
101
102
103
# File 'rb/lib/selenium/webdriver/common/proxy.rb', line 100

def pac=(url)
  self.type = :pac
  @pac = url
end
#socks=(value) ⇒ Object
110
111
112
113
# File 'rb/lib/selenium/webdriver/common/proxy.rb', line 110

def socks=(value)
  self.type = :manual
  @socks = value
end
#socks_password=(value) ⇒ Object
120
121
122
123
# File 'rb/lib/selenium/webdriver/common/proxy.rb', line 120

def socks_password=(value)
  self.type = :manual
  @socks_password = value
end
#socks_username=(value) ⇒ Object
115
116
117
118
# File 'rb/lib/selenium/webdriver/common/proxy.rb', line 115

def socks_username=(value)
  self.type = :manual
  @socks_username = value
end
#socks_version=(value) ⇒ Object
125
126
127
128
# File 'rb/lib/selenium/webdriver/common/proxy.rb', line 125

def socks_version=(value)
  self.type = :manual
  @socks_version = value
end
#ssl=(value) ⇒ Object
95
96
97
98
# File 'rb/lib/selenium/webdriver/common/proxy.rb', line 95

def ssl=(value)
  self.type = :manual
  @ssl = value
end
#to_json ⇒ Object
161
162
163
# File 'rb/lib/selenium/webdriver/common/proxy.rb', line 161

def to_json(*)
  JSON.generate as_json
end
#type=(type) ⇒ Object
130
131
132
133
134
135
136
137
138
139
140
141
# File 'rb/lib/selenium/webdriver/common/proxy.rb', line 130

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

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4