Giter VIP home page Giter VIP logo

rails-code-sample's Introduction

Rails Developer Code Sample Project

Purpose

The purpose of this exercize is to give us an example of your work within bounds, guildelines and specifications suppled to you. It provides us some insight into how you work, how you think, and how you build things. It also provides the opportunity for multiple discussion points during an interview. Hopefully this is also fun!

The Ask

We would like you to build a rails app that serves a public api. The api consists of two endpoints:

  • A pageable api that allows for searching
  • An api that accepts an id, and provides details on a specific object
Requirements
  • You can build this with any version of Rails and Ruby you see fit
  • You can build this with any gems, databases or services you see fit
  • There should be reasonable test coverage
  • You must use the data provided in the Resources section. How you design things and how you work with that data is up to you.
  • A basic administration interface to modify database records should exist. ActiveAdmin or similar packages are completely fine to use.
Specifications

The search endpoint should be defined as follows:

GET /api/search?index=<number>&limit=<number>&query=<string>

Paramaters:

index: A numerical index that represents the offset to start returning results from. Default 0.

limit: A numerical limit on results to return. Default 10.

query: A string to query for results. This should search the name of a cocktail recipe inclusively, as in, 'rita' should find 'Margarita'. An empty query string should result in an empty results array.

The result format should look like this:

{
  "drinks": 
    [
      {
        "id": 1234,
        "name": "Aztec Punch",
        "category": "Punch Party Drink",       
        "image": "https://www.thecocktaildb.com/images/media/drink/uqwuyp1454514591.jpg"
      },
      ...
   ]
}

The details endpoint should be defined as follows: GET /api/detail?id=<some type of id>

Parameters:

id: This should be an identifier of a cocktail recipe record. I'd assume an int, but if you want to use a UUID string, that's fine too.

The result format should look like this:

{
  "drinks": 
    [
      {
        "id": 1234,
        "name": "Aztec Punch",
        "category": "Punch Party Drink",
        "container": "Punch bowl",
        "instructions": "Mix all ingredients in a pitcher. Mix thoroughly and pour into whatever is available, the bigger the better! This drink packs a big punch, so don't over do it.",
        "image": "https://www.thecocktaildb.com/images/media/drink/uqwuyp1454514591.jpg",
        "ingredients" : [
          {
            "name" : "Lemonade",
            "measurement": "1 can"
          },
          ...
        ]
      }
   ]
}
Resources

This project provides two data files for your use to populate your database, cocktail_recipes.csv and cocktail_recipes.json. They both contain the same data, but one is a flat structure suited for csv ingestion, the other is a hierarchal json file if you prefer to work with that format.

This data is based on the free api at The Cocktail DB, because why can't work be fun? :)

Submission

We're flexible in how you submit your work. If you want to .zip it up and email it, that's fine, if you want to create a private github account and submit a link to a repo, that's fine too.

Thoughts and Notes

This is just an exercise. While the methods and approaches you take to problems should be indicative of how you would approach a problem in a production environment, we don't expect any over-the-top work here. Don't spend tons of time on it. If you think something really needs a complex solution that would take a lot of work, implement a lesser solution, write a note in comments about a proper solution, and we can discuss it.

rails-code-sample's People

Contributors

justincamp404 avatar

Watchers

Sergey Abramyan 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.