Module: HTTPX::Plugins::Auth::RequestMethods
- Defined in:
- lib/httpx/plugins/auth.rb
Instance Attribute Summary collapse
-
#auth_token_value ⇒ Object
readonly
Returns the value of attribute auth_token_value.
Instance Method Summary collapse
Instance Attribute Details
#auth_token_value ⇒ Object (readonly)
Returns the value of attribute auth_token_value.
145 146 147 |
# File 'lib/httpx/plugins/auth.rb', line 145 def auth_token_value @auth_token_value end |
Instance Method Details
#authorize(auth_value) ⇒ Object
164 165 166 167 168 169 170 171 172 173 |
# File 'lib/httpx/plugins/auth.rb', line 164 def (auth_value) @auth_header_value = auth_value if (auth_type = @options.auth_header_type) @auth_header_value = "#{auth_type} #{@auth_header_value}" end @headers.add("authorization", @auth_header_value) @auth_token_value = auth_value end |
#authorized? ⇒ Boolean
152 153 154 |
# File 'lib/httpx/plugins/auth.rb', line 152 def !@auth_token_value.nil? end |
#initialize ⇒ Object
147 148 149 150 |
# File 'lib/httpx/plugins/auth.rb', line 147 def initialize(*) super @auth_token_value = @auth_header_value = nil end |
#unauthorize! ⇒ Object
156 157 158 159 160 161 162 |
# File 'lib/httpx/plugins/auth.rb', line 156 def return unless (auth_value = @auth_header_value) @headers.get("authorization").delete(auth_value) @auth_token_value = @auth_header_value = nil end |