json API for suseconferenceclient

This commit is contained in:
Ancor Gonzalez Sosa 2013-07-08 10:07:12 +02:00
parent d648ab7cb5
commit d95d8f234b
12 changed files with 159 additions and 8 deletions

View file

@ -1,11 +1,7 @@
class ConferenceSerializer < ActiveModel::Serializer
attributes :guid, :name, :description, :year, :socialtag, :date_range#, :url, :revision
attributes :guid, :name, :description, :year, :socialtag, :date_range, :url, :revision
def name
object.short_title
end
def description
object.title
end
@ -17,7 +13,23 @@ class ConferenceSerializer < ActiveModel::Serializer
object.social_tag
end
def revision
object.revision || 0
end
# FIXME: adjusting the format the DIRTY way, for oSC13.
# If you think this is ugly, don't look at the methods below
def date_range
object.date_range_string
object.date_range_string.try(:split, ",").try(:first)
end
# FIXME: just giving suseconferenceclient something to play with
def description
"openSUSE Conference 2013 - Power to the Geeko"
end
# FIXME: same than the former
def url
"https://conference.opensuse.org/"
end
end