module HTTPX::Plugins::Auth::InstanceMethods

  1. lib/httpx/plugins/auth.rb

Public Class methods

new(*)
[show source]
   # File lib/httpx/plugins/auth.rb
43 def initialize(*)
44   super
45 
46   @auth_header_value = nil
47   @auth_header_value_mtx = Thread::Mutex.new
48   @skip_auth_header_value = false
49 end

Public Instance methods

authorization(token = nil, auth_header_type: nil, &blk)
[show source]
   # File lib/httpx/plugins/auth.rb
51 def authorization(token = nil, auth_header_type: nil, &blk)
52   with(auth_header_type: auth_header_type, auth_header_value: token || blk)
53 end
bearer_auth(token = nil, &blk)
[show source]
   # File lib/httpx/plugins/auth.rb
55 def bearer_auth(token = nil, &blk)
56   authorization(token, auth_header_type: "Bearer", &blk)
57 end
reset_auth_header_value!()
[show source]
   # File lib/httpx/plugins/auth.rb
66 def reset_auth_header_value!
67   @auth_header_value_mtx.synchronize do
68     @auth_header_value = nil
69   end
70 end
skip_auth_header()
[show source]
   # File lib/httpx/plugins/auth.rb
59 def skip_auth_header
60   @skip_auth_header_value = true
61   yield
62 ensure
63   @skip_auth_header_value = false
64 end