Module: HTTPX::Plugins::Auth::InstanceMethods

Defined in:
lib/httpx/plugins/auth.rb

Instance Method Summary collapse

Instance Method Details

#authorization(token = nil, auth_header_type: nil, &blk) ⇒ Object



43
44
45
# File 'lib/httpx/plugins/auth.rb', line 43

def authorization(token = nil, auth_header_type: nil, &blk)
  with(auth_header_type: auth_header_type, auth_header_value: token || blk)
end

#bearer_auth(token = nil, &blk) ⇒ Object



47
48
49
# File 'lib/httpx/plugins/auth.rb', line 47

def bearer_auth(token = nil, &blk)
  authorization(token, auth_header_type: "Bearer", &blk)
end

#initializeObject



36
37
38
39
40
41
# File 'lib/httpx/plugins/auth.rb', line 36

def initialize(*)
  super

  @auth_header_value = nil
  @skip_auth_header_value = false
end

#reset_auth_header_value!Object



58
59
60
# File 'lib/httpx/plugins/auth.rb', line 58

def reset_auth_header_value!
  @auth_header_value = nil
end

#skip_auth_headerObject



51
52
53
54
55
56
# File 'lib/httpx/plugins/auth.rb', line 51

def skip_auth_header
  @skip_auth_header_value = true
  yield
ensure
  @skip_auth_header_value = false
end