2015-01-04 14:55:45 +08:00
|
|
|
#coding=utf-8
|
|
|
|
|
|
|
|
module Mobile
|
|
|
|
module Apis
|
|
|
|
class Homeworks < Grape::API
|
|
|
|
|
2015-01-12 17:19:18 +08:00
|
|
|
def self.get_service
|
2015-01-13 16:00:17 +08:00
|
|
|
HomeworkService.new
|
2015-01-04 14:55:45 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
resources :homeworks do
|
|
|
|
desc "作业详情"
|
|
|
|
params do
|
|
|
|
requires :id, type: Integer, desc: "作业ID"
|
|
|
|
end
|
|
|
|
route_param :id do
|
|
|
|
get do
|
2015-01-20 15:17:02 +08:00
|
|
|
homework = Homeworks.get_service.show_homework params
|
|
|
|
present :data, homework, with: Mobile::Entities::Homework
|
|
|
|
present :status, 0
|
2015-01-04 14:55:45 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2015-01-12 17:19:18 +08:00
|
|
|
|
2015-01-04 14:55:45 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|