GithubHelp home page GithubHelp logo

multiverse-travels-booker's Introduction

Multiverse Travels Book

Installation

  1. Install Docker

    sudo apt-get install docker* -y

  2. Configure .env file located at project root directory.

    (Only necessary if you want to customize it)
  3. Run container

    sudo docker-compose up -d \

    Make sure you have permission to run

Running tests

On docker before application starts:

  1. RUN_TEST_BEFORE_APPLICATION=true in .env file
  2. run sudo docker-compose up -d

On ./runtest script (creates container and removes it):

  1. Install curl sudo apt-get install curl -y (Needed to install Crystal)
  2. Download Crystal (version 1.8.2)
  3. Run sudo ./runtest in root folder.

Endpoints

Example requests:

POST: /travel_plans
Request body:
{
    "travel_stops": [1, 2, 3]
}
content-type: "applicaton/json"
Response body:
{
    "id": 1,
    "travel_stops": [
        1,
        2,
        3
    ]
}
content-type: "applicaton/json"
GET: /travel_plans
Response body:
[
    {
        "id": 1,
        "travel_stops": [
            1,
            2,
            3
        ]
    }
]
content-type: "applicaton/json"
GET: /travel_plans?expand=true
Response body:
[
    {
        "id": 1,
        "travel_stops": [
            {
                "id": 1,
                "name": "Earth (C-137)",
                "type": "Planet",
                "dimension": "Dimension C-137"
            },
            {
                "id": 2,
                "name": "Abadango",
                "type": "Cluster",
                "dimension": "unknown"
            },
            {
                "id": 3,
                "name": "Citadel of Ricks",
                "type": "Space station",
                "dimension": "unknown"
            }
        ]
    }
]
content-type: "applicaton/json"
GET: /travel_plans?optimize=true
Response body:
[
    {
        "id": 1,
        "travel_stops": [
            1,
            2,
            3
        ]
    }
]
content-type: "applicaton/json"
GET: /travel_plans?optimize=true&expand=true
Response body:
[
    {
        "id": 2,
        "travel_stops": [
            {
                "id": 19,
                "name": "Gromflom Prime",
                "type": "Planet",
                "dimension": "Replacement Dimension"
            },
            {
                "id": 9,
                "name": "Purge Planet",
                "type": "Planet",
                "dimension": "Replacement Dimension"
            },
            {
                "id": 2,
                "name": "Abadango",
                "type": "Cluster",
                "dimension": "unknown"
            },
            {
                "id": 11,
                "name": "Bepis 9",
                "type": "Planet",
                "dimension": "unknown"
            },
            {
                "id": 7,
                "name": "Immortality Field Resort",
                "type": "Resort",
                "dimension": "unknown"
            }
        ]
    }
]
content-type: "applicaton/json"
GET: /travel_plans/2
Response body:
{
    "id": 2,
    "travel_stops": [
        2,
        7,
        19,
        9,
        11
    ]
}
content-type: "applicaton/json"
GET: /travel_plans/2?optimize=true
Response body:
{
    "id": 2,
    "travel_stops": [
        19,
        9,
        2,
        11,
        7
    ]
}
content-type: "applicaton/json"
GET: /travel_plans/1?expanded=true
Response body:
{
    "id": 1,
    "travel_stops": [
        {
            "id": 1,
            "name": "Earth (C-137)",
            "type": "Planet",
            "dimension": "Dimension C-137"
        },
        {
            "id": 2,
            "name": "Abadango",
            "type": "Cluster",
            "dimension": "unknown"
        },
        {
            "id": 3,
            "name": "Citadel of Ricks",
            "type": "Space station",
            "dimension": "unknown"
        }
    ]
}
content-type: "applicaton/json"
GET: /travel_plans/2?optimize=true&expanded=true
Response body:
{
    "id": 2,
    "travel_stops": [
        {
            "id": 19,
            "name": "Gromflom Prime",
            "type": "Planet",
            "dimension": "Replacement Dimension"
        },
        {
            "id": 9,
            "name": "Purge Planet",
            "type": "Planet",
            "dimension": "Replacement Dimension"
        },
        {
            "id": 2,
            "name": "Abadango",
            "type": "Cluster",
            "dimension": "unknown"
        },
        {
            "id": 11,
            "name": "Bepis 9",
            "type": "Planet",
            "dimension": "unknown"
        },
        {
            "id": 7,
            "name": "Immortality Field Resort",
            "type": "Resort",
            "dimension": "unknown"
        }
    ]
}
content-type: "applicaton/json"
PUT: /travel_plans/1
Request body:
{
    "travel_stops": [4, 5, 6]
}
content-type: "applicaton/json"
Response body:
{
    "id": 1,
    "travel_stops": [
        4,
        5,
        6
    ]
}
content-type: "applicaton/json"
POST: /travel_plans/1/append
Request body:
{
    "travel_stops": [9, 10, 11]
}
content-type: "applicaton/json"
Response body:
{
    "id": 1,
    "travel_stops": [
        4,
        5,
        6,
        9,
        10,
        11
    ]
}
content-type: "applicaton/json"
DELETE: /travel_plans/1
204 No Content
GET: /location/1/image
Response body:
{
    "url": "https://static.wikia.nocookie.net/rickandmorty/images/f/fc/S2e5_Earth.png/revision/latest"
}
content-type: "applicaton/json"
(Unfortunately we do not have images of all locations)

Do you want to make these requests? \

Download Postman and import the file multiverse-travels-booker.postman_collection.json to use the collection with all endpoints.

Contributors

multiverse-travels-booker's People

Contributors

vtrsz avatar

Watchers

 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.