Attributes
| auth_token_value | [R] |
Public Class methods
new(*)
[show source]
# File lib/httpx/plugins/auth.rb 102 def initialize(*) 103 super 104 @auth_token_value = @auth_header_value = nil 105 end
Public Instance methods
authorize(auth_value)
[show source]
# File lib/httpx/plugins/auth.rb 119 def authorize(auth_value) 120 @auth_header_value = auth_value 121 if (auth_type = @options.auth_header_type) 122 @auth_header_value = "#{auth_type} #{@auth_header_value}" 123 end 124 125 @headers.add("authorization", @auth_header_value) 126 127 @auth_token_value = auth_value 128 end
authorized?()
[show source]
# File lib/httpx/plugins/auth.rb 107 def authorized? 108 !@auth_token_value.nil? 109 end
unauthorize!()
[show source]
# File lib/httpx/plugins/auth.rb 111 def unauthorize! 112 return unless (auth_value = @auth_header_value) 113 114 @headers.get("authorization").delete(auth_value) 115 116 @auth_token_value = @auth_header_value = nil 117 end