summaryrefslogtreecommitdiff
path: root/service/pixelated/resources/feedback_resource.py
diff options
context:
space:
mode:
authorGiovane <giovaneliberato@gmail.com>2015-09-21 18:10:17 -0300
committerGiovane <giovaneliberato@gmail.com>2015-09-21 18:10:17 -0300
commit8d20d0fa7ed226735daba4b0507cf0037860af71 (patch)
tree0c42b44c476dd3750e196f5cec94affdff8da6ce /service/pixelated/resources/feedback_resource.py
parentb492d6928dc757e56404a1a6f0d632658c38bc13 (diff)
#442 Creates feedback service that create tickets on leap web.
Diffstat (limited to 'service/pixelated/resources/feedback_resource.py')
-rw-r--r--service/pixelated/resources/feedback_resource.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/service/pixelated/resources/feedback_resource.py b/service/pixelated/resources/feedback_resource.py
new file mode 100644
index 00000000..b989b273
--- /dev/null
+++ b/service/pixelated/resources/feedback_resource.py
@@ -0,0 +1,32 @@
+#
+# Copyright (c) 2015 ThoughtWorks, Inc.
+#
+# Pixelated is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Pixelated is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with Pixelated. If not, see <http://www.gnu.org/licenses/>.
+import json
+
+from twisted.web.resource import Resource
+from pixelated.resources import respond_json
+
+
+class FeedbackResource(Resource):
+ isLeaf = True
+
+ def __init__(self, feedback_service):
+ Resource.__init__(self)
+ self.feedback_service = feedback_service
+
+ def render_POST(self, request):
+ feedback = json.loads(request.content.read()).get('feedback')
+ self.feedback_service.open_ticket(feedback)
+ return respond_json({}, request)