Create Asset
- Source:
Methods
(async, inner) createAsset(xmlObject)
Create Asset is message 1
Create asset will do the following
- [x] Generate GUID/UUID for new asset
- [x] Add new asset to MHelpDesk
- [x] Generate Response Message (6)
- [x] Add Response Message to SQL table (for outgoing to send later)
Note that this function will log any errors and return false on error.
Parameters:
| Name | Type | Description |
|---|---|---|
xmlObject |
Object |
- Source:
(inner) generateJSONEquipmentFromXMLObject(xmlObject)
Takes the xmlObject and produces an appropriate JSON object
to send to the MHelpDesk API
Parameters:
| Name | Type | Description |
|---|---|---|
xmlObject |
Object | the object version of the recieved xml |
- Source:
(inner) generateXMLMessage(xmlObject) → {String}
This function will return an UpdateAsset Message (6).
This should be sent to Parmalat upon successful creation of an MHelpDesk
Object.
Parameters:
| Name | Type | Description |
|---|---|---|
xmlObject |
Object |
- Source:
Returns:
An UpdateAssetMessage
- Type
- String
(async, inner) postEquipmentToMHelpDesk(accessToken, xmlObject)
Posts the equipment JSON to the MHelpDeskAPI
Parameters:
| Name | Type | Description |
|---|---|---|
accessToken |
String | JWT Access Token for MHelpDesk |
xmlObject |
Object | the object version of the recieved xml |
- Source:
(inner) sanitizeXMLValue(key, value)
Takes a key and value and returns the appropriate sanitized
value for that pair.
Cases:
- Lockable: Convert from 'true'/'false' string to 'y'/'n'
- SignageInfill/SignageDecal: Convert to *Proper Case*
- Hinging: Take only first letter (L/R/S)
Parameters:
| Name | Type | Description |
|---|---|---|
key |
String | The key from the given XML |
value |
String | The value given from the XML |
- Source: