def synchronize(scope: scope_from_relation, strategy: synced_strategy, **options)
      options.assert_valid_keys(:api, :fields, :include, :remote, :remove, :query_params, :association_sync, :auto_paginate, :transaction_per_page)
      options[:remove]  = synced_remove unless options.has_key?(:remove)
      options[:include] = Array.wrap(synced_include) unless options.has_key?(:include)
      options[:fields]  = Array.wrap(synced_fields) unless options.has_key?(:fields)
      options[:query_params] = synced_query_params unless options.has_key?(:query_params)
      options[:auto_paginate] = synced_auto_paginate unless options.has_key?(:auto_paginate)
      options[:transaction_per_page] = synced_transaction_per_page unless options.has_key?(:transaction_per_page)
      options.merge!({
        scope:                 scope,
        strategy:              strategy,
        id_key:                synced_id_key,
        synced_data_key:       synced_data_key,
        data_key:              synced_data_key,
        local_attributes:      synced_local_attributes,
        associations:          synced_associations,
        only_updated:          synced_only_updated,
        mapper:                synced_mapper,
        globalized_attributes: synced_globalized_attributes,
        initial_sync_since:    synced_initial_sync_since,
        timestamp_strategy:    synced_timestamp_strategy,
        handle_processed_objects_proc:  synced_handle_processed_objects_proc,
        tolerance:             synced_tolerance,
        synced_endpoint:       synced_endpoint
      })
      Synced::Synchronizer.new(self, options).perform
    end
def synchronize(scope: scope_from_relation, strategy: synced_strategy, **options)
      options.assert_valid_keys(:api, :fields, :include, :remote, :remove, :query_params, :association_sync, :auto_paginate, :transaction_per_page)
      options[:remove]  = synced_remove unless options.has_key?(:remove)
      options[:include] = Array.wrap(synced_include) unless options.has_key?(:include)
      options[:fields]  = Array.wrap(synced_fields) unless options.has_key?(:fields)
      options[:query_params] = synced_query_params unless options.has_key?(:query_params)
      options[:auto_paginate] = synced_auto_paginate unless options.has_key?(:auto_paginate)
      options[:transaction_per_page] = synced_transaction_per_page unless options.has_key?(:transaction_per_page)
      options.merge!({
        scope:                 scope,
        strategy:              strategy,
        id_key:                synced_id_key,
        synced_data_key:       synced_data_key,
        data_key:              synced_data_key,
        local_attributes:      synced_local_attributes,
        associations:          synced_associations,
        only_updated:          synced_only_updated,
        mapper:                synced_mapper,
        globalized_attributes: synced_globalized_attributes,
        initial_sync_since:    synced_initial_sync_since,
        timestamp_strategy:    synced_timestamp_strategy,
        handle_processed_objects_proc:  synced_handle_processed_objects_proc,
        tolerance:             synced_tolerance,
        synced_endpoint:       synced_endpoint
      })
      Synced::Synchronizer.new(self, options).perform
    end
Performs synchronization of given remote objects to local database.

 @param remote [Array] - Remote objects to be synchronized with local db. If
   it's nil then synchronizer will make request on it's own.
 @param model_class [Class] - ActiveRecord model class to which remote objects
   will be synchronized.
 @param scope [ActiveRecord::Base] - Within this object scope local objects
   will be synchronized. By default it's model_class. Can be infered from active record association scope.
 @param remove [Boolean] - 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. This option can be defined in the model
   and then overwritten in the synchronize method.
 @param auto_paginate [Boolean] - If true (default) will fetch and save all
   records at once. If false will fetch and save records in batches.
 @param 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
 @param api [BookingSync::API::Client] - API client to be used for fetching
   remote objects
 @example Synchronizing amenities

   Amenity.synchronize(remote: [remote_amenity1, remote_amenity2])

 @example Synchronizing rentals within given website. This will
   create/remove/update rentals only within website.
   It requires relation website.rentals to exist.

  website.rentals.synchronize(remote: remote_rentals)