Class: HTTPX::Plugins::Proxy::Parameters
- Inherits:
-
Object
- Object
- HTTPX::Plugins::Proxy::Parameters
- Extended by:
- Registry
- Defined in:
- lib/httpx/plugins/proxy.rb
Constant Summary
Constants included from Registry
Instance Attribute Summary collapse
-
#password ⇒ Object
readonly
Returns the value of attribute password.
-
#uri ⇒ Object
readonly
Returns the value of attribute uri.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
Instance Method Summary collapse
- #authenticated? ⇒ Boolean
-
#initialize(uri:, username: nil, password: nil) ⇒ Parameters
constructor
A new instance of Parameters.
- #token_authentication ⇒ Object
Methods included from Registry
Constructor Details
#initialize(uri:, username: nil, password: nil) ⇒ Parameters
Returns a new instance of Parameters.
16 17 18 19 20 |
# File 'lib/httpx/plugins/proxy.rb', line 16 def initialize(uri:, username: nil, password: nil) @uri = uri.is_a?(URI::Generic) ? uri : URI(uri) @username = username || @uri.user @password = password || @uri.password end |
Instance Attribute Details
#password ⇒ Object (readonly)
Returns the value of attribute password.
14 15 16 |
# File 'lib/httpx/plugins/proxy.rb', line 14 def password @password end |
#uri ⇒ Object (readonly)
Returns the value of attribute uri.
14 15 16 |
# File 'lib/httpx/plugins/proxy.rb', line 14 def uri @uri end |
#username ⇒ Object (readonly)
Returns the value of attribute username.
14 15 16 |
# File 'lib/httpx/plugins/proxy.rb', line 14 def username @username end |
Instance Method Details
#authenticated? ⇒ Boolean
22 23 24 |
# File 'lib/httpx/plugins/proxy.rb', line 22 def authenticated? @username && @password end |
#token_authentication ⇒ Object
26 27 28 |
# File 'lib/httpx/plugins/proxy.rb', line 26 def token_authentication Base64.strict_encode64("#{user}:#{password}") end |