Class: Masks::Sessions::Request

Inherits:
Masks::Session show all
Defined in:
app/models/masks/sessions/request.rb

Overview

Session for masking ActionDispatch::Request and Rack::Request.

Constant Summary

Constants inherited from Masks::Session

Masks::Session::CHECK_KEY

Instance Method Summary collapse

Methods inherited from Masks::Session

#access, #actor=, #checks_for, #cleanup!, #device, #error_message, #extra, #extras, #find_check, #id, #mask, mask!, #mask!, #passed?, #passed_at, #passed_checks?, #past_checks, #scoped, #session_params

Instance Method Details

#dataObject



29
30
31
# File 'app/models/masks/sessions/request.rb', line 29

def data
  request.session
end

#fingerprintObject



21
22
23
# File 'app/models/masks/sessions/request.rb', line 21

def fingerprint
  params[:_fingerprint]
end

#ip_addressObject



13
14
15
# File 'app/models/masks/sessions/request.rb', line 13

def ip_address
  request.remote_ip
end

#matches_mask?(mask) ⇒ Boolean

Returns:

  • (Boolean)


33
34
35
# File 'app/models/masks/sessions/request.rb', line 33

def matches_mask?(mask)
  mask.matches_request?(request)
end

#paramsObject



25
26
27
# File 'app/models/masks/sessions/request.rb', line 25

def params
  request.params
end

#to_sObject



9
10
11
# File 'app/models/masks/sessions/request.rb', line 9

def to_s
  "mask(#{request.method.upcase} #{request.path})"
end

#user_agentObject



17
18
19
# File 'app/models/masks/sessions/request.rb', line 17

def user_agent
  request.user_agent
end

#writable?Boolean

Returns:

  • (Boolean)


37
38
39
# File 'app/models/masks/sessions/request.rb', line 37

def writable?
  request.post?
end