Login   Register  
PHP Classes
elePHPant
Icontem

File: apibuilder/clients/test/lib.min.js

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Rodolfo Pereira Romano  >  PHP API Server Builder  >  apibuilder/clients/test/lib.min.js  >  Download  
File: apibuilder/clients/test/lib.min.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: PHP API Server Builder
Build a REST server API from custom classes
Author: By
Last change:
Date: 7 months ago
Size: 4,279 bytes
 

Contents

Class file image Download
NULL=null;var trackerApi=new function(){this.key='';this.call=function(options){var opt=$.extend({'data':{},'url':'http://cartracker.freeside.com.br','command':'','error':function(){},'sucess':function(){}},options);$.getJSON(opt.url+opt.command,opt.data,function(json){if(!json.hasOwnProperty('code')||json.code!=600){if(json.hasOwnProperty('error')){console.log('Error on CALL trackerApi API: "'+opt.command+'", error message: '+json.error);console.log(opt);opt.error(json.error);}
else{console.log('Error on CALL trackerApi API: "'+opt.command+'", error message: '+json.error);console.log(opt);opt.error('Erro indefinido.');}
return;}
opt.sucess(json.data);});}
this.user={show:function(options){var opt=$.extend({'id':'','error':function(){},'sucess':function(){}},options);trackerApi.call({'command':'/user/show/','data':{'key':trackerApi.key,'id':opt.id,},'error':opt.error,'sucess':opt.sucess});},search:function(options){var opt=$.extend({'id':NULL,'user_email':NULL,'order':'','count':-1,'error':function(){},'sucess':function(){}},options);trackerApi.call({'command':'/user/search/','data':{'key':trackerApi.key,'id':opt.id,'user_email':opt.user_email,'order':opt.order,'count':opt.count,},'error':opt.error,'sucess':opt.sucess});},modify:function(options){var opt=$.extend({'id':'','values':'','error':function(){},'sucess':function(){}},options);trackerApi.call({'command':'/user/modify/','data':{'key':trackerApi.key,'id':opt.id,'values':opt.values,},'error':opt.error,'sucess':opt.sucess});},disable:function(options){var opt=$.extend({'id':'','error':function(){},'sucess':function(){}},options);trackerApi.call({'command':'/user/disable/','data':{'key':trackerApi.key,'id':opt.id,},'error':opt.error,'sucess':opt.sucess});},}
this.auth={valid:function(options){var opt=$.extend({'user_email':'','user_password':'','error':function(){},'sucess':function(){}},options);trackerApi.call({'command':'/auth/valid/','data':{'key':trackerApi.key,'user_email':opt.user_email,'user_password':opt.user_password,},'error':opt.error,'sucess':opt.sucess});},logoff:function(options){var opt=$.extend({'error':function(){},'sucess':function(){}},options);trackerApi.call({'command':'/auth/logoff/','data':{'key':trackerApi.key,},'error':opt.error,'sucess':opt.sucess});},}
this.vehicle={show:function(options){var opt=$.extend({'id':'','error':function(){},'sucess':function(){}},options);trackerApi.call({'command':'/vehicle/show/','data':{'key':trackerApi.key,'id':opt.id,},'error':opt.error,'sucess':opt.sucess});},search:function(options){var opt=$.extend({'vehicle_id':NULL,'vehicle_name':NULL,'vehicletype_id':NULL,'order':NULL,'count':-1,'error':function(){},'sucess':function(){}},options);trackerApi.call({'command':'/vehicle/search/','data':{'key':trackerApi.key,'vehicle_id':opt.vehicle_id,'vehicle_name':opt.vehicle_name,'vehicletype_id':opt.vehicletype_id,'order':opt.order,'count':opt.count,},'error':opt.error,'sucess':opt.sucess});},modify:function(options){var opt=$.extend({'vehicle_id':'','vehicle_name':NULL,'vehicle_license_plate':NULL,'vehicle_driver_name':NULL,'vehicle_driver_phone':NULL,'vehicletype_id':NULL,'vehicle_color':NULL,'vehicle_imei':NULL,'trackermodel_id':NULL,'error':function(){},'sucess':function(){}},options);trackerApi.call({'command':'/vehicle/modify/','data':{'key':trackerApi.key,'vehicle_id':opt.vehicle_id,'vehicle_name':opt.vehicle_name,'vehicle_license_plate':opt.vehicle_license_plate,'vehicle_driver_name':opt.vehicle_driver_name,'vehicle_driver_phone':opt.vehicle_driver_phone,'vehicletype_id':opt.vehicletype_id,'vehicle_color':opt.vehicle_color,'vehicle_imei':opt.vehicle_imei,'trackermodel_id':opt.trackermodel_id,},'error':opt.error,'sucess':opt.sucess});},}
this.track={next:function(options){var opt=$.extend({'vehicle_id':'','last_id':'','error':function(){},'sucess':function(){}},options);trackerApi.call({'command':'/track/next/','data':{'key':trackerApi.key,'vehicle_id':opt.vehicle_id,'last_id':opt.last_id,},'error':opt.error,'sucess':opt.sucess});},last:function(options){var opt=$.extend({'vehicle_id':'','error':function(){},'sucess':function(){}},options);trackerApi.call({'command':'/track/last/','data':{'key':trackerApi.key,'vehicle_id':opt.vehicle_id,},'error':opt.error,'sucess':opt.sucess});},}}