Class: AllStak::Models::RequestContext

Inherits:
Object
  • Object
show all
Defined in:
lib/allstak/models/user_context.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(method: nil, path: nil, host: nil, status_code: nil, user_agent: nil) ⇒ RequestContext

Returns a new instance of RequestContext.



24
25
26
27
28
29
30
# File 'lib/allstak/models/user_context.rb', line 24

def initialize(method: nil, path: nil, host: nil, status_code: nil, user_agent: nil)
  @method = method
  @path = path
  @host = host
  @status_code = status_code
  @user_agent = user_agent
end

Instance Attribute Details

#hostObject

Returns the value of attribute host.



22
23
24
# File 'lib/allstak/models/user_context.rb', line 22

def host
  @host
end

#methodObject

Returns the value of attribute method.



22
23
24
# File 'lib/allstak/models/user_context.rb', line 22

def method
  @method
end

#pathObject

Returns the value of attribute path.



22
23
24
# File 'lib/allstak/models/user_context.rb', line 22

def path
  @path
end

#status_codeObject

Returns the value of attribute status_code.



22
23
24
# File 'lib/allstak/models/user_context.rb', line 22

def status_code
  @status_code
end

#user_agentObject

Returns the value of attribute user_agent.



22
23
24
# File 'lib/allstak/models/user_context.rb', line 22

def user_agent
  @user_agent
end

Instance Method Details

#to_hObject



32
33
34
35
36
37
38
39
40
# File 'lib/allstak/models/user_context.rb', line 32

def to_h
  out = {}
  out[:method]     = @method      unless @method.nil?
  out[:path]       = @path        unless @path.nil?
  out[:host]       = @host        unless @host.nil?
  out[:statusCode] = @status_code unless @status_code.nil?
  out[:userAgent]  = @user_agent  unless @user_agent.nil?
  out
end