2015-02-06 15:52:34 +08:00
|
|
|
module Mobile
|
|
|
|
module Entities
|
|
|
|
class CourseDynamic < Grape::Entity
|
2015-03-09 15:23:24 +08:00
|
|
|
include Redmine::I18n
|
2015-02-06 15:52:34 +08:00
|
|
|
def self.course_dynamic_expose(field)
|
|
|
|
expose field do |c,opt|
|
2015-03-09 15:23:24 +08:00
|
|
|
if field == :update_time
|
|
|
|
(format_time(c[field]) if (c.is_a?(Hash) && c.key?(field)))
|
|
|
|
else
|
|
|
|
c[field] if (c.is_a?(Hash) && c.key?(field))
|
|
|
|
end
|
|
|
|
|
2015-02-06 15:52:34 +08:00
|
|
|
end
|
|
|
|
end
|
2015-03-01 16:32:10 +08:00
|
|
|
course_dynamic_expose :type
|
|
|
|
course_dynamic_expose :count
|
2015-02-06 15:52:34 +08:00
|
|
|
course_dynamic_expose :course_name
|
2015-03-18 17:21:19 +08:00
|
|
|
course_dynamic_expose :course_term
|
|
|
|
course_dynamic_expose :course_time
|
2015-03-01 16:32:10 +08:00
|
|
|
course_dynamic_expose :course_id
|
|
|
|
course_dynamic_expose :course_img_url
|
2015-03-09 15:23:24 +08:00
|
|
|
course_dynamic_expose :message
|
|
|
|
course_dynamic_expose :update_time
|
2015-02-06 15:52:34 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|