Currently, it's rather difficult to use OSEM and embed a schedule into another website. We currently use OSEM for the backend, but still use a different system for our main site. This change allows us to dynamically embed the schedule in our main website as well as allow us a simple way to get data for the use in mobile applications or similar. This limits the JSONP support to only GETS on json formatted requests. This prevents any XSS even though we don't require a authenticity token.
37 lines
820 B
Ruby
37 lines
820 B
Ruby
class ConferenceSerializer < ActiveModel::Serializer
|
|
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
|
|
|
|
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
|
|
if defined? object.date_range_string
|
|
object.date_range_string.try(:split, ',').try(:first)
|
|
end
|
|
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
|