Skip to content
This repository has been archived by the owner on May 25, 2020. It is now read-only.

Commit

Permalink
derp
Browse files Browse the repository at this point in the history
  • Loading branch information
dzheng256 committed Feb 22, 2017
1 parent 9986e0e commit 7e3c531
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 6 deletions.
45 changes: 40 additions & 5 deletions apiwrapper/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,18 +85,47 @@ def get(self, query):
return {'error': str(e)}

class TextbookAPI(Resource):
def get(self, ):
def get(self, department_code, course_name, instructor):
try:
return
return textbook.get_books_data({'department_code': department_code, 'course_name': course_name, 'instructor': instructor})
except Exception as e:
return
return {'error': str(e)}

class ShuttleRoutesAPI(Resource):
def get(self):
try:
return shuttle.get_routes()
except Exception as e:
return {'error': str(e)}

class ShuttleAPI(Resource):
class ShuttleVehiclePointsAPI(Resource):
def get(self):
try:
return shuttle.get_map_vehicle_points()
except Exception as e:
return {'error': str(e)}

class ShuttleStopArrivalsAPI(Resource):
def get(self, times_per_stop=1):
try:
return shuttle.get_route_stop_arrivals(times_per_stop)
except Exception as e:
return {'error': str(e)}

class ShuttleStopEstimatesAPI(Resource):
def get(self, vehicle_id, quantity=2):
try:
return shuttle.get_vehicle_route_stop_estimates(vehicle_id, quantity)
except Exception as e:
return {'error': str(e)}
get_vehicle_route_stop_estimates(vehicle_id, quantity=2):

class NewsAPI(Resource):

def get(self, ):
try:
return
except Exception as e:
return



Expand All @@ -108,6 +137,12 @@ class NewsAPI(Resource):
api.add_resource(LaundryStatusAPI, '/laundry/simple/<location>')
api.add_resource(LaundryStatusDetailedAPI, '/laundry/detailed/<location>')
api.add_resource(PeopleAPI, '/people/<query>')
api.add_resource(ShuttleRoutesAPI, '/shuttle/routes')
api.add_resource(ShuttleVehiclePointsAPI, '/shuttle/points')
api.add_resource(ShuttleStopArrivalsAPI, '/shuttle/arrivals/<times_per_stop>')
api.add_resource(ShuttleStopEstimatesAPI, '/shuttle/estimates/<vehicle_id>/<quantity>')

api.add_resource(TextbookAPI, '/textbook/<department>/<course_name>/<instructor>')

if __name__ is '__main__':
app.run(debug=True, port=8000)
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
Flask
flask-restful
flask_cors
beautifulsoup4
nose
nose-cov
Expand Down

0 comments on commit 7e3c531

Please sign in to comment.