NAME

WebService::Pokemon - A module to access the Pokémon data through RESTful API from http://pokeapi.co.

SYNOPSIS

use WebService::Pokemon;

DESCRIPTION

WebService::Pokemon is a Perl client helper library for the Pokemon API (pokeapi.co).

DEVELOPMENT

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

METHODS

new([%$args])

Construct a new WebService::Pokemon instance. Optionally takes a hash or hash reference.

# Instantiate the class.
my $pokemon_api = WebService::Pokemon->new;

base_url

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'});

api_version

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'});

api_version

Get the current API version of the web service.

my $version = $pokemon_api->api_version();

# Change the API version.
$pokemon_api->api_version('v1');

pokemon

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');

berry

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');

berry_firmness

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');

berry_flavor

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');

commands

COPYRIGHT AND LICENSE

This software is Copyright (c) 2018 by Kian Meng, Ang.

This is free software, licensed under:

The Artistic License 2.0 (GPL Compatible)

AUTHOR

Kian Meng, Ang <kianmeng@users.noreply.github.com>