osem-fcy/app/serializers/conference_serializer.rb

36 lines
767 B
Ruby
Raw Normal View History

class ConferenceSerializer < ActiveModel::Serializer
2013-07-08 10:07:12 +02:00
attributes :guid, :name, :description, :year, :socialtag, :date_range, :url, :revision
def name
object.title
end
def year
object.start_date.try(:year)
end
def socialtag
object.contact.social_tag
end
2013-07-08 10:07:12 +02:00
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
2014-06-24 12:14:53 +03:00
object.date_range_string.try(:split, ',').try(:first)
2013-07-08 10:07:12 +02:00
end
# FIXME: just giving suseconferenceclient something to play with
def description
2014-06-24 12:14:53 +03:00
'openSUSE Conference 2013 - Power to the Geeko'
2013-07-08 10:07:12 +02:00
end
# FIXME: same than the former
def url
2014-06-24 12:14:53 +03:00
'https://conference.opensuse.org/'
end
end