aboutsummaryrefslogtreecommitdiff
path: root/ihatemoney/api.py
diff options
context:
space:
mode:
Diffstat (limited to 'ihatemoney/api.py')
-rw-r--r--ihatemoney/api.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/ihatemoney/api.py b/ihatemoney/api.py
index 31ed06c..6068cf7 100644
--- a/ihatemoney/api.py
+++ b/ihatemoney/api.py
@@ -65,6 +65,13 @@ class ProjectHandler(Resource):
return form.errors, 400
+class ProjectStatsHandler(Resource):
+ method_decorators = [need_auth]
+
+ def get(self, project):
+ return project.members_stats
+
+
class APIMemberForm(MemberForm):
""" Member is not disablable via a Form.
@@ -163,6 +170,7 @@ class BillHandler(Resource):
restful_api.add_resource(ProjectsHandler, '/projects')
restful_api.add_resource(ProjectHandler, '/projects/<string:project_id>')
restful_api.add_resource(MembersHandler, "/projects/<string:project_id>/members")
+restful_api.add_resource(ProjectStatsHandler, "/projects/<string:project_id>/statistics")
restful_api.add_resource(MemberHandler, "/projects/<string:project_id>/members/<int:member_id>")
restful_api.add_resource(BillsHandler, "/projects/<string:project_id>/bills")
restful_api.add_resource(BillHandler, "/projects/<string:project_id>/bills/<int:bill_id>")