Class: DuoApi::HeaderSignature

Inherits:
Object
  • Object
show all
Includes:
Digesting, Util
Defined in:
lib/duo-api/header_signature.rb

Constant Summary

Constants included from Digesting

Digesting::DIGEST

Constants included from Util

Util::DuoApiError

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Digesting

#digest

Methods included from Util

#error_with_message, #stringify_hash

Constructor Details

#initialize(client, method, path, query_body_string) ⇒ HeaderSignature

Returns a new instance of HeaderSignature.



12
13
14
15
16
17
# File 'lib/duo-api/header_signature.rb', line 12

def initialize(client, method, path, query_body_string)
  @client = client
  @method = method
  @path = path
  @query_body_string = query_body_string
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



7
8
9
# File 'lib/duo-api/header_signature.rb', line 7

def client
  @client
end

#methodObject (readonly)

Returns the value of attribute method.



8
9
10
# File 'lib/duo-api/header_signature.rb', line 8

def method
  @method
end

#pathObject (readonly)

Returns the value of attribute path.



9
10
11
# File 'lib/duo-api/header_signature.rb', line 9

def path
  @path
end

#query_body_stringObject (readonly)

Returns the value of attribute query_body_string.



10
11
12
# File 'lib/duo-api/header_signature.rb', line 10

def query_body_string
  @query_body_string
end

Instance Method Details

#basic_authObject



19
20
21
22
23
24
# File 'lib/duo-api/header_signature.rb', line 19

def basic_auth
  username = client.integration_key
  password = digest(client.secret_key, body)

  [username, password]
end

#date_headerObject



26
27
28
# File 'lib/duo-api/header_signature.rb', line 26

def date_header
  @date_header ||= Time.now.utc.rfc2822
end