Class: LockstepSdk::CustomFieldSyncModel

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

Overview

The CustomFieldSyncModel represents information coming into Lockstep from an external financial system or other enterprise resource planning system. [Custom Fields](developer.lockstep.io/docs/custom-fields#custom-fields) represent custom data extensions that you can use with the Lockstep Platform. If you need to store extra information about an object that does not match Lockstep’s official schema, you can store it in the Custom Field system using CustomFieldSyncModel.

To store a custom field for an object, create a CustomFieldSyncModel record containing the ‘EntityType` and `ErpKey` of the entity to which you will attach a custom field. Next specify the field’s ‘CustomFieldLabel` and either a `StringValue` or `NumericValue`.

Once imported, this record will be available in the Lockstep API as a [CustomFieldValueModel](developer.lockstep.io/docs/customfieldvaluemodel).

For more information on writing your own connector, see [Connector Data](developer.lockstep.io/docs/connector-data).

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ CustomFieldSyncModel

Initialize the CustomFieldSyncModel using the provided prototype



39
40
41
42
43
44
45
46
47
48
# File 'lib/lockstep_sdk/models/custom_field_sync_model.rb', line 39

def initialize(params = {})
    @erp_key = params.dig(:erp_key)
    @entity_type = params.dig(:entity_type)
    @custom_field_label = params.dig(:custom_field_label)
    @string_value = params.dig(:string_value)
    @numeric_value = params.dig(:numeric_value)
    @value = params.dig(:value)
    @created = params.dig(:created)
    @modified = params.dig(:modified)
end

Instance Attribute Details

#createdDate-time

Returns If known, the date when this record was created according to the originating financial system in which this record is maintained. If the originating financial system does not maintain a created-date, leave this field null.

Returns:

  • (Date-time)

    If known, the date when this record was created according to the originating financial system in which this record is maintained. If the originating financial system does not maintain a created-date, leave this field null.



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

def created
  @created
end

#custom_field_labelString

Returns A label that uniquely identifies this custom field within your software. Example: You have an invoice whose ID number is 100047878, and you wish to store a custom field on that invoice named “ApprovalStatusCode”. For the ‘CustomFieldLabel` field, specify the value `ApprovalStatusCode`.

Returns:

  • (String)

    A label that uniquely identifies this custom field within your software. Example: You have an invoice whose ID number is 100047878, and you wish to store a custom field on that invoice named “ApprovalStatusCode”. For the ‘CustomFieldLabel` field, specify the value `ApprovalStatusCode`.



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

def custom_field_label
  @custom_field_label
end

#entity_typeString

Returns Custom Fields are identified by the ‘EntityType` and `ErpKey` values together. Example: You have an invoice whose ID number is 100047878, and you wish to store a custom field on that invoice named “ApprovalStatusCode”. For the `EntityType` field, specify the value `Invoice`. Recognized types include: * `Company` - Link this custom field to a CompanySyncModel * `Contact` - Link this custom field to a ContactSyncModel * `Invoice` - Link this custom field to an InvoiceSyncModel * `InvoiceLine` - Link this custom field to an InvoiceLineSyncModel * `Payment` - Link this custom field to a PaymentSyncModel.

Returns:

  • (String)

    Custom Fields are identified by the ‘EntityType` and `ErpKey` values together. Example: You have an invoice whose ID number is 100047878, and you wish to store a custom field on that invoice named “ApprovalStatusCode”. For the `EntityType` field, specify the value `Invoice`. Recognized types include: * `Company` - Link this custom field to a CompanySyncModel * `Contact` - Link this custom field to a ContactSyncModel * `Invoice` - Link this custom field to an InvoiceSyncModel * `InvoiceLine` - Link this custom field to an InvoiceLineSyncModel * `Payment` - Link this custom field to a PaymentSyncModel



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

def entity_type
  @entity_type
end

#erp_keyString

Returns This is the primary key of the record to which you will attach this custom field. You should provide the identifying number as it is stored in the originating financial system. Search for a unique, non-changing number within the originating financial system for this record. Custom Fields are identified by the ‘EntityType` and `ErpKey` values together. Example: You have an invoice whose ID number is 100047878, and you wish to store a custom field on that invoice named “ApprovalStatusCode”. For the `ErpKey` field, specify the value `100047878`. For more information, see [Identity Columns](developer.lockstep.io/docs/identity-columns).

Returns:

  • (String)

    This is the primary key of the record to which you will attach this custom field. You should provide the identifying number as it is stored in the originating financial system. Search for a unique, non-changing number within the originating financial system for this record. Custom Fields are identified by the ‘EntityType` and `ErpKey` values together. Example: You have an invoice whose ID number is 100047878, and you wish to store a custom field on that invoice named “ApprovalStatusCode”. For the `ErpKey` field, specify the value `100047878`. For more information, see [Identity Columns](developer.lockstep.io/docs/identity-columns).



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

def erp_key
  @erp_key
end

#modifiedDate-time

Returns If known, the date when this record was most recently modified according to the originating financial system in which this record is maintained. If the originating financial system does not maintain a most-recently-modified-date, leave this field null.

Returns:

  • (Date-time)

    If known, the date when this record was most recently modified according to the originating financial system in which this record is maintained. If the originating financial system does not maintain a most-recently-modified-date, leave this field null.



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

def modified
  @modified
end

#numeric_valueDouble

Returns The value of this custom field, if it is stored in numeric format.

Returns:

  • (Double)

    The value of this custom field, if it is stored in numeric format.



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

def numeric_value
  @numeric_value
end

#string_valueString

Returns The value of this custom field, if it is stored in string format.

Returns:

  • (String)

    The value of this custom field, if it is stored in string format.



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

def string_value
  @string_value
end

#valueString

Returns The value of this custom field.

Returns:

  • (String)

    The value of this custom field.



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

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



84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/lockstep_sdk/models/custom_field_sync_model.rb', line 84

def as_json(options={})
    {
        'erpKey' => @erp_key,
        'entityType' => @entity_type,
        'customFieldLabel' => @custom_field_label,
        'stringValue' => @string_value,
        'numericValue' => @numeric_value,
        'value' => @value,
        'created' => @created,
        'modified' => @modified,
    }
end

#to_json(*options) ⇒ String

Returns This object converted to a JSON string.

Returns:

  • (String)

    This object converted to a JSON string



99
100
101
# File 'lib/lockstep_sdk/models/custom_field_sync_model.rb', line 99

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