Class: PasswordRequired::PasswordRequest

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Model
Defined in:
lib/password_required/password_request.rb,
lib/password_required/password_request/hidden_inputs.rb

Defined Under Namespace

Classes: HiddenInputs

Constant Summary collapse

IGNORED_PARAMETER_KEYS =
[:action, :controller]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request) ⇒ PasswordRequest

Returns a new instance of PasswordRequest.



13
14
15
16
# File 'lib/password_required/password_request.rb', line 13

def initialize(request)
  @request = request
  super({})
end

Instance Attribute Details

#passwordObject

Returns the value of attribute password.



11
12
13
# File 'lib/password_required/password_request.rb', line 11

def password
  @password
end

Instance Method Details

#additional_paramsObject



22
23
24
# File 'lib/password_required/password_request.rb', line 22

def additional_params
  parameters.except(*IGNORED_PARAMETER_KEYS)
end

#hidden_form_inputsObject



26
27
28
# File 'lib/password_required/password_request.rb', line 26

def hidden_form_inputs
  HiddenInputs.new(additional_params).to_s.html_safe
end

#target_urlObject



18
19
20
# File 'lib/password_required/password_request.rb', line 18

def target_url
  env['ORIGINAL_FULLPATH']
end