Class: Booth::Models::Remote

Inherits:
ApplicationRecord show all
Defined in:
lib/booth/models/remote.rb

Overview

Login remotely by entering a code in the browser of an existing session.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.lifespanObject



23
24
25
# File 'lib/booth/models/remote.rb', line 23

def self.lifespan
  ::Booth.config.interaction_timeout
end

Instance Method Details

#formatted_codeObject



27
28
29
# File 'lib/booth/models/remote.rb', line 27

def formatted_code
  code.to_s.scan(/.{1,3}/).join(' ').presence
end

#recently_created?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/booth/models/remote.rb', line 31

def recently_created?
  ::Booth::Models::Remotes::Scopes::RecentlyCreated.call(self)
end

#recently_responded?Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/booth/models/remote.rb', line 35

def recently_responded?
  ::Booth::Models::Remotes::Scopes::RecentlyResponded.call(self)
end