This is a Pokedex API created in Ruby on Rails, using the Pokemon API. It has two models, Pokemon and Types, with association between both.

Installation

Up and Running:

  1. Clone the repository.
  2. Run the command bundle install
  3. Create the database with rails db:create
  4. Run the migrations rails db:migrate
  5. Seed the dabase rake import:import_pokemon

GET Index Pokemon

api/v1/pokemons

Show a list of all pokemons.

Example local: localhost:3000/api/v1/pokemons

Example Response:

-200 Success

[
    {
        "id": 1,
        "name": "bulbasaur",
        "order": 1,
        "base_experience": 64,
        "height": 7,
        "weight": 69,
        "created_at": "2023-11-07T23:10:13.280Z",
        "updated_at": "2023-11-07T23:10:13.280Z",
        "pokemon_types": [
            {
                "slot": 1,
                "type": {
                    "name": "grass"
                }
            },
            {
                "slot": 2,
                "type": {
                    "name": "poison"
                }
            }
        ]
    },
    {
        "id": 2,
        "name": "ivysaur",
        "order": 2,
        "base_experience": 142,
        "height": 10,
        "weight": 130,
        "created_at": "2023-11-07T23:10:13.385Z",
        "updated_at": "2023-11-07T23:10:13.385Z",
        "pokemon_types": [
            {
                "slot": 1,
                "type": {
                    "name": "grass"
                }
            },
            {
                "slot": 2,
                "type": {
                    "name": "poison"
                }
            }
        ]
    }]

POST Create pokemon

api/v1/pokemons/new

Creates pokemon with name, order, base_experience, height, weight and pokemon_types_attributes. Name and order are required (validates with presence and uniqueness).