Class: Mach::Delta

Inherits:
Object
  • Object
show all
Defined in:
lib/mach/delta.rb

Class Method Summary collapse

Class Method Details

.create(credential_id, server_timestamp, client_timestamp) ⇒ Object



8
9
10
11
12
# File 'lib/mach/delta.rb', line 8

def create(credential_id, server_timestamp, client_timestamp)
  delta_value = server_timestamp - client_timestamp
  expires_in = Mach.configuration.stale_request_window
  Mach.configuration.data_store.add_delta(credential_id, delta_value, expires_in)
end

.present_for(credential_id) ⇒ Object



4
5
6
# File 'lib/mach/delta.rb', line 4

def present_for(credential_id)
  Mach.configuration.data_store.find_delta_by(credential_id)
end