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



50
51
52
# File 'lib/httpx/plugins/auth.rb', line 50

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



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

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

#initializeObject



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

def initialize(*)
  super

  @auth_header_value = nil
  @skip_auth_header_value = false
end

#reset_auth_header_value!Object



65
66
67
# File 'lib/httpx/plugins/auth.rb', line 65

def reset_auth_header_value!
  @auth_header_value = nil
end

#skip_auth_headerObject



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

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