2018-09-13 16:37:21 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Api
|
|
|
|
module V1
|
|
|
|
class ResultTableSerializer < ActiveModel::Serializer
|
|
|
|
type :result_tables
|
2023-07-19 15:49:20 +08:00
|
|
|
attributes :table_id, :table_contents, :table_metadata
|
2018-10-07 18:36:58 +08:00
|
|
|
|
|
|
|
def table_id
|
|
|
|
object.table&.id
|
|
|
|
end
|
|
|
|
|
2023-07-19 15:49:20 +08:00
|
|
|
def table_metadata
|
2023-07-18 18:53:08 +08:00
|
|
|
object.table&.metadata
|
|
|
|
end
|
|
|
|
|
2018-10-07 18:36:58 +08:00
|
|
|
def table_contents
|
2019-05-15 19:12:54 +08:00
|
|
|
object.table&.contents&.force_encoding(Encoding::UTF_8)
|
2018-10-07 18:36:58 +08:00
|
|
|
end
|
2018-09-13 16:37:21 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|