Pokerap v0.0.9 Pokerap.Ez

Helper functions to make pokemon searching more intuitve “get what I mean” instead of the almost firehose-esk data from the API

Summary

Functions

Returns a tuple containg status, and a “simple” evolution chain in list form

Returns a tuple containing request status, and map of flavor texts

Gets map of pokedex style descriptions

Returns a tuple containing request status, and map of images

Gets map of images

Returns a tuple containing request status, and list of possible moves a Pokemon can have/learn

Returns a list of possible moves a Pokemon can have/learn

Returns a tuple containing request status, and list of Pokemon types

Gets a list of types per pokemon

Functions

evolution(name)

Returns a tuple containg status, and a “simple” evolution chain in list form

This is a simpilifed combination of the chain /pokemon-species into /evolution-chain. /evolution-chain only takes in a numerical id of the evolution chain, that you can only get from /pokemon-species (What? You don’t know that Garbodor's evolution chain ID is 290 ?), so having the ability to just pass in a string for name is much easier.

Example

iex(1)> Pokerap.Ez.evolution("garbodor")
{:ok, ["trubbish", "garbodor"]}
flavor_text(name)

Returns a tuple containing request status, and map of flavor texts.

This data is found inside of the /pokemon endpoint (Pokerap.pokemon/1) but is nested somewhat deeply.

Will return in the language set in config under config :pokerap, language:. Defaults to “en”. See Readme for more details on this function.

Example

iex> Pokerap.Ez.flavor_text("bidoof")
{:ok,
%{"alpha-sapphire" => "It constantly gnaws on logs and rocks to whittle\ndown its front teeth. It nests alongside water.",
"black" => "A comparison revealed that\nBidoof’s front teeth grow at\nthe same rate as Rattata’s.",
"black-2" => "A comparison revealed that\nBidoof’s front teeth grow at\nthe same rate as Rattata’s.",
"diamond" => "With nerves of steel, nothing can\nperturb it. It is more agile and\nactive than it appears.",
... One entry for each game the Pokemon appears.
}
flavor_text!(name)

Gets map of pokedex style descriptions.

Returns map of flavor texts. Raises exceptions upon error. ! version of Pokerap.Ez.flavor_text/1

Example

iex(1)> Pokerap.Ez.flavor_text!("bidoof")
%{"alpha-sapphire" => "It constantly gnaws on logs and rocks to whittle\ndown its front teeth. It nests alongside water.",
"black" => "A comparison revealed that\nBidoof’s front teeth grow at\nthe same rate as Rattata’s.",
"black-2" => "A comparison revealed that\nBidoof’s front teeth grow at\nthe same rate as Rattata’s.",
"diamond" => "With nerves of steel, nothing can\nperturb it. It is more agile and\nactive than it appears.",
... One entry for each game the Pokemon appears.
}
images(name)

Returns a tuple containing request status, and map of images.

This data is found inside of the /pokemon endpoint (Pokerap.pokemon/1) but is nested somewhat deeply.

Example

iex(1)> Pokerap.Ez.images("poliwhirl")
{:ok,
%{"back_default" => "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/61.png",
"back_female" => nil,
"back_shiny" => "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/shiny/61.png",
"back_shiny_female" => nil,
"front_default" => "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/61.png",
"front_female" => nil,
"front_shiny" => "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/shiny/61.png",
"front_shiny_female" => nil}}
images!(name)

Gets map of images.

Returns map of images. Raises exceptions upon error. ! version of Pokerap.Ez.images/1

Example

iex(1)> Pokerap.Ez.images!("poliwhirl")
%{"back_default" => "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/61.png",
"back_female" => nil,
"back_shiny" => "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/shiny/61.png",
"back_shiny_female" => nil,
"front_default" => "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/61.png",
"front_female" => nil,
"front_shiny" => "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/shiny/61.png",
"front_shiny_female" => nil}
moves(name)

Returns a tuple containing request status, and list of possible moves a Pokemon can have/learn.

Returns “simple” list of ALL moves a Pokemon can have/learn

Example

iex(2)> Pokerap.Ez.moves("raichu")
{:ok,
["mega-punch", "pay-day", "thunder-punch", "mega-kick", "headbutt",
"body-slam", "take-down", "double-edge", "tail-whip", "growl", "hyper-beam",
"submission", "counter", "seismic-toss", "strength", "thunder-shock",
"thunderbolt", "thunder-wave", "thunder", "dig", "toxic", "quick-attack",
"rage", "mimic", "double-team", "defense-curl", "light-screen", "reflect",
"bide", "swift", "skull-bash", "flash", "rest", "substitute", "thief",
"snore", "curse", "protect", "mud-slap", "zap-cannon", "detect", "endure",
"rollout", "swagger", "attract", "sleep-talk", "return", "frustration",
"dynamic-punch", ...]} #this goes on for quite some time
moves!(name)

Returns a list of possible moves a Pokemon can have/learn.

Returns “simple” list of ALL moves a Pokemon can have/learn.

Raises exceptions upon error. ! version of Pokerap.Ez.moves/1

Example

iex(2)> Pokerap.Ez.moves("raichu")
{:ok,
["mega-punch", "pay-day", "thunder-punch", "mega-kick", "headbutt",
"body-slam", "take-down", "double-edge", "tail-whip", "growl", "hyper-beam",
"submission", "counter", "seismic-toss", "strength", "thunder-shock",
"thunderbolt", "thunder-wave", "thunder", "dig", "toxic", "quick-attack",
"rage", "mimic", "double-team", "defense-curl", "light-screen", "reflect",
"bide", "swift", "skull-bash", "flash", "rest", "substitute", "thief",
"snore", "curse", "protect", "mud-slap", "zap-cannon", "detect", "endure",
"rollout", "swagger", "attract", "sleep-talk", "return", "frustration",
"dynamic-punch", ...]} #this goes on for quite some time
types(name)

Returns a tuple containing request status, and list of Pokemon types.

This data is found inside of the /pokemon endpoint (Pokerap.pokemon/1) but is nested somewhat deeply.

Example

iex(1)> Pokerap.Ez.types("rotom")
{:ok, ["ghost", "electric"]}
types!(name)

Gets a list of types per pokemon

Returns list. Raises exceptions upon error. ! version of Pokerap.Ez.types/1

Example

iex(1)> Pokerap.Ez.types!("rotom")
["ghost", "electric"]