Class: ApiAuth::RequestDrivers::HttpiRequest
- Inherits:
-
Object
- Object
- ApiAuth::RequestDrivers::HttpiRequest
show all
- Includes:
- Helpers
- Defined in:
- lib/api_auth/request_drivers/httpi.rb
Overview
Instance Method Summary
collapse
Methods included from Helpers
#b64_encode, #capitalize_keys, #md5_base64digest
Constructor Details
Returns a new instance of HttpiRequest.
9
10
11
12
13
|
# File 'lib/api_auth/request_drivers/httpi.rb', line 9
def initialize(request)
@request = request
@headers =
true
end
|
Instance Method Details
66
67
68
|
# File 'lib/api_auth/request_drivers/httpi.rb', line 66
def
%w(Authorization AUTHORIZATION HTTP_AUTHORIZATION)
end
|
#calculated_md5 ⇒ Object
21
22
23
|
# File 'lib/api_auth/request_drivers/httpi.rb', line 21
def calculated_md5
md5_base64digest(@request.body || '')
end
|
#content_md5 ⇒ Object
48
49
50
51
|
# File 'lib/api_auth/request_drivers/httpi.rb', line 48
def content_md5
value = (%w(CONTENT-MD5 CONTENT_MD5))
value.nil? ? "" : value
end
|
#content_type ⇒ Object
43
44
45
46
|
# File 'lib/api_auth/request_drivers/httpi.rb', line 43
def content_type
value = (%w(CONTENT-TYPE CONTENT_TYPE HTTP_CONTENT_TYPE))
value.nil? ? "" : value
end
|
39
40
41
|
# File 'lib/api_auth/request_drivers/httpi.rb', line 39
def
capitalize_keys @request.
end
|
#md5_mismatch? ⇒ Boolean
31
32
33
34
35
36
37
|
# File 'lib/api_auth/request_drivers/httpi.rb', line 31
def md5_mismatch?
if @request.body
calculated_md5 != content_md5
else
false
end
end
|
#populate_content_md5 ⇒ Object
25
26
27
28
29
|
# File 'lib/api_auth/request_drivers/httpi.rb', line 25
def populate_content_md5
if @request.body
@request.["Content-MD5"] = calculated_md5
end
end
|
#request_uri ⇒ Object
53
54
55
|
# File 'lib/api_auth/request_drivers/httpi.rb', line 53
def request_uri
@request.url.request_uri
end
|
15
16
17
18
19
|
# File 'lib/api_auth/request_drivers/httpi.rb', line 15
def ()
@request.["Authorization"] =
@headers =
@request
end
|
#set_date ⇒ Object
57
58
59
|
# File 'lib/api_auth/request_drivers/httpi.rb', line 57
def set_date
@request.["DATE"] = Time.now.utc.httpdate
end
|
#timestamp ⇒ Object
61
62
63
64
|
# File 'lib/api_auth/request_drivers/httpi.rb', line 61
def timestamp
value = (%w(DATE HTTP_DATE))
value.nil? ? "" : value
end
|