diff --git a/project/api/views/dispositivo.py b/project/api/views/dispositivo.py index 5474b97..d4a5b2f 100644 --- a/project/api/views/dispositivo.py +++ b/project/api/views/dispositivo.py @@ -9,8 +9,8 @@ class DispositivoViewSet(viewsets.ModelViewSet): queryset = models.Dispositivo.objects.all() serializer_class = serializers.DispositivoSerializer - @action(detail=False, methods=['get']) - def status(self, request, pk=None): + @action(detail=False, methods=['post']) + def whoami(self, request, pk=None): input = json.loads(request.body) whoami = input['whoami'] @@ -31,3 +31,76 @@ class DispositivoViewSet(viewsets.ModelViewSet): } }) + + @action(detail=False, methods=['post']) + def getInfoDevice(self, request, pk=None): + input = json.loads(request.body) + + linea1 = { + "Linea": "803010", + "Descripción": "Tucapel", + "TipoLocomocion": 1, + "colorFondo": "Hexadecimal", + "colorLetra": "Hexadecimal", + "Llegadas": [ + { + "Patente": "RPDA-98", + "Planificada": "", + "EstimadaGPS": "15:08", + "DistanciaGPS": "1.0 KM" + }, + { + "Patente": "WYXYZ-22", + "Planificada": "", + "EstimadaGPS": "15:42", + "DistanciaGPS": "5.0 KM" + }, + { + "Patente": "ABCA-65", + "Planificada": "", + "EstimadaGPS": "16:18", + "DistanciaGPS": "13.4 KM" + } + ], + "Mensajelinea": "" + } + + linea2 = { + "Linea": "5487", + "Descripción": "Centauro", + "TipoLocomocion": 1, + "colorFondo": "Hexadecimal", + "colorLetra": "Hexadecimal", + "Llegadas": [ + { + "Patente": "PLKJ-32", + "Planificada": "15:13", + "EstimadaGPS": "", + "DistanciaGPS": "", + }, + { + "Patente": "GHLK-11", + "Planificada": "15:39", + "EstimadaGPS": "", + "DistanciaGPS": "", + }, + { + "Patente": "DFQW-55", + "Planificada": "16:22", + "EstimadaGPS": "", + "DistanciaGPS": "", + } + ], + "Mensajelinea": "Sin info. GPS, la informacion es estimada" + } + + detalle_lineas = [] + detalle_lineas.append(linea1) + detalle_lineas.append(linea2) + + return JsonResponse({ + "GetInfoDeviceResponse": { + "DetalleLineas": detalle_lineas, + "MensajeParadero": "No considerar, uso futuro" + } + }) \ No newline at end of file diff --git a/rest/dispositivo.rest b/rest/dispositivo.rest index 430e92b..7ecdd9b 100644 --- a/rest/dispositivo.rest +++ b/rest/dispositivo.rest @@ -19,8 +19,8 @@ GET {{server}}/dispositivos Authorization: Bearer {{token}} ### -# @name status existente -GET {{server}}/dispositivos/status +# @name whoami_existente +POST {{server}}/dispositivos/whoami/ Authorization: Bearer {{token}} Content-Type: application/json @@ -33,8 +33,8 @@ Content-Type: application/json ### -# @name status no existente -GET {{server}}/dispositivos/status +# @name whoami_no_existe +POST {{server}}/dispositivos/whoami/ Authorization: Bearer {{token}} Content-Type: application/json @@ -45,3 +45,19 @@ Content-Type: application/json } } + +### +# @name get_info_device +POST {{server}}/dispositivos/getInfoDevice/ +Authorization: Bearer {{token}} +Content-Type: application/json + +{ + "GetInfoDevice": { + "idDispositivo": "existe", + "KeyAutorizacion":"token" + } +} + + +###