class Synced::Strategies::SyncedAllAtTimestampStrategy

This is a strategy for UpdatedSince defining how to store and update synced timestamps. It uses synced_all_at column on model to store update time.

Attributes

relation_scope[R]

Public Class Methods

new(relation_scope:, **_options) click to toggle source
# File lib/synced/strategies/synced_all_at_timestamp_strategy.rb, line 8
def initialize(relation_scope:, **_options)
  @relation_scope = relation_scope
end

Public Instance Methods

last_synced_at() click to toggle source
# File lib/synced/strategies/synced_all_at_timestamp_strategy.rb, line 12
def last_synced_at
  relation_scope.minimum(synced_all_at_key)
end
reset() click to toggle source
# File lib/synced/strategies/synced_all_at_timestamp_strategy.rb, line 20
def reset
  relation_scope.update_all(synced_all_at_key => nil)
end
update(timestamp) click to toggle source
# File lib/synced/strategies/synced_all_at_timestamp_strategy.rb, line 16
def update(timestamp)
  relation_scope.update_all(synced_all_at_key => timestamp)
end

Private Instance Methods

synced_all_at_key() click to toggle source
# File lib/synced/strategies/synced_all_at_timestamp_strategy.rb, line 26
def synced_all_at_key
  :synced_all_at
end