Class: LockstepSdk::BatchSyncModel

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

Overview

A BatchSyncModel contains a collection of records to load into the Lockstep Platform. Data contained in this batch 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 = {}) ⇒ BatchSyncModel

Initialize the BatchSyncModel using the provided prototype



33
34
35
36
37
38
39
40
41
42
# File 'lib/lockstep_sdk/models/batch_sync_model.rb', line 33

def initialize(params = {})
    @companies = params.dig(:companies)
    @contacts = params.dig(:contacts)
    @credit_memo_applications = params.dig(:credit_memo_applications)
    @invoices = params.dig(:invoices)
    @invoice_lines = params.dig(:invoice_lines)
    @custom_fields = params.dig(:custom_fields)
    @payments = params.dig(:payments)
    @payment_applications = params.dig(:payment_applications)
end

Instance Attribute Details

#companiesCompanySyncModel

Returns A list of Company records to merge with your Lockstep Platform data.

Returns:

  • (CompanySyncModel)

    A list of Company records to merge with your Lockstep Platform data



46
47
48
# File 'lib/lockstep_sdk/models/batch_sync_model.rb', line 46

def companies
  @companies
end

#contactsContactSyncModel

Returns A list of Contact records to merge with your Lockstep Platform data.

Returns:

  • (ContactSyncModel)

    A list of Contact records to merge with your Lockstep Platform data



50
51
52
# File 'lib/lockstep_sdk/models/batch_sync_model.rb', line 50

def contacts
  @contacts
end

#credit_memo_applicationsCreditMemoAppliedSyncModel

Returns A list of CreditMemoApplied records to merge with your Lockstep Platform data.

Returns:



54
55
56
# File 'lib/lockstep_sdk/models/batch_sync_model.rb', line 54

def credit_memo_applications
  @credit_memo_applications
end

#custom_fieldsCustomFieldSyncModel

Returns A list of CustomField records to merge with your Lockstep Platform data.

Returns:

  • (CustomFieldSyncModel)

    A list of CustomField records to merge with your Lockstep Platform data



66
67
68
# File 'lib/lockstep_sdk/models/batch_sync_model.rb', line 66

def custom_fields
  @custom_fields
end

#invoice_linesInvoiceLineSyncModel

Returns A list of InvoiceLine records to merge with your Lockstep Platform data.

Returns:

  • (InvoiceLineSyncModel)

    A list of InvoiceLine records to merge with your Lockstep Platform data



62
63
64
# File 'lib/lockstep_sdk/models/batch_sync_model.rb', line 62

def invoice_lines
  @invoice_lines
end

#invoicesInvoiceSyncModel

Returns A list of Invoice records to merge with your Lockstep Platform data.

Returns:

  • (InvoiceSyncModel)

    A list of Invoice records to merge with your Lockstep Platform data



58
59
60
# File 'lib/lockstep_sdk/models/batch_sync_model.rb', line 58

def invoices
  @invoices
end

#payment_applicationsPaymentAppliedSyncModel

Returns A list of PaymentApplied records to merge with your Lockstep Platform data.

Returns:



74
75
76
# File 'lib/lockstep_sdk/models/batch_sync_model.rb', line 74

def payment_applications
  @payment_applications
end

#paymentsPaymentSyncModel

Returns A list of Payment records to merge with your Lockstep Platform data.

Returns:

  • (PaymentSyncModel)

    A list of Payment records to merge with your Lockstep Platform data



70
71
72
# File 'lib/lockstep_sdk/models/batch_sync_model.rb', line 70

def payments
  @payments
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



78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/lockstep_sdk/models/batch_sync_model.rb', line 78

def as_json(options={})
    {
        'companies' => @companies,
        'contacts' => @contacts,
        'creditMemoApplications' => @credit_memo_applications,
        'invoices' => @invoices,
        'invoiceLines' => @invoice_lines,
        'customFields' => @custom_fields,
        'payments' => @payments,
        'paymentApplications' => @payment_applications,
    }
end

#to_json(*options) ⇒ String

Returns This object converted to a JSON string.

Returns:

  • (String)

    This object converted to a JSON string



93
94
95
# File 'lib/lockstep_sdk/models/batch_sync_model.rb', line 93

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