2015-10-01 14:09:27 +02:00
|
|
|
import DS from 'ember-data';
|
2015-10-07 06:39:45 -04:00
|
|
|
import ENV from '../config/environment';
|
2015-10-01 14:09:27 +02:00
|
|
|
|
|
|
|
export default DS.RESTAdapter.extend({
|
2015-10-07 06:39:45 -04:00
|
|
|
host: ENV.APP.API_HOST,
|
2015-10-07 11:31:02 +02:00
|
|
|
namespace: 'api/ngsi10',
|
2015-10-01 14:09:27 +02:00
|
|
|
headers: {
|
|
|
|
Accept: 'application/json'
|
|
|
|
},
|
|
|
|
|
|
|
|
findAll: function(store, type, sinceToken) {
|
|
|
|
var requestBody = {
|
|
|
|
entities: [
|
|
|
|
{
|
|
|
|
type: 'ElectricalGridMonitoring',
|
2015-10-13 14:12:34 +02:00
|
|
|
isPattern: true,
|
|
|
|
id: 'S?_ElectricalGrid'
|
2015-10-01 14:09:27 +02:00
|
|
|
}
|
|
|
|
]
|
|
|
|
};
|
|
|
|
|
|
|
|
return this.ajax(this.host + '/' + this.namespace + '/queryContext', 'POST', { data: requestBody });
|
|
|
|
},
|
|
|
|
|
|
|
|
findRecord: function(store, type, id, snapshot) {
|
|
|
|
var requestBody = {
|
|
|
|
entities: [
|
|
|
|
{
|
|
|
|
type: 'ElectricalGridMonitoring',
|
|
|
|
isPattern: false,
|
|
|
|
id: id
|
|
|
|
}
|
|
|
|
]
|
|
|
|
};
|
|
|
|
|
|
|
|
return this.ajax(this.host + '/' + this.namespace + '/queryContext', 'POST', { data: requestBody });
|
|
|
|
},
|
2015-10-08 16:04:06 +02:00
|
|
|
|
|
|
|
query: function(store, type, query) {
|
|
|
|
return this.ajax(this.host + '/' + this.namespace + '/queryContext', 'POST', { data: query });
|
2015-10-09 09:22:35 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
updateRecord: function(store, type, snapshot) {
|
2015-10-12 17:36:34 +02:00
|
|
|
|
2015-10-08 16:04:06 +02:00
|
|
|
}
|
2015-10-01 14:09:27 +02:00
|
|
|
});
|