Class: Synced::Strategies::UpdatedSince
- Defined in:
- lib/synced/strategies/updated_since.rb
Overview
This strategy performs partial synchronization. It fetches only changes (additions, modifications and deletions) from the API.
Defined Under Namespace
Classes: CannotDeleteDueToNoDeletedIdsError, MissingTimestampError
Instance Method Summary collapse
-
#initialize(model_class, options = {}) ⇒ UpdatedSince
constructor
A new instance of UpdatedSince.
- #perform ⇒ Object
- #reset_synced ⇒ Object
Methods included from AttributesAsHash
Constructor Details
#initialize(model_class, options = {}) ⇒ UpdatedSince
Returns a new instance of UpdatedSince.
11 12 13 14 15 16 17 |
# File 'lib/synced/strategies/updated_since.rb', line 11 def initialize(model_class, = {}) super @initial_sync_since = [:initial_sync_since] @tolerance = [:tolerance] = [:timestamp_strategy] || Synced::Strategies::SyncedAllAtTimestampStrategy @timestamp_strategy = .new(relation_scope: relation_scope, scope: @scope, model_class: model_class) end |
Instance Method Details
#perform ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/synced/strategies/updated_since.rb', line 19 def perform super.tap do |local_objects| instrument("update_synced_timestamp_perform.synced", model: @model_class) do @timestamp_strategy.update() end end end |
#reset_synced ⇒ Object
27 28 29 |
# File 'lib/synced/strategies/updated_since.rb', line 27 def reset_synced @timestamp_strategy.reset end |