Class: LockstepSdk::SyncSubmitModel

Inherits:
Object
  • Object
show all
Defined in:
lib/lockstep_sdk/models/sync_submit_model.rb

Overview

A SyncSubmitModel represents a task that loads data from a connector to load into the Lockstep Platform. Data contained in a sync will be merged with your existing data. Each record will be matched with existing data inside the Lockstep Platform using the [Identity Column](developer.lockstep.io/docs/identity-columns) rules. Any record that represents a new AppEnrollmentId+ErpKey will be inserted. A record that matches an existing AppEnrollmentId+ErpKey will be updated, but only if the data has changed.

A Sync process permits either a complete data file or a partial / delta data file. Lockstep recommends using a sliding time window to avoid the risk of clock skew errors that might accidentally omit records. Best practice is to run a Sync process daily, and to export all data that has changed in the past 48 hours.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ SyncSubmitModel

Initialize the SyncSubmitModel using the provided prototype



33
34
35
36
# File 'lib/lockstep_sdk/models/sync_submit_model.rb', line 33

def initialize(params = {})
    @app_enrollment_id = params.dig(:app_enrollment_id)
    @run_full_sync = params.dig(:run_full_sync)
end

Instance Attribute Details

#app_enrollment_idUuid

Returns The unique identifier of the app enrollment that is creating this sync request.

Returns:

  • (Uuid)

    The unique identifier of the app enrollment that is creating this sync request.



40
41
42
# File 'lib/lockstep_sdk/models/sync_submit_model.rb', line 40

def app_enrollment_id
  @app_enrollment_id
end

#run_full_syncBoolean

Returns A boolean indicating whether a sync from an ERP system should process all the data from the ERP as opposed to just the delta of changes since the previous sync run. For the Demo Data Connector, setting this to True refreshes the data with new dates as opposed to leaving it unchanged.

Returns:

  • (Boolean)

    A boolean indicating whether a sync from an ERP system should process all the data from the ERP as opposed to just the delta of changes since the previous sync run. For the Demo Data Connector, setting this to True refreshes the data with new dates as opposed to leaving it unchanged.



44
45
46
# File 'lib/lockstep_sdk/models/sync_submit_model.rb', line 44

def run_full_sync
  @run_full_sync
end

Instance Method Details

#as_json(options = {}) ⇒ object

Returns This object as a JSON key-value structure.

Returns:

  • (object)

    This object as a JSON key-value structure



48
49
50
51
52
53
# File 'lib/lockstep_sdk/models/sync_submit_model.rb', line 48

def as_json(options={})
    {
        'appEnrollmentId' => @app_enrollment_id,
        'runFullSync' => @run_full_sync,
    }
end

#to_json(*options) ⇒ String

Returns This object converted to a JSON string.

Returns:

  • (String)

    This object converted to a JSON string



57
58
59
# File 'lib/lockstep_sdk/models/sync_submit_model.rb', line 57

def to_json(*options)
    "[#{as_json(*options).to_json(*options)}]"
end