Class: OhMyLog::Log::Request

Inherits:
Object
  • Object
show all
Defined in:
lib/oh_my_log/request.rb

Overview

the request is what the user is trying to do

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ Request

Returns a new instance of Request.



7
8
9
10
11
12
13
# File 'lib/oh_my_log/request.rb', line 7

def initialize(args)
  @sender = args[:sender]
  @date = args[:date]
  @params = args[:params]
  @method = args[:method]
  @status = args[:status]
end

Instance Attribute Details

#dateObject (readonly)

Returns the value of attribute date.



5
6
7
# File 'lib/oh_my_log/request.rb', line 5

def date
  @date
end

#methodObject (readonly)

Returns the value of attribute method.



5
6
7
# File 'lib/oh_my_log/request.rb', line 5

def method
  @method
end

#paramsObject (readonly)

Returns the value of attribute params.



5
6
7
# File 'lib/oh_my_log/request.rb', line 5

def params
  @params
end

#senderObject (readonly)

Returns the value of attribute sender.



5
6
7
# File 'lib/oh_my_log/request.rb', line 5

def sender
  @sender
end

#statusObject (readonly)

Returns the value of attribute status.



5
6
7
# File 'lib/oh_my_log/request.rb', line 5

def status
  @status
end

Instance Method Details

#to_sObject



15
16
17
18
19
# File 'lib/oh_my_log/request.rb', line 15

def to_s
   = @sender.try(:email)
  sender = !.blank? ?  : Thread.current["remote_ip"]
  "#{@date}, #{sender}, #{@method}, #{@params}, #{@status}"
end