An application to provide data about urls visited.
Come up with a Ruby on Rails application, using Sequel as its ORM, and that allows its users to access two distinct reports, in the realm of web stats, via a REST API:
-
Number of page views per URL, grouped by day, for the past 5 days (
/top_urls
) -
Top 5 referrers for the top 10 URLs grouped by day, for the past 5 days (
/top_referrers
)
You'll need to edit database.yml
and change for your own mysql database or use ENV["MYSQL_PASSWORD"]
with root user.
Tests are run with bundle exec rake
, might require RAILS_ENV=test bundle exec rake
.
bundle exec rake db:seed
will delete all Visit
records and create 1 million new ones at random using preset urls/referrers in db/seeds.rb
The current /top_referrers
runs many queries (see commit efdafa ). If the sql ran could gather the referrers at the same time as top urls, this will probably be greatly improved