module Mobile
  module Entities
    class CourseDynamic < Grape::Entity
      include Redmine::I18n
      def self.course_dynamic_expose(field)
        expose field do |c,opt|
          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

        end
      end
      course_dynamic_expose :type
      course_dynamic_expose :count
      course_dynamic_expose :course_name
      course_dynamic_expose :course_term
      course_dynamic_expose :course_time
      course_dynamic_expose :course_id
      course_dynamic_expose :course_img_url
      course_dynamic_expose :message
      course_dynamic_expose :update_time
    end
  end
end