def get(self):
   """
   ' PURPOSE
   '   Returns the public dicts for all trips.
   ' PARAMETERS
   '   None
   ' RETURNS
   '   [<dict entity1>, ..., <dict entityN>]
   """
   entities = TripModel.fetch()
   return [entity.to_dict() for entity in entities]
 def delete(self):
   """
   ' PURPOSE
   '   Deletes all existing trips
   ' PARAMETERS
   '   None
   ' RETURNS
   '   dict( deleted )
   '     deleted -> the count of deleted trips
   """
   deleted = TripModel.delete_all()
   return { 'deleted': deleted }
 def get(self, id):
   """
   ' PURPOSE
   '   Given a trip id, return a dict representing
   '   that trip's public data.
   ' PARAMETERS
   '   <str id>
   ' RETURNS
   '   dict *see the TripModel for specs*
   """
   entity = TripModel.get_by_id(id)
   if not entity: return abort(400)
   return entity.to_dict()
 def delete(self, id):
   """
   ' PURPOSE
   '   Given a trip id, delete that trip.
   ' PARAMETERS
   '   None
   ' RETURNS
   '   dict( deleted )
   '     deleted -> the count of deleted trips
   """
   key = TripModel.key_from_id(id)
   deleted = key.delete()
   return { 'deleted': deleted }