Class: AuthBearer

Inherits:
Object
  • Object
show all
Includes:
AuthProvider
Defined in:
lib/one_doc.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(val: nil) ⇒ AuthBearer

Returns a new instance of AuthBearer.



54
55
56
# File 'lib/one_doc.rb', line 54

def initialize(val: nil)
  @val = val
end

Instance Attribute Details

#valObject

Returns the value of attribute val.



52
53
54
# File 'lib/one_doc.rb', line 52

def val
  @val
end

Instance Method Details

#add_auth(http_client, req_kwargs) ⇒ Object



58
59
60
61
62
63
64
65
66
# File 'lib/one_doc.rb', line 58

def add_auth(http_client, req_kwargs)
  if !@val.nil?
    headers = req_kwargs.fetch(:headers, {})
    headers["Authorization"] = "Bearer " + @val
    req_kwargs[:headers] = headers
  end

  return http_client, req_kwargs
end