Class: Murlsh::AtomServer
Overview
Serve Atom feed.
Instance Attribute Summary
Attributes inherited from Server
Instance Method Summary collapse
-
#get(req) ⇒ Object
Respond to a GET request for Atom feed.
Methods inherited from Server
Constructor Details
This class inherits a constructor from Murlsh::Server
Instance Method Details
#get(req) ⇒ Object
Respond to a GET request for Atom feed.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/murlsh/atom_server.rb', line 13 def get(req) page = 1 per_page = config.fetch('num_posts_feed', 25) result_set = Murlsh::UrlResultSet.new(req['q'], page, per_page) feed_url = URI.join(config.fetch('root_url'), config.fetch('feed_file')) body = Murlsh::AtomBody.new(config, req, feed_url, result_set.results) resp = Rack::Response.new(body, 200, 'Content-Type' => 'application/atom+xml') if u = body.updated resp['Last-Modified'] = u.httpdate end resp end |