Class: Murlsh::JsonServer
Overview
Serve most recent urls in json.
Instance Attribute Summary
Attributes inherited from Server
Instance Method Summary collapse
-
#get(req) ⇒ Object
Respond to a GET request with json of recent urls.
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 with json of recent urls.
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/murlsh/json_server.rb', line 9 def get(req) page = 1 per_page = config.fetch('num_posts_feed', 25) result_set = Murlsh::UrlResultSet.new(req['q'], page, per_page) body = Murlsh::JsonBody.new(config, req, result_set) Rack::Response.new body, 200, 'Content-Type' => 'application/json' end |