Class: SyncClient

Inherits:
Object
  • Object
show all
Defined in:
lib/lockstep_sdk/clients/sync_client.rb

Instance Method Summary collapse

Constructor Details

#initialize(connection) ⇒ SyncClient

Initialize the SyncClient class with an API client instance.

Parameters:

  • connection (LockstepApi)

    The API client object for this connection



22
23
24
# File 'lib/lockstep_sdk/clients/sync_client.rb', line 22

def initialize(connection)
    @connection = connection
end

Instance Method Details

#cancel_sync(id:) ⇒ Object

Cancels a Sync process for an Application if the request is still being processed within the Application. This does not cancel Sync processes which have already proceeded to completion within the Application, or Sync processes outside of Applications such as from a Zip file or Batch Import.

A Sync task represents an action performed by an Application for a particular account. An Application can provide many different tasks as part of their capabilities. Sync tasks are executed in the background and will continue running after they are created. Use one of the creation APIs to request execution of a task. To check on the progress of the task, call GetSync or QuerySync.

Parameters:

  • id (uuid)

    The unique ID number of the Sync task to cancel



100
101
102
103
# File 'lib/lockstep_sdk/clients/sync_client.rb', line 100

def cancel_sync(id:)
    path = "/api/v1/Sync/#{id}"
    @connection.request(:delete, path, nil, nil)
end

#create_batch_import(body:) ⇒ Object

Creates a new batch import Sync task that imports all the models provided to this API call.

A Sync task represents ingestion of data from a source. For each data model in the source, the Sync process will determine whether the data is new, updated, or unchanged from data that already exists within the Lockstep Platform. For records that are new, the Sync process will add them to the Lockstep Platform data. For records that are updated, the Sync process will update existing data to match the newly uploaded records. If records have not changed, no action will be taken.

You can use this Batch Import process to load data in bulk directly into the Lockstep Platform.

Parameters:

  • body (BatchSyncModel)

    Information about the Sync to execute



46
47
48
49
# File 'lib/lockstep_sdk/clients/sync_client.rb', line 46

def create_batch_import(body:)
    path = "/api/v1/Sync/batch"
    @connection.request(:post, path, body, nil)
end

#create_sync(body:) ⇒ Object

Requests a new Sync task from the Application specified in the request and returns a token that can be used to check the progress and status of the task.

A Sync task represents an action performed by an Application for a particular account. An Application can provide many different tasks as part of their capabilities. Sync tasks are executed in the background and will continue running after they are created. Use one of the creation APIs to request execution of a task. To check on the progress of the task, call GetSync or QuerySync.

Parameters:

  • body (SyncSubmitModel)

    Information about the Sync to execute



33
34
35
36
# File 'lib/lockstep_sdk/clients/sync_client.rb', line 33

def create_sync(body:)
    path = "/api/v1/Sync"
    @connection.request(:post, path, body, nil)
end

#query_syncs(filter:, include_param:, order:, page_size:, page_number:) ⇒ Object

Queries Sync tasks for this account using the specified filtering, sorting, nested fetch, and pagination rules requested.

More information on querying can be found on the [Searchlight Query Language](developer.lockstep.io/docs/querying-with-searchlight) page on the Lockstep Developer website.

A Sync task represents an action performed by an Application for a particular account. An Application can provide many different tasks as part of their capabilities. Sync tasks are executed in the background and will continue running after they are created. Use one of the creation APIs to request execution of a task. To check on the progress of the task, call GetSync or QuerySync.

Parameters:



117
118
119
120
121
# File 'lib/lockstep_sdk/clients/sync_client.rb', line 117

def query_syncs(filter:, include_param:, order:, page_size:, page_number:)
    path = "/api/v1/Sync/query"
    params = {:filter => filter, :include => include_param, :order => order, :pageSize => page_size, :pageNumber => page_number}
    @connection.request(:get, path, nil, params)
end

#retrieve_sync(id:, include_param:) ⇒ Object

Retrieves the status and information about a Sync operation by the requested ID. Provides status and progress information about this task.

A Sync task represents an action performed by an Application for a particular account. An Application can provide many different tasks as part of their capabilities. Sync tasks are executed in the background and will continue running after they are created. Use one of the creation APIs to request execution of a task. To check on the progress of the task, call GetSync or QuerySync.

Parameters:

  • id (uuid)

    The unique ID number of the Sync task to retrieve

  • include_param (string)

    To fetch additional data on this object, specify the list of elements to retrieve. Available collections: Details



88
89
90
91
92
# File 'lib/lockstep_sdk/clients/sync_client.rb', line 88

def retrieve_sync(id:, include_param:)
    path = "/api/v1/Sync/#{id}"
    params = {:include => include_param}
    @connection.request(:get, path, nil, params)
end

#update_sync(id:, body:) ⇒ Object

Updates an existing Sync with the information supplied to this PATCH call.

This API is restricted to internal service users and may not be called by customers or partners.

The PATCH method allows you to change specific values on the object while leaving other values alone. As input you should supply a list of field names and new values. For example, you can provide the field name “IsActive” and specify the new value “False”; this API will then change the value of IsActive to false.

A Sync task represents an action performed by an Application for a particular account. An Application can provide many different tasks as part of their capabilities. Sync tasks are executed in the background and will continue running after they are created. Use one of the creation APIs to request execution of a task. To check on the progress of the task, call GetSync or QuerySync.

Parameters:

  • id (uuid)

    The unique ID number of the Sync to update

  • body (object)

    A list of changes to apply to this Application



76
77
78
79
# File 'lib/lockstep_sdk/clients/sync_client.rb', line 76

def update_sync(id:, body:)
    path = "/api/v1/Sync/#{id}"
    @connection.request(:patch, path, body.to_camelback_keys.to_json, nil)
end

#upload_sync_file(app_enrollment_id:, is_full_sync:, filename:) ⇒ Object

Requests a new Sync task from a ZIP file you provide. This ZIP file can contain one or more files with data from the customer’s platform. Individual files can be in the format CSV or JSONL (JSON with Lines).

A Sync task represents an action performed by an Application for a particular account. An Application can provide many different tasks as part of their capabilities. Sync tasks are executed in the background and will continue running after they are created. Use one of the creation APIs to request execution of a task. To check on the progress of the task, call GetSync or QuerySync.

Parameters:

  • app_enrollment_id (uuid)

    The optional existing app enrollment to associate with the data in the zip file.

  • is_full_sync (boolean)

    True if this is a full sync, false if this is a partial sync. Defaults to false.

  • filename (File)

    The full path of a file to upload to the API



59
60
61
62
63
# File 'lib/lockstep_sdk/clients/sync_client.rb', line 59

def upload_sync_file(app_enrollment_id:, is_full_sync:, filename:)
    path = "/api/v1/Sync/zip"
    params = {:appEnrollmentId => app_enrollment_id, :isFullSync => is_full_sync}
    @connection.request(:post, path, nil, params)
end