2015-01-22 17:21:15 +08:00
|
|
|
module Mobile
|
|
|
|
module Entities
|
2015-01-23 16:31:41 +08:00
|
|
|
#匿评作品页面相关参数
|
2015-01-22 17:21:15 +08:00
|
|
|
class AnonymousWorksParams < Grape::Entity
|
|
|
|
def self.anonymous_works_params_expose(field)
|
|
|
|
expose field do |f,opt|
|
|
|
|
if f.is_a?(Hash) && f.key?(field)
|
|
|
|
f[field]
|
|
|
|
elsif f.is_a?(Hash) && !f.key?(field)
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
anonymous_works_params_expose :is_teacher
|
|
|
|
anonymous_works_params_expose :m_score
|
2015-01-23 16:31:41 +08:00
|
|
|
anonymous_works_params_expose :is_anonymous_comments
|
|
|
|
anonymous_works_params_expose :cur_type
|
2015-03-04 17:14:09 +08:00
|
|
|
anonymous_works_params_expose :cur_page
|
2015-01-23 11:42:35 +08:00
|
|
|
expose :jours ,using: Mobile::Entities::Jours do |f, opt|
|
|
|
|
if f.is_a?(Hash) && f.key?(:jours)
|
|
|
|
f[:jours]
|
|
|
|
end
|
|
|
|
end
|
2015-01-22 17:21:15 +08:00
|
|
|
expose :teacher_stars,using: Mobile::Entities::HomeworkJours do |f, opt|
|
|
|
|
if f.is_a?(Hash) && f.key?(:teacher_stars)
|
|
|
|
f[:teacher_stars]
|
|
|
|
end
|
|
|
|
end
|
|
|
|
expose :student_stars , using: Mobile::Entities::HomeworkJours do |f, opt|
|
|
|
|
if f.is_a?(Hash) && f.key?(:student_stars)
|
|
|
|
f[:student_stars]
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|