Coder Social home page Coder Social logo

metacritic-4's Introduction

metacritic

Build Status

This repo is a coding exercise that consists of 2 parts.

Known Issues

Requests to metacritic.com sometimes return with 403 status code (most likely to prevent crawlers from stealing data from their site). When this happens, the parser will print out an error message and simply exits. Try running it again.

Requirements

  • Ruby 1.9.x or greater (tested with 1.9.3-p429 and 2.0.0-p353). Refer to rbenv or RVM for managing your Ruby installations.
  • bundler gem installed (needed for dependency management)
sudo gem install bundler
  • Install native dev packages for ruby, sqlite, libxslt and libxml2. For example, on Centos, you can run
sudo yum install ruby-devel
sudo yum groupinstall 'Development Tools'
sudo yum install sqlite-devel
sudo yum install libxml2-devel libxslt-devel
  • On Ubuntu, you can run
sudo apt-get install build-essential
sudo apt-get install ruby-dev
sudo apt-get install libsqlite3-dev
sudo apt-get install libxslt-dev libxml2-dev
  • Install all Ruby gems dependency
bundle install

Running tests

  • Tests are written as specs and stored under the spec directory.
  • Tests can be run as followed
RACK_ENV=test rake test

Parsing the “Top Playstation 3 Games (By Metascore)” page

  • You can either use the following Rake task
rake parse:top_ps3_games 
  • Or you can invoke the parser directly
./parser top_games

Running the REST API

  • To start the REST API, simply run the Sinatra app
ruby app.rb

Populating the database

To populate the database with the current top PS3 games, run the following Rake task

rake db:populate_top_ps3_games

For fun, you can also populate the DB with additional list of PS3 games by running

rake db:populate_sample_ps3_games

Using the REST API

  • To view all games, make a GET request to /api/v1/games
  • To view a particular game, make a GET request to /api/v1/games/GAME_TITLE_GOES_IN_HERE

Deploying to production

  • I would recommend running the Sinatra web app on Puma behind nginx.
  • For database, I would recommend using MongoDB.

metacritic-4's People

Contributors

darrendao avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.