Class: Synchronisable::Worker::Record Private

Inherits:
Base show all
Defined in:
lib/synchronisable/worker/record.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Responsible for record synchronization.

Instance Method Summary collapse

Methods inherited from Base

#initialize, #logger

Constructor Details

This class inherits a constructor from Synchronisable::Worker::Base

Instance Method Details

#sync_recordObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Synchronizes record.


10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/synchronisable/worker/record.rb', line 10

def sync_record
  @synchronizer.with_record_sync_callbacks(@source) do
    log_info(@source.dump_message, :green)

    if @source.updatable?
      log_info("updating #{@source.model}: #{@source.local_record.id}", :blue)

      update_record
    else
      create_record_pair

      log_info("#{@source.model} (id: #{@source.local_record.id}) was created", :blue)
      log_info("#{@source.import_record.class}: #{@source.import_record.id} was created", :blue)
    end
  end
end