This is a basic Ruby on Rails app
Project is created with:
- Ruby 3.0.0
- Rails 6.1.3.1
To install the app, you must run:
bundle install
When installation is complete, you can start the server
rails s
To build a database seeded by pokemon.csv, simply run:
rake db:reset
- Test suite is using the RSpec testing framework, to run the test suite:
rspec spec
CRUD actions are available in pokemons_controller.rb
Params must be provided in a pokemon
JSON object.
Accepted parameters:
- name: mandatory
- type_1: mandatory
- type_2: optional
- total: optional
- hp: mandatory
- attack: mandatory
- defense: mandatory
- special_attack: mandatory
- special_defense: mandatory
- speed: mandatory
- generation: mandatory
- legendary: optional
Request body example:
{
"pokemon": {
"name": "Mowgli",
"type_1": "Fire",
"hp": 40,
"attack": 50,
"defense": 98,
"special_attack": 46,
"special_defense": 102,
"speed": 12,
"generation": 2
}
}
By default, will return the 25 first elements.
Accepted parameters:
- page: optional, default: 1
- per_page: optional, default: 25
Params must be provided in a pokemon
JSON object.
Accepted parameters: [:name, :type_1, :type_2, :total, :hp, :attack, :defense, :specia_attack, :special_defense, :speed, :generation, :legendary]
Request body example:
{
"pokemon": {
"name": "Mowgli"
}
}