WebService::Pokemon - A module to access the Pokémon data through RESTful API from http://pokeapi.co.
use WebService::Pokemon;
WebService::Pokemon is a Perl client helper library for the Pokemon API (pokeapi.co).
Setting up the required packages.
$ cpanm Dist::Milla $ milla listdeps --missing | cpanm
Check you code coverage.
$ milla cover
Several ways to run the test.
$ milla test $ milla test --author --release $ AUTHOR_TESTING=1 RELEASE_TESTING=1 milla test $ AUTHOR_TESTING=1 RELEASE_TESTING=1 milla run prove t/01_instantiation.t $ LOGGING=1 milla run prove t/t/03_pokemon.t
Release the module.
$ milla build $ milla release
Construct a new WebService::Pokemon instance. Optionally takes a hash or hash reference.
# Instantiate the class. my $pokemon_api = WebService::Pokemon->new;
The URL of the API resource.
# Instantiate the class by setting the URL of the API endpoints. my $pokemon_api = WebService::Pokemon->new({api_url => 'http://example.com/api/v2'});
The API version of the API endpoints. By default, the API version was set to 'v2'.
# Instantiate the class by setting the API version. my $pokemon_api = WebService::Pokemon->new({api_version => 'v1'});
Get the current API version of the web service.
my $version = $pokemon_api->api_version(); # Change the API version. $pokemon_api->api_version('v1');
Get the details of a particular Pokémon either by id or name.
my $pokemon = $pokemon_api->pokemon(id => 1); my $pokemon = $pokemon_api->pokemon(id => 'bulbasaur');
Get the details of a particular berry either by id or name.
my $pokemon = $pokemon_api->berry(id => 1); my $pokemon = $pokemon_api->berry(id => 'cheri');
Get the details of a particular berry firmness either by id or name.
my $pokemon = $pokemon_api->berry_firmness(id => 1); my $pokemon = $pokemon_api->berry_firmness(id => 'very-soft');
Get the details of a particular berry flavor either by id or name.
my $pokemon = $pokemon_api->berry_firmness(id => 1); my $pokemon = $pokemon_api->berry_firmness(id => 'spicy');
This software is Copyright (c) 2018 by Kian Meng, Ang.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)
Kian Meng, Ang <kianmeng@users.noreply.github.com>
To install WebService::Pokemon, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WebService::Pokemon
CPAN shell
perl -MCPAN -e shell install WebService::Pokemon
For more information on module installation, please visit the detailed CPAN module installation guide.