예제 #1
0
def get_addresses(account_id, address_id):
    """
    Get an Address

    This endpoint returns just an address
    """
    app.logger.info("Request to get an address with id: %s", address_id)
    address = Address.find_or_404(address_id)
    return make_response(jsonify(address.serialize()), status.HTTP_200_OK)
예제 #2
0
def update_addresses(account_id, address_id):
    """
    Update an Address

    This endpoint will update an Address based the body that is posted
    """
    app.logger.info("Request to update address with id: %s", address_id)
    check_content_type("application/json")
    address = Address.find_or_404(address_id)
    address.deserialize(request.get_json())
    address.id = address_id
    address.save()
    return make_response(jsonify(address.serialize()), status.HTTP_200_OK)