Code Monkey home page Code Monkey logo

tenant_and_device's Introduction

Rails Engineer Candidate Interview Project

This Rails application is a basic skeleton of an app that serves an API about questions and answers. It already includes 4 basic models:

  1. Question
  2. Answer
  3. User
  4. Tenant

A Question can have one or more answers, and can be private. Every Answer belongs to one question. Each Question has an asker (User), and each Answer has a provider (User).

A Tenant is a consumer of the API you are going to write. A db/seeds.rb file is included to preload the database with test data when you setup the DB.

You need to accomplish the following tasks:

  • Add a RESTful, read-only API to allow consumers to retrieve Questions with Answers as JSON (no need to retrieve Answers on their own). The response should include Answers inside their Question as well as include the id and name of the Question and Answer users.
  • Don't return private Questions in the API response.
  • Require every API request to include a valid Tenant API key, and return an HTTP code of your choice if the request does not include a valid key.
  • Track API request counts per Tenant.
  • Add an HTML dashboard page as the root URL that shows the total number of Users, Questions, and Answers in the system, as well as Tenant API request counts for all Tenants. Style it enough to not assault a viewer's sensibilities.
  • Add tests around the code you write as you deem appropriate. Assume that the API cannot be changed once it's released and test accordingly.
  • You are welcome to add any models or other code you think you need, as well as any gems.
  • Allow adding a query parameter to the API request to select only Questions that contain the query term(s). Return an appropriate HTML status code if no results are found.
  • Add a piece of middleware to throttle API requests on a per-Tenant basis. After the first 100 requests per day, throttle to 1 request per 10 seconds.

Project Setup

Clone this repo locally, and from the top-level directory run:

bundle install

rake db:setup

To make sure it's all working,

rails s

You should see this same information.

Submitting your project

Check project into github and make sure you are properly commiting code when reasonable as a real project.

tenant_and_device's People

Watchers

James Cloos avatar Dathu 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.