module HTTPX::Plugins::Auth::RequestMethods

  1. lib/httpx/plugins/auth.rb

Methods

Public Class

  1. new

Public Instance

  1. auth_token_value
  2. authorize
  3. authorized?
  4. unauthorize!

Attributes

Public Class methods

new(*)
[show source]
    # File lib/httpx/plugins/auth.rb
153 def initialize(*)
154   super
155   @auth_token_value = @auth_header_value = nil
156 end

Public Instance methods

authorize(auth_value)
[show source]
    # File lib/httpx/plugins/auth.rb
170 def authorize(auth_value)
171   @auth_header_value = auth_value
172   if (auth_type = @options.auth_header_type)
173     @auth_header_value = "#{auth_type} #{@auth_header_value}"
174   end
175 
176   @headers.add("authorization", @auth_header_value)
177 
178   @auth_token_value = auth_value
179 end
authorized?()
[show source]
    # File lib/httpx/plugins/auth.rb
158 def authorized?
159   !@auth_token_value.nil?
160 end
unauthorize!()
[show source]
    # File lib/httpx/plugins/auth.rb
162 def unauthorize!
163   return unless (auth_value = @auth_header_value)
164 
165   @headers.get("authorization").delete(auth_value)
166 
167   @auth_token_value = @auth_header_value = nil
168 end