Ejemplo n.º 1
0
                request.form.get('birthday'),
                bool(request.form.get('is_admin')),
                request.form.get('skin_used'),
            )
        return 201, dbr

    def put(self, aid):
        """ PUT /account/ """
        if request.form.get('person_id') != None:
            dbr = urlHandler.db.add_user_account(
                aid,
                request.form.get('login'),
                request.form.get('person_id'),
                bool(request.form.get('is_admin')),
                request.form.get('skin_used'),
            )
        else:
            dbr = urlHandler.db.update_user_account_with_person(
                aid,
                request.form.get('login'),
                request.form.get('first_name'),
                request.form.get('last_name'),
                request.form.get('birthday'),
                bool(request.form.get('is_admin')),
                request.form.get('skin_used'),
            )
        return 200, dbr


register_api(AccountAPI, 'account_api', '/account/', pk='aid')
Ejemplo n.º 2
0
                request.form.get('last_name'),
                request.form.get('birthday'),
                bool(request.form.get('is_admin')),
                request.form.get('skin_used'),
            )
        return 201, dbr

    def put(self, aid):
        """ PUT /account/ """
        if request.form.get('person_id') != None:
            dbr = urlHandler.db.add_user_account(
                aid,
                request.form.get('login'),
                request.form.get('person_id'),
                bool(request.form.get('is_admin')),
                request.form.get('skin_used'),
            )
        else:
            dbr = urlHandler.db.update_user_account_with_person(
                aid,
                request.form.get('login'),
                request.form.get('first_name'),
                request.form.get('last_name'),
                request.form.get('birthday'),
                bool(request.form.get('is_admin')),
                request.form.get('skin_used'),
            )
        return 200, dbr

register_api(AccountAPI, 'account_api', '/account/', pk='aid')
Ejemplo n.º 3
0
                        "conversion": "",
                        "name": "temp_sensor",
                        "last_received": 1410857216,
                        "timeout": 0,
                        "formula": null,
                        "last_value": "29.1875",
                        "value_max": 37.4375
                    }
                },
                "parameters": {
                    ...
                },
                "id": 3,
                "name": "Temp elentrik"
            }

        @apiErrorExample Error-Response:
            HTTTP/1.1 404 Not Found
        """

        b = urlHandler.db.update_device(
            did,
            request.form.get('name'),
            request.form.get('description'),
            request.form.get('reference'),
        )
        urlHandler.reload_stats()        
        return 200, urlHandler.db.get_device(did)

register_api(deviceAPI, 'device', '/device/', pk='did', pk_type='int')
Ejemplo n.º 4
0
                request.form.get("birthday"),
                bool(request.form.get("is_admin")),
                request.form.get("skin_used"),
            )
        return 201, dbr

    def put(self, aid):
        """ PUT /account/ """
        if request.form.get("person_id") != None:
            dbr = urlHandler.db.add_user_account(
                aid,
                request.form.get("login"),
                request.form.get("person_id"),
                bool(request.form.get("is_admin")),
                request.form.get("skin_used"),
            )
        else:
            dbr = urlHandler.db.update_user_account_with_person(
                aid,
                request.form.get("login"),
                request.form.get("first_name"),
                request.form.get("last_name"),
                request.form.get("birthday"),
                bool(request.form.get("is_admin")),
                request.form.get("skin_used"),
            )
        return 200, dbr


register_api(AccountAPI, "account_api", "/account/", pk="aid")