def add_vehicle(self, city, owner_id, last_location, type, color, brand, status, is_owner=False): """ Wraps a `run_transaction` call that adds a vehicle. Arguments: city {String} -- The vehicle's city. owner_id {UUID} -- The owner's unique ID. last_location {String} -- The vehicle's location. type {String} -- The vehicle's type. color {String} -- The vehicle's color. brand {String} -- The vehicle's brand. status {String} -- The vehicle's availability. Keyword Arguments: is_owner {bool} -- The owner status of the user, before the vehicle is added. (default: {False}) """ return run_transaction( sessionmaker(bind=self.engine), lambda session: add_vehicle_txn( session, city, owner_id, last_location, type, color, brand, status, is_owner))
def add_vehicle(self, vehicle_type, longitude, latitude, battery): """ Wraps a `run_transaction` call that adds a vehicle. Arguments: vehicle_type {String} -- The type of vehicle. """ return run_transaction( self.sessionfactory, lambda session: add_vehicle_txn( session, vehicle_type, longitude, latitude, battery))
def add_vehicle(self, longitude, latitude, battery, vehicle_info): """ Wraps a `run_transaction` call that adds a vehicle. Arguments: vehicle_type {String} -- The type of vehicle. longitude {Float} -- longitude of the vehicle. latitude {Float} -- latitude of the vehicle. battery {Int} -- battery % of the vehicle. vehicle_info {dict} -- information on the vehicle, in JSON format. """ return run_transaction(self.sessionfactory, lambda session: add_vehicle_txn( session, longitude, latitude, battery, vehicle_info))