module HTTPX::Plugins::Auth::RequestMethods

  1. lib/httpx/plugins/auth.rb

Methods

Public Class

  1. new

Public Instance

  1. authorize
  2. authorized?
  3. unauthorize!

Public Class methods

new(*)
[show source]
   # File lib/httpx/plugins/auth.rb
95 def initialize(*)
96   super
97   @auth_token_value = nil
98 end

Public Instance methods

authorize(auth_value)
[show source]
    # File lib/httpx/plugins/auth.rb
112 def authorize(auth_value)
113   if (auth_type = @options.auth_header_type)
114     auth_value = "#{auth_type} #{auth_value}"
115   end
116 
117   @headers.add("authorization", auth_value)
118 
119   @auth_token_value = auth_value
120 end
authorized?()
[show source]
    # File lib/httpx/plugins/auth.rb
100 def authorized?
101   !@auth_token_value.nil?
102 end
unauthorize!()
[show source]
    # File lib/httpx/plugins/auth.rb
104 def unauthorize!
105   return unless (auth_value = @auth_token_value)
106 
107   @headers.get("authorization").delete(auth_value)
108 
109   @auth_token_value = nil
110 end