Class: AuthKeyHeader

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(header_name: nil, val: nil) ⇒ AuthKeyHeader

Returns a new instance of AuthKeyHeader.



95
96
97
98
# File 'lib/one_doc.rb', line 95

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

Instance Attribute Details

#header_nameObject

Returns the value of attribute header_name.



93
94
95
# File 'lib/one_doc.rb', line 93

def header_name
  @header_name
end

#valObject

Returns the value of attribute val.



93
94
95
# File 'lib/one_doc.rb', line 93

def val
  @val
end

Instance Method Details

#add_auth(http_client, req_kwargs) ⇒ Object



100
101
102
103
104
105
106
107
108
# File 'lib/one_doc.rb', line 100

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

  return http_client, req_kwargs
end