Class: SyncClient

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

Instance Method Summary collapse

Constructor Details

#initialize(lockstepsdk) ⇒ SyncClient

Initialize the SyncClient class with a lockstepsdk instance.

Parameters:

  • lockstepsdk (LockstepApi)

    The Lockstep API client object for this connection



24
25
26
# File 'lib/lockstep_sdk/clients/sync_client.rb', line 24

def initialize(lockstepsdk)
    @lockstepsdk = lockstepsdk
end

Instance Method Details

#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



48
49
50
51
# File 'lib/lockstep_sdk/clients/sync_client.rb', line 48

def create_batch_import(body:)
    path = "/api/v1/Sync/batch"
    @lockstepsdk.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



35
36
37
38
# File 'lib/lockstep_sdk/clients/sync_client.rb', line 35

def create_sync(body:)
    path = "/api/v1/Sync"
    @lockstepsdk.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:



105
106
107
108
109
# File 'lib/lockstep_sdk/clients/sync_client.rb', line 105

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}
    @lockstepsdk.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



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

def retrieve_sync(id:, include_param:)
    path = "/api/v1/Sync/#{id}"
    params = {:include => include_param}
    @lockstepsdk.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



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

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

#upload_sync_file(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:

  • filename (File)

    The full path of a file to upload to the API



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

def upload_sync_file(filename:)
    path = "/api/v1/Sync/zip"
    @lockstepsdk.request(:post, path, nil, nil)
end