module HTTPX::Plugins::Auth::InstanceMethods

  1. lib/httpx/plugins/auth.rb

Public Class methods

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

Public Instance methods

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