module PokeAPI::Pokemon

Overview

The PokeAPI::Pokemon module contains methods to get data from the different endpoints in the Pokémon group.

NOTE see https://pokeapi.co/docs/v2#pokemon-section

Defined in:

pokeapi/pokemon.cr

Instance Method Summary

Instance Method Detail

def ability(identifier : String | UInt32) : PokeAPI::Types::Ability #

Returns a PokeAPI::Types::Ability based on the given identifier. The identifier can be either the id or the name of the desired ability.

An ArgumentError is raised if the identifier is an empty string or 0


[View source]
def characteristic(id : UInt32) : PokeAPI::Types::Characteristic #

Returns a PokeAPI::Types::Characteristic based on the given id.

An ArgumentError is raised if the id is 0


[View source]
def egg_group(identifier : String | UInt32) : PokeAPI::Types::EggGroup #

Returns a PokeAPI::Types::EggGroup based on the given identifier. The identifier can be either the id or the name of the desired egg group.

An ArgumentError is raised if the identifier is an empty string or 0


[View source]
def gender(identifier : String | UInt32) : PokeAPI::Types::Gender #

Returns a PokeAPI::Types::Gender based on the given identifier. The identifier can be either the id or the name of the desired gender.

Valid genders (2021-05-07):

+----+------------+
| id |    name    |
+----+------------+
|  1 | female     |
|  2 | male       |
|  3 | genderless |
+----+------------+

An ArgumentError is raised if the identifier is an empty string or 0


[View source]
def growth_rate(identifier : String | UInt32) : PokeAPI::Types::GrowthRate #

Returns a PokeAPI::Types::GrowthRate based on the given identifier. The identifier can be either the id or the name of the desired growth rate.

Valid growth rates (2021-05-07):

+----+---------------------+
| id |        name         |
+----+---------------------+
|  1 | slow                |
|  2 | medium              |
|  3 | fast                |
|  4 | medium-slow         |
|  5 | slow-then-very-fast |
|  6 | fast-then-very-slow |
+----+---------------------+

An ArgumentError is raised if the identifier is an empty string or 0


[View source]
def nature(identifier : String | UInt32) : PokeAPI::Types::Nature #

Returns a PokeAPI::Types::Nature based on the given identifier. The identifier can be either the id or the name of the desired nature.

An ArgumentError is raised if the identifier is an empty string or 0


[View source]
def pokeathlon_stat(identifier : String | UInt32) : PokeAPI::Types::PokeathlonStat #

Returns a PokeAPI::Types::PokeathlonStat based on the given identifier. The identifier can be either the id or the name of the desired pokeathlon stat.

Valid pokeathlon stats (2021-05-07):

+----+---------+
| id |  name   |
+----+---------+
|  1 | speed   |
|  2 | power   |
|  3 | skill   |
|  4 | stamina |
|  5 | jump    |
+----+---------+

An ArgumentError is raised if the identifier is an empty string or 0


[View source]
def pokemon(identifier : String | UInt32) : PokeAPI::Types::Pokemon #

Returns a PokeAPI::Types::Pokemon based on the given identifier. The identifier can be either the id or the name of the desired pokémon.

An ArgumentError is raised if the identifier is an empty string or 0


[View source]
def pokemon_color(identifier : String | UInt32) : PokeAPI::Types::PokemonColor #

Returns a PokeAPI::Types::PokemonColor based on the given identifier. The identifier can be either the id or the name of the desired pokémon color.

Valid pokemon colors (2021-05-07):

+----+--------+
| id |  name  |
+----+--------+
|  1 | black  |
|  2 | blue   |
|  3 | brown  |
|  4 | gray   |
|  5 | green  |
|  6 | pink   |
|  7 | purple |
|  8 | red    |
|  9 | white  |
| 10 | yellow |
+----+--------+

An ArgumentError is raised if the identifier is an empty string or 0


[View source]
def pokemon_form(identifier : String | UInt32) : PokeAPI::Types::PokemonForm #

Returns a PokeAPI::Types::PokemonForm based on the given identifier. The identifier can be either the id or the name of the desired pokémon form.

An ArgumentError is raised if the identifier is an empty string or 0


[View source]
def pokemon_habitat(identifier : String | UInt32) : PokeAPI::Types::PokemonHabitat #

Returns a PokeAPI::Types::PokemonHabitat based on the given identifier. The identifier can be either the id or the name of the desired pokémon habitat.

Valid pokemon habitats (2021-05-07):

+----+---------------+
| id |     name      |
+----+---------------+
|  1 | cave          |
|  2 | forest        |
|  3 | grassland     |
|  4 | mountain      |
|  5 | rare          |
|  6 | rough-terrain |
|  7 | sea           |
|  8 | urban         |
|  9 | waters-edge   |
+----+---------------+

An ArgumentError is raised if the identifier is an empty string or 0


[View source]
def pokemon_location_areas(identifier : String | UInt32) : Array(PokeAPI::Types::LocationAreaEncounter) #

Returns a an array of PokeAPI::Types::LocationAreaEncounter based on the given identifier. The identifier can be either the id or the name of the desired pokémon.

An ArgumentError is raised if the identifier is an empty string or 0


[View source]
def pokemon_shape(identifier : String | UInt32) : PokeAPI::Types::PokemonShape #

Returns a PokeAPI::Types::PokemonShape based on the given identifier. The identifier can be either the id or the name of the desired pokémon shape.

Valid pokemon shapes (2021-05-07):

+----+-----------+
| id |   name    |
+----+-----------+
|  1 | ball      |
|  2 | squiggle  |
|  3 | fish      |
|  4 | arms      |
|  5 | blob      |
|  6 | upright   |
|  7 | legs      |
|  8 | quadruped |
|  9 | wings     |
| 10 | tentacles |
| 11 | heads     |
| 12 | humanoid  |
| 13 | bug-wings |
| 14 | armor     |
+----+-----------+

An ArgumentError is raised if the identifier is an empty string or 0


[View source]
def pokemon_species(identifier : String | UInt32) : PokeAPI::Types::PokemonSpecies #

Returns a PokeAPI::Types::PokemonSpecies based on the given identifier. The identifier can be either the id or the name of the desired pokémon species.

An ArgumentError is raised if the identifier is an empty string or 0


[View source]
def stat(identifier : String | UInt32) : PokeAPI::Types::Stat #

Returns a PokeAPI::Types::Stat based on the given identifier. The identifier can be either the id or the name of the desired stat.

Valid stats (2021-05-07):

+----+-----------------+
| id |      name       |
+----+-----------------+
|  1 | hp              |
|  2 | attack          |
|  3 | defense         |
|  4 | special-attack  |
|  5 | special-defense |
|  6 | speed           |
|  7 | accuracy        |
|  8 | evasion         |
+----+-----------------+

An ArgumentError is raised if the identifier is an empty string or 0


[View source]
def type(identifier : String | UInt32) : PokeAPI::Types::Type #

Returns a PokeAPI::Types::Type based on the given identifier. The identifier can be either the id or the name of the desired pokémon type.

An ArgumentError is raised if the identifier is an empty string or 0


[View source]