From d7cad23854b4ed8ef1b66ce4df00f00f49fecad5 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Sun, 4 Jan 2015 14:55:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E4=B8=8A=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/mobile/apis/homeworks.rb | 29 ++++++++++++++++++++++ app/api/mobile/middleware/error_handler.rb | 2 +- 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 app/api/mobile/apis/homeworks.rb diff --git a/app/api/mobile/apis/homeworks.rb b/app/api/mobile/apis/homeworks.rb new file mode 100644 index 000000000..99acfd87f --- /dev/null +++ b/app/api/mobile/apis/homeworks.rb @@ -0,0 +1,29 @@ +#coding=utf-8 + +module Mobile + module Apis + class Homeworks < Grape::API + + def self.get_servcie + new HomeworkService + end + + resources :homeworks do + + desc "作业详情" + params do + requires :id, type: Integer, desc: "作业ID" + end + route_param :id do + get do + get_service.show_homework params + end + end + + + + + end + end + end +end diff --git a/app/api/mobile/middleware/error_handler.rb b/app/api/mobile/middleware/error_handler.rb index d0db6ebf1..018191d8d 100644 --- a/app/api/mobile/middleware/error_handler.rb +++ b/app/api/mobile/middleware/error_handler.rb @@ -7,7 +7,7 @@ module Mobile @app.call(@env) rescue =>e message = {status: 1, message: e.message }.to_json - puts(detail: e.backtrace.join("\n")) if Rails.env.development? + puts(e.backtrace.join("\n")) if Rails.env.development? status = 200 headers = { 'Content-Type' => content_type } Rack::Response.new([message], status, headers).finish