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
43
44
45
46
47
48
# File 'lib/lockstep_sdk/models/batch_sync_model.rb', line 33

def initialize(params = {})
    @app_enrollment_id = params.dig(:app_enrollment_id)
    @is_full_sync = params.dig(:is_full_sync)
    @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)
    @financial_year_settings = params.dig(:financial_year_settings)
    @financial_accounts = params.dig(:financial_accounts)
    @financial_account_balance_histories = params.dig(:financial_account_balance_histories)
    @base_currencies = params.dig(:base_currencies)
end

Instance Attribute Details

#app_enrollment_idUuid



52
53
54
# File 'lib/lockstep_sdk/models/batch_sync_model.rb', line 52

def app_enrollment_id
  @app_enrollment_id
end

#base_currenciesBaseCurrencySyncModel



104
105
106
# File 'lib/lockstep_sdk/models/batch_sync_model.rb', line 104

def base_currencies
  @base_currencies
end

#companiesCompanySyncModel



60
61
62
# File 'lib/lockstep_sdk/models/batch_sync_model.rb', line 60

def companies
  @companies
end

#contactsContactSyncModel



64
65
66
# File 'lib/lockstep_sdk/models/batch_sync_model.rb', line 64

def contacts
  @contacts
end

#credit_memo_applicationsCreditMemoAppliedSyncModel



68
69
70
# File 'lib/lockstep_sdk/models/batch_sync_model.rb', line 68

def credit_memo_applications
  @credit_memo_applications
end

#custom_fieldsCustomFieldSyncModel



80
81
82
# File 'lib/lockstep_sdk/models/batch_sync_model.rb', line 80

def custom_fields
  @custom_fields
end

#financial_account_balance_historiesFinancialAccountBalanceHistorySyncModel



100
101
102
# File 'lib/lockstep_sdk/models/batch_sync_model.rb', line 100

def 
  @financial_account_balance_histories
end

#financial_accountsFinancialAccountSyncModel



96
97
98
# File 'lib/lockstep_sdk/models/batch_sync_model.rb', line 96

def financial_accounts
  @financial_accounts
end

#financial_year_settingsFinancialYearSettingSyncModel



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

def financial_year_settings
  @financial_year_settings
end

#invoice_linesInvoiceLineSyncModel



76
77
78
# File 'lib/lockstep_sdk/models/batch_sync_model.rb', line 76

def invoice_lines
  @invoice_lines
end

#invoicesInvoiceSyncModel



72
73
74
# File 'lib/lockstep_sdk/models/batch_sync_model.rb', line 72

def invoices
  @invoices
end

#is_full_syncBoolean



56
57
58
# File 'lib/lockstep_sdk/models/batch_sync_model.rb', line 56

def is_full_sync
  @is_full_sync
end

#payment_applicationsPaymentAppliedSyncModel



88
89
90
# File 'lib/lockstep_sdk/models/batch_sync_model.rb', line 88

def payment_applications
  @payment_applications
end

#paymentsPaymentSyncModel



84
85
86
# File 'lib/lockstep_sdk/models/batch_sync_model.rb', line 84

def payments
  @payments
end

Instance Method Details

#as_json(options = {}) ⇒ object



108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# File 'lib/lockstep_sdk/models/batch_sync_model.rb', line 108

def as_json(options={})
    {
        'appEnrollmentId' => @app_enrollment_id,
        'isFullSync' => @is_full_sync,
        'companies' => @companies,
        'contacts' => @contacts,
        'creditMemoApplications' => @credit_memo_applications,
        'invoices' => @invoices,
        'invoiceLines' => @invoice_lines,
        'customFields' => @custom_fields,
        'payments' => @payments,
        'paymentApplications' => @payment_applications,
        'financialYearSettings' => @financial_year_settings,
        'financialAccounts' => @financial_accounts,
        'financialAccountBalanceHistories' => @financial_account_balance_histories,
        'baseCurrencies' => @base_currencies,
    }
end

#to_json(*options) ⇒ String



129
130
131
# File 'lib/lockstep_sdk/models/batch_sync_model.rb', line 129

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