Attributes
| auth_token_value | [R] |
Public Class methods
new(*)
[show source]
# File lib/httpx/plugins/auth.rb 147 def initialize(*) 148 super 149 @auth_token_value = @auth_header_value = nil 150 end
Public Instance methods
authorize(auth_value)
[show source]
# File lib/httpx/plugins/auth.rb 164 def authorize(auth_value) 165 @auth_header_value = auth_value 166 if (auth_type = @options.auth_header_type) 167 @auth_header_value = "#{auth_type} #{@auth_header_value}" 168 end 169 170 @headers.add("authorization", @auth_header_value) 171 172 @auth_token_value = auth_value 173 end
authorized?()
[show source]
# File lib/httpx/plugins/auth.rb 152 def authorized? 153 !@auth_token_value.nil? 154 end
unauthorize!()
[show source]
# File lib/httpx/plugins/auth.rb 156 def unauthorize! 157 return unless (auth_value = @auth_header_value) 158 159 @headers.get("authorization").delete(auth_value) 160 161 @auth_token_value = @auth_header_value = nil 162 end