Module: HTTPX::Plugins::Auth::RequestMethods
- Defined in:
- lib/httpx/plugins/auth.rb
Instance Method Summary collapse
Instance Method Details
#authorize(auth_value) ⇒ Object
112 113 114 115 116 117 118 119 120 |
# File 'lib/httpx/plugins/auth.rb', line 112 def (auth_value) if (auth_type = .auth_header_type) auth_value = "#{auth_type} #{auth_value}" end @headers.add("authorization", auth_value) @auth_token_value = auth_value end |
#authorized? ⇒ Boolean
100 101 102 |
# File 'lib/httpx/plugins/auth.rb', line 100 def !@auth_token_value.nil? end |
#initialize ⇒ Object
95 96 97 98 |
# File 'lib/httpx/plugins/auth.rb', line 95 def initialize(*) super @auth_token_value = nil end |
#unauthorize! ⇒ Object
104 105 106 107 108 109 110 |
# File 'lib/httpx/plugins/auth.rb', line 104 def return unless (auth_value = @auth_token_value) @headers.get("authorization").delete(auth_value) @auth_token_value = nil end |