2013-02-06 03:16:51 +08:00
|
|
|
class TopicLinkSerializer < ApplicationSerializer
|
|
|
|
|
2013-02-26 00:42:20 +08:00
|
|
|
attributes :url,
|
|
|
|
:title,
|
2013-02-20 05:08:23 +08:00
|
|
|
:fancy_title,
|
2013-02-26 00:42:20 +08:00
|
|
|
:internal,
|
|
|
|
:reflection,
|
|
|
|
:clicks,
|
2014-04-06 02:47:25 +08:00
|
|
|
:user_id,
|
|
|
|
:domain
|
2013-02-06 03:16:51 +08:00
|
|
|
|
|
|
|
def url
|
|
|
|
object['url']
|
|
|
|
end
|
|
|
|
|
|
|
|
def title
|
|
|
|
object['title']
|
|
|
|
end
|
|
|
|
|
2013-02-20 05:08:23 +08:00
|
|
|
def fancy_title
|
|
|
|
object['fancy_title']
|
|
|
|
end
|
|
|
|
|
2013-02-06 03:16:51 +08:00
|
|
|
def internal
|
|
|
|
object['internal'] == 't'
|
|
|
|
end
|
|
|
|
|
|
|
|
def reflection
|
|
|
|
object['reflection'] == 't'
|
|
|
|
end
|
|
|
|
|
|
|
|
def clicks
|
2014-03-08 03:43:29 +08:00
|
|
|
object['clicks'].to_i
|
2013-02-06 03:16:51 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
def user_id
|
|
|
|
object['user_id'].to_i
|
|
|
|
end
|
2013-02-20 05:08:23 +08:00
|
|
|
|
2013-02-06 03:16:51 +08:00
|
|
|
def include_user_id?
|
|
|
|
object['user_id'].present?
|
|
|
|
end
|
|
|
|
|
2014-04-06 02:47:25 +08:00
|
|
|
def domain
|
|
|
|
object['domain']
|
|
|
|
end
|
|
|
|
|
2013-02-07 23:45:24 +08:00
|
|
|
end
|