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
148 def initialize(*)
149   super
150   @auth_token_value = @auth_header_value = nil
151 end

Public Instance methods

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