SystemService
Service handling System Utility calls.
Method Summary
Public Methods | ||
public |
Tracks a new event in the log. |
|
public |
Submits the provided JSON to the server. |
Public Methods
public log(logEntry: Object, requestInformation: Object, deviceInformation: Object): Promise source
Tracks a new event in the log.
Params:
Name | Type | Attribute | Description |
logEntry | Object |
|
The new log entry to track. (optional) |
logEntry.message | String |
|
The message of the log entry. (optional) |
logEntry.tag | String |
|
The tag value of the log entry. (optional) |
logEntry.level | String | Indicates the level of importance of the log entry. (required) |
|
requestInformation | Object |
|
The request information of the API call. (optional) |
requestInformation.method | String |
|
The method of the request. (optional) |
requestInformation.params | String |
|
The body or parameters that were sent on the failing/debugging request. (optional) |
requestInformationtry.status_code | String |
|
The response of the request. (optional) |
requestInformationtry.url | String |
|
The URL of the request. (optional) |
deviceInformation | Object |
|
The device information of the device that made the request. (optional) |
deviceInformation.app_version | String |
|
The version of the app that was running on the device. (optional) |
deviceInformation.brand | String |
|
The brand of the device. (optional) |
deviceInformation.carrier | String |
|
The carrier of the device . (optional) |
deviceInformation.gps_status | String |
|
The gps status of the device. (optional) |
deviceInformation.latitude | Number |
|
The latitude value where the device was. (optional) |
deviceInformation.longitude | Number |
|
The longitude value where the device was. (optional) |
deviceInformation.manufacturer | String |
|
The manufacturer of the device. (optional) |
deviceInformation.network_status | String |
|
The network status of the device. (optional) |
deviceInformation.os_version | String |
|
The OS version of the device. (optional) |
deviceInformation.push_id | String |
|
The push ID value of the device. (optional) |
deviceInformation.token | String |
|
The token value of the device. (optional) |
deviceInformation.udid | String |
|
The UDID value of the device. (optional) |
deviceInformation.technology | String |
|
The technology of the device. (optional) |
Throw:
If missing token or missing required parameters |
Example:
import { systemService } from 'Clinical6';
systemService.log({
"message": "MyText",
"tag": "MyString",
"level": "Error"
}, {
"url": "MyString",
"method": "MyString",
"params": "MyText",
"status_code": "MyString"
}, {
"udid": "MyString",
"token": "MyString",
"push_id": "MyString",
"app_version": "MyString",
"os_version": "MyString",
"network_status": "MyString",
"gps_status": "MyString",
"latitude": "1.5",
"longitude": "1.5",
"brand": "MyString",
"manufacturer": "MyString",
"carrier": "MyString"
});
{
"status": "ok",
"message": "Debug Log was successfully created"
}
Test:
- [unit] SystemService.log should throw an error when an event is passed in without a level field
- [unit] SystemService.log should successfully track a new log event
- [unit] SystemService.log should successfully track a new log event with just the entry parameter
- [unit] SystemService.log should successfully track a new log event with the entry and requestInformation parameters
- [unit] SystemService.log should successfully track a new log event with the entry, requestInformation, and deviceInformation parameters
public xAuth(json: Object): Promise source
Submits the provided JSON to the server. This is meant as a stub to submit any json to the server that will handle the xAuth according to the client. The examples are ways that the x_auth could be implemented.
Params:
Name | Type | Attribute | Description |
json | Object | The JSON value with the attributes to validate. |
Throw:
If missing required parameters |
Example:
import { systemService } from 'Clinical6';
systemService.xAuth({
site_id: '1234342',
user_id: '2323423'
});
{"status":"active"}
{"status":"not_invited"}
{
"status":"new",
"token":"my-invitation-token",
"site:":{
"name":"La Jolla Clinic",
"address_line_1":"5555 La Jolla Center Dr.",
"address_line_2":"Suite 101",
"address_line_3":"",
"city":"San Diego",
"state":"CA",
"country":"USA",
"zip_code":"920237"
},
"mobile_user":{
"prefix":"Dr.",
"first_name":"Pat",
"last_name":"Cooper",
"role":"Physician",
"phone":"619-333-3456",
"email":"pcooper@lajollaclinic.com"
}
}
{"status":"invalid"}
{
"participant_id": "03929850"
}
200
{
"status": "new",
"token": "38762f553bf5abb1e318b5a5471b72394c82e0efa35b941506cbf834e0948827"
}