class Faraday::ProxyOptions

ProxyOptions contains the configurable properties for the proxy configuration used when making an HTTP request.

{.from} also accepts a proxy URL (a String, with http:// assumed when it has no scheme) or a URI.

@example

ProxyOptions.from('http://user:pass@proxy.example.org:8080')
ProxyOptions.new(uri: 'http://proxy.example.org', user: 'user')

Constants

COERCIONS
MEMBERS

Attributes

@!attribute [rw] user

@return [String, nil] the proxy server username, the unescaped user of
  the {#uri} unless set

@!attribute [rw] password

@return [String, nil] the proxy server password, the unescaped password
  of the {#uri} unless set

@return [URI] the proxy server URI

@!attribute [rw] user

@return [String, nil] the proxy server username, the unescaped user of
  the {#uri} unless set

@!attribute [rw] password

@return [String, nil] the proxy server password, the unescaped password
  of the {#uri} unless set

Public Class Methods

Create new instance from a URL, URI, hash or existing instance.

@param value [nil, String, URI, Hash, OptionsLike] the value to convert @return [ProxyOptions]

Calls superclass method Faraday::BaseOptions::from
# File lib/faraday/options/proxy_options.rb, line 39
def from(value)
  case value
  when '', false
    new
  when String
    # URIs without a scheme should default to http (like 'example:123').
    # This fixes #1282 and prevents a silent failure in some adapters.
    value = "http://#{value}" unless value.include?('://')
    new(uri: value)
  when URI
    new(uri: value)
  else
    super
  end
end

Public Instance Methods

# File lib/faraday/options/proxy_options.rb, line 61
def password
  @password = unescaped_uri_part(:password) if @password.nil?
  @password
end
# File lib/faraday/options/proxy_options.rb, line 56
def user
  @user = unescaped_uri_part(:user) if @user.nil?
  @user
end