def synced(strategy: :updated_since, **options)
      options.assert_valid_keys(:associations, :data_key, :fields, :globalized_attributes,
        :id_key, :include, :initial_sync_since, :local_attributes, :mapper, :only_updated,
        :remove, :auto_paginate, :transaction_per_page, :delegate_attributes, :query_params,
        :timestamp_strategy, :handle_processed_objects_proc, :tolerance, :endpoint)
      class_attribute :synced_id_key, :synced_data_key,
        :synced_local_attributes, :synced_associations, :synced_only_updated,
        :synced_mapper, :synced_remove, :synced_include, :synced_fields, :synced_auto_paginate, :synced_transaction_per_page,
        :synced_globalized_attributes, :synced_initial_sync_since, :synced_delegate_attributes,
        :synced_query_params, :synced_timestamp_strategy, :synced_strategy, :synced_handle_processed_objects_proc,
        :synced_tolerance, :synced_endpoint
      self.synced_strategy              = strategy
      self.synced_id_key                = options.fetch(:id_key, :synced_id)
      self.synced_data_key              = options.fetch(:data_key) { synced_column_presence(:synced_data) }
      self.synced_local_attributes      = options.fetch(:local_attributes, [])
      self.synced_associations          = options.fetch(:associations, [])
      self.synced_only_updated          = options.fetch(:only_updated, synced_strategy == :updated_since)
      self.synced_mapper                = options.fetch(:mapper, nil)
      self.synced_remove                = options.fetch(:remove, false)
      self.synced_include               = options.fetch(:include, [])
      self.synced_fields                = options.fetch(:fields, [])
      self.synced_globalized_attributes = options.fetch(:globalized_attributes,
        [])
      self.synced_initial_sync_since    = options.fetch(:initial_sync_since,
        nil)
      self.synced_delegate_attributes   = options.fetch(:delegate_attributes, [])
      self.synced_query_params          = options.fetch(:query_params, {})
      self.synced_timestamp_strategy    = options.fetch(:timestamp_strategy, nil)
      self.synced_auto_paginate         = options.fetch(:auto_paginate, true)
      self.synced_transaction_per_page  = options.fetch(:transaction_per_page, false)
      self.synced_handle_processed_objects_proc  = options.fetch(:handle_processed_objects_proc, nil)
      self.synced_tolerance             = options.fetch(:tolerance, 0).to_i.abs
      self.synced_endpoint              = options.fetch(:endpoint) { self.to_s.tableize }
      include Synced::DelegateAttributes
      include Synced::HasSyncedData
    end
def synced(strategy: :updated_since, **options)
      options.assert_valid_keys(:associations, :data_key, :fields, :globalized_attributes,
        :id_key, :include, :initial_sync_since, :local_attributes, :mapper, :only_updated,
        :remove, :auto_paginate, :transaction_per_page, :delegate_attributes, :query_params,
        :timestamp_strategy, :handle_processed_objects_proc, :tolerance, :endpoint)
      class_attribute :synced_id_key, :synced_data_key,
        :synced_local_attributes, :synced_associations, :synced_only_updated,
        :synced_mapper, :synced_remove, :synced_include, :synced_fields, :synced_auto_paginate, :synced_transaction_per_page,
        :synced_globalized_attributes, :synced_initial_sync_since, :synced_delegate_attributes,
        :synced_query_params, :synced_timestamp_strategy, :synced_strategy, :synced_handle_processed_objects_proc,
        :synced_tolerance, :synced_endpoint
      self.synced_strategy              = strategy
      self.synced_id_key                = options.fetch(:id_key, :synced_id)
      self.synced_data_key              = options.fetch(:data_key) { synced_column_presence(:synced_data) }
      self.synced_local_attributes      = options.fetch(:local_attributes, [])
      self.synced_associations          = options.fetch(:associations, [])
      self.synced_only_updated          = options.fetch(:only_updated, synced_strategy == :updated_since)
      self.synced_mapper                = options.fetch(:mapper, nil)
      self.synced_remove                = options.fetch(:remove, false)
      self.synced_include               = options.fetch(:include, [])
      self.synced_fields                = options.fetch(:fields, [])
      self.synced_globalized_attributes = options.fetch(:globalized_attributes,
        [])
      self.synced_initial_sync_since    = options.fetch(:initial_sync_since,
        nil)
      self.synced_delegate_attributes   = options.fetch(:delegate_attributes, [])
      self.synced_query_params          = options.fetch(:query_params, {})
      self.synced_timestamp_strategy    = options.fetch(:timestamp_strategy, nil)
      self.synced_auto_paginate         = options.fetch(:auto_paginate, true)
      self.synced_transaction_per_page  = options.fetch(:transaction_per_page, false)
      self.synced_handle_processed_objects_proc  = options.fetch(:handle_processed_objects_proc, nil)
      self.synced_tolerance             = options.fetch(:tolerance, 0).to_i.abs
      self.synced_endpoint              = options.fetch(:endpoint) { self.to_s.tableize }
      include Synced::DelegateAttributes
      include Synced::HasSyncedData
    end
Enables synced for ActiveRecord model.

 @param options [Hash] Configuration options for synced. They are inherited
   by subclasses, but can be overwritten in the subclass.
 @option options [Symbol] strategy: synchronization strategy, one of :full, :updated_since, :check.
   Defaults to :updated_since
 @option options [Symbol] id_key: attribute name under which
   remote object's ID is stored, default is :synced_id.
 @option options [Boolean] only_updated: If true requests to API will take
   advantage of updated_since param and fetch only created/changed/deleted
   remote objects
 @option options [Symbol] data_key: attribute name under which remote
   object's data is stored.
 @option options [Array|Hash] local_attributes: Array of attributes in the remote
   object which will be mapped to local object attributes.
 @option options [Boolean|Symbol] remove: If it's true all local objects
   within current scope which are not present in the remote array will be
   destroyed.
   If only_updated is enabled, ids of objects to be deleted will be taken
   from the meta part. By default if cancel_at column is present, all
   missing local objects will be canceled with cancel_all,
   if it's missing, all will be destroyed with destroy_all.
   You can also force method to remove local objects by passing it
   to remove: :mark_as_missing.
 @option options [Array|Hash] globalized_attributes: A list of attributes
   which will be mapped with their translations.
 @option options [Time|Proc] initial_sync_since: A point in time from which
   objects will be synchronized on first synchronization.
   Works only for partial (updated_since param) synchronizations.
 @option options [Array|Hash] delegate_attributes: Given attributes will be defined
   on synchronized object and delegated to synced_data Hash
 @option options [Hash] query_params: Given attributes and their values
   which will be passed to api client to perform search
 @option options [Boolean] auto_paginate: If true (default) will fetch and save all
   records at once. If false will fetch and save records in batches.
 @option options transaction_per_page [Boolean]: If false (default) all fetched records
   will be persisted within single transaction. If true the transaction will be per page
   of fetched records
 @option options [Proc] handle_processed_objects_proc: Proc taking one argument (persisted remote objects).
   Called after persisting remote objects (once in case of auto_paginate, after each batch
   when paginating with block).
 @option options [Integer] tolerance: amount of seconds subtracted from last_request timestamp.
   Used to ensure records are up to date in case request has been made in the middle of transaction.
   Defaults to 0.