Class: DceLti::Nonce

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/dce_lti/nonce.rb

Class Method Summary collapse

Class Method Details

.cleanObject



3
4
5
# File 'app/models/dce_lti/nonce.rb', line 3

def self.clean
  delete_all(['created_at < ?', Time.now - 6.hours])
end

.valid?(nonce) ⇒ Boolean



7
8
9
10
11
12
13
14
15
# File 'app/models/dce_lti/nonce.rb', line 7

def self.valid?(nonce)
  begin
    self.create!(nonce: nonce)
    true
  rescue => e
    Rails.logger.warn(%Q|Creating nonce failed: "#{nonce}"|)
    false
  end
end