Created
March 12, 2014 09:04
-
-
Save zkessin/9503348 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//-*- Javascript -*- | |
'use strict'; | |
angular.module('xray') | |
.service('xray:tposs:test', function MockCdrList() { | |
var fields = [ | |
{ | |
"fieldName": "LocationId", | |
"type": "string", | |
"description": "Location object identifier.", | |
"mandatory": true | |
}, | |
{ | |
"fieldName": "Serial", | |
"type": "string", | |
"description": "Serial number identifying the location equipment.", | |
"mandatory": true | |
}, | |
{ | |
"fieldName": "MacAddress", | |
"type": "string", | |
"description": "Mac address of the location.", | |
"mandatory": true | |
}, | |
{ | |
"fieldName": "Type", | |
"type": "string", | |
"description": "Vendor-specific type information.", | |
"mandatory": true | |
}, | |
{ | |
"fieldName": "Status", | |
"type": "string", | |
"description": "Status of the location in the network. Can be active, inactive or maintenance.", | |
"mandatory": true | |
}, | |
{ | |
"fieldName": "SwVersion", | |
"type": "string", | |
"description": "Version of the software running on the location.", | |
"mandatory": false | |
}, | |
{ | |
"fieldName": "HwVersion", | |
"type": "string", | |
"description": "Version of the hardware the location is build on.", | |
"mandatory": false | |
}, | |
{ | |
"fieldName": "Imei", | |
"type": "string", | |
"description": "IMEI of the location.", | |
"mandatory": false | |
}, | |
{ | |
"fieldName": "Iccid", | |
"type": "string", | |
"description": "ICCID of a SIM used by the location.", | |
"mandatory": false | |
}, | |
{ | |
"fieldName": "Fin", | |
"type": "string", | |
"description": "Unique identifier for a vehicle to which the location belongs.", | |
"mandatory": false | |
}, | |
{ | |
"fieldName": "Latitude", | |
"type": "string", | |
"description": "Longitude location information for the position of the location.", | |
"mandatory": false | |
}, | |
{ | |
"fieldName": "Longitude", | |
"type": "string", | |
"description": "Latitude location information for the position of the location.", | |
"mandatory": false | |
}, | |
{ | |
"fieldName": "Altitude", | |
"type": "string", | |
"description": "Altitude location information for the position of the location.", | |
"mandatory": false | |
} | |
]; | |
var count = 20; | |
var total_count = 438; | |
var list_response = function () { | |
return { | |
"id" : 1, | |
"jsonrpc" : "2.0", | |
"result" : { | |
"Items" : window.mock_data_generator(fields, count), | |
"Total-Count": total_count | |
} | |
}}; | |
var CdrList = function () { | |
this.test = function (requestBody) { | |
var body = JSON.parse(requestBody); | |
return body['method'] === 'loc-attributes-in'; | |
} | |
}; | |
this.addStubs = function ($httpBackend) { | |
$httpBackend | |
.whenPOST("/xray", new CdrList()) | |
.respond(200, list_response()); | |
}; | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment