Class: Booth::Userland::Remotes::Show

Inherits:
Object
  • Object
show all
Includes:
Concerns::Action
Defined in:
lib/booth/userland/remotes/show.rb

Instance Method Summary collapse

Instance Method Details

#callObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/booth/userland/remotes/show.rb', line 9

def call
  request.must_be_get!
  request.must_be_html!
  request.must_be_logged_in!

  log { 'You want to receive your personal remote...' }

  if remote.failure?
    log { "This credential doesn't have any remote right now." }
    return Tron.success :no_remote, step: :no_remote
  end

  if remote.recently_responded
    log { 'The current remote has already been responded to' }
    return Tron.success :remote_responded, step: :remote_solved
  end

  log { 'You have a remote to respond to' }
  Tron.success :you_can_login_remotely,
               ip: remote.ip,
               agent: remote.agent.presence,
               location: remote.location.presence,
               browser_name: remote.browser_name,
               platform_name: remote.platform_name,
               browser_image_path: remote.browser_image_path,
               platform_image_path: remote.platform_image_path,
               step: :remote_login
end