Class: HttpLog::Request

Inherits:
Object
  • Object
show all
Includes:
Mongoid::Document, Mongoid::Timestamps
Defined in:
app/models/http_log/request.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from_request(rack) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'app/models/http_log/request.rb', line 17

def self.from_request(rack)
  new do |req|
    req.http_method = rack.request_method
    req.url = rack.url
    req.headers = rack.header_hash
    req.params = rack.params
    req.user_agent = rack.user_agent
    req.content_type = rack.content_type
    req.raw_post = rack.raw_post
    req.remote_ip = rack.ip
    req.cookies = rack.cookies
  end
end

Instance Method Details

#acceptObject



31
32
33
# File 'app/models/http_log/request.rb', line 31

def accept
  headers['HTTP_ACCEPT'].present? ? headers['HTTP_ACCEPT'] : nil
end