def put(last_name, first_name, age): """ Update an user based on the sent information """ repository = UserRepository() user = repository.update(last_name=last_name, first_name=first_name, age=age) return jsonify({'user': user.json})
def auth_wrapper(*args, **kwargs): try: auth_header = request.headers['Authorization'] token = auth_header.split(' ')[1] id_info = id_token.verify_oauth2_token(token, requests.Request(), config.GOOGLE_CLIENT_ID) oid = id_info["sub"] picture = id_info["picture"] name = id_info["name"] email = id_info["email"] user = UserRepository.get(oid) if user: user = UserRepository.update(oid, email, picture, name) else: user = UserRepository.create(oid, email, picture, name) if 'oid' in kwargs: if kwargs['oid'] != user.oid: return render_error( "You don't have right access to this page", 403) kwargs.update({'user': user}) return method(*args, **kwargs) except Exception as exc: return render_error(str(exc), 401)
def put(last_name, first_name, age): """ Update an user based on the sent information """ repository = UserRepository() user = repository.update(last_name=last_name, first_name=first_name, age=age) if user: return jsonify({'user': user.json}) return bad_request('unable to update user')
def put(user_id, last_name, first_name, email, age, gender): """ Update an user based on the sent information """ repository = UserRepository() user = repository.update(user_id=user_id, last_name=last_name, first_name=first_name, email=email, age=age, gender=gender) return jsonify({"user": user.json})
def put(user_id, last_name=None, first_name=None, emails=None, phone_numbers=None): """ Update an user based on the sent information """ repository = UserRepository() user = repository.update(user_id=user_id, last_name=last_name, first_name=first_name, emails=emails, phone_numbers=phone_numbers) return jsonify({"user": user.json})
def put(last_name, first_name, age): """ Create an user based on the sent information --- tags: - user parameters: - name: last_name in: path type: string description: the last name of the user - name: first_name in: path type: string description: the last name of the user - name: body in: body schema: type: object properties: age: type: integer description: The age of the user responses: 200: description: The user was successfully created schema: example: user: last_name: Doe first_name: John age: 30 """ repository = UserRepository() user = repository.update( last_name=last_name, first_name=first_name, age=age ) return jsonify({'user': user.json})
def put(name, type, key): """ Update an user based on the sent information """ user = UserRepository.update(name=name, type=type, key=key) return jsonify({"user": user.json})
def put(id, starting_asset=None, starting_liability=None): """ Update an user based on the sent information """ repository = UserRepository() user = repository.update(id, starting_asset, starting_liability) return jsonify({"user": user.json})
def put(username, age): """ Update an user based on the sent information """ repository = UserRepository() user = repository.update(username=username, age=age) return jsonify({"user": user.json})
def put(self, update_data, email): """Update existing user""" item = UserRepository.update(email, update_data) if not item: abort(404, message='Item not found.') return item