module HTTPX::Plugins::Auth::InstanceMethods

  1. lib/httpx/plugins/auth.rb

Public Class methods

new(*)
[show source]
   # File lib/httpx/plugins/auth.rb
64 def initialize(*)
65   super
66 
67   @auth_header_value = @auth_header_expires_at = nil
68   @auth_header_value_mtx = Thread::Mutex.new
69   @skip_auth_header_value = false
70 end

Public Instance methods

authorization(token = nil, auth_header_type: nil, &blk)
[show source]
   # File lib/httpx/plugins/auth.rb
72 def authorization(token = nil, auth_header_type: nil, &blk)
73   with(auth_header_type: auth_header_type, auth_header_value: token || blk)
74 end
bearer_auth(token = nil, &blk)
[show source]
   # File lib/httpx/plugins/auth.rb
76 def bearer_auth(token = nil, &blk)
77   authorization(token, auth_header_type: "Bearer", &blk)
78 end
reset_auth_header_value!()
[show source]
   # File lib/httpx/plugins/auth.rb
87 def reset_auth_header_value!
88   @auth_header_value_mtx.synchronize do
89     @auth_header_value = @auth_header_expires_at = nil
90   end
91 end
skip_auth_header()
[show source]
   # File lib/httpx/plugins/auth.rb
80 def skip_auth_header
81   @skip_auth_header_value = true
82   yield
83 ensure
84   @skip_auth_header_value = false
85 end