def self.package(atomrss)
feed = Feed.new(self)
feed_mapping = {
:generator => :generator,
:title => :title,
:last_updated => [:updated, :lastBuildDate, :pubDate, :dc_date],
:copyright => [:copyright, :rights],
:authors => [:author, :webMaster, :managingEditor, :contributor],
:urls => :link,
:description => [:description, :subtitle],
:ttl => :ttl
}
map_functions!(feed_mapping, atomrss, feed)
feed.id = feed_id(atomrss)
feed.image = image(atomrss)
entry_mapping = {
:date_published => [:pubDate, :published, :dc_date, :issued],
:urls => :link,
:description => [:description, :summary],
:content => [:content, :content_encoded, :description],
:title => :title,
:authors => [:author, :contributor, :dc_creator],
:categories => :category,
:last_updated => [:updated, :dc_date, :pubDate]
}
atomrss.entries.each do |atomrss_entry|
feed_entry = Entry.new
map_functions!(entry_mapping, atomrss_entry, feed_entry)
feed_entry.id = atomrss_entry.guid || atomrss_entry[:id]
feed_entry.copyright = atomrss_entry.copyright || (atomrss.respond_to?(:copyright) ? atomrss.copyright : nil)
feed.entries << feed_entry
end
feed
end