NAME WebService::RESTCountries - A Perl module to interface with the REST Countries (restcountries.eu) webservice. SYNOPSIS use WebService::RESTCountries; my $api = WebService::RESTCountries->new; $api->search_all(); DESCRIPTION WebService::RESTCountries is a Perl client helper library for the REST Countries API (restcountries.eu). DEVELOPMENT Source repo at https://github.com/kianmeng/webservice-restcountries. Docker If you have Docker installed, you can build your Docker container for this project. $ docker build -t webservice-restcountries . $ docker run -it -v $(pwd):/root webservice-restcountries bash # cpanm --installdeps --notest . Milla Setting up the required packages. $ milla authordeps --missing | cpanm $ 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/02_request.t Release the module. $ milla build $ milla release METHODS new([%$args]) Construct a new WebService::RESTCountries instance. Optionally takes a hash or hash reference. # Instantiate the class. my $api = WebService::RESTCountries->new; api_url The URL of the API resource. # Instantiate the class by setting the URL of the API endpoints. my $api = WebService::RESTCountries->new(api_url => 'https://example.com/v2/'); search_all() Get all the countries. search_by_calling_code Get the details of a country by its calling code, the prefixes for the country phone numbers. $api->search_by_calling_code('60'); search_by_capital_city Get the details of a country by its capital city. # Full name. $api->search_by_capital_city("Kuala Lumpur"); # Partial name. $api->search_by_capital_city("Kuala"); search_by_country_code Get the details of a country by its ISO 3166 two-letters or three-letters country code. # Two-letters. $api->search_by_country_code("MY"); # Three-letters. $api->search_by_country_code("MYS"); search_by_country_codes Get the list of country by multiple ISO 3166 two-letters or three-letters country codes. # Two-letters. $api->search_by_country_codes(['MY', 'SG']); # Three-letters. $api->search_by_country_codes(['MYS', 'SGP']); search_by_country_full_name Get the details of a country by its full name. $api->search_by_country_full_name("São Tomé and PrÃncipe"); search_by_country_name($name) Get the details of a country by name, either by native or partial name. # Native name. $api->search_by_country_name("Malaysia"); # Partial name. $api->search_by_country_name("Malays"); search_by_currency Get the details of a country by ISO 4217 currency code. $api->search_by_currency("MYR"); search_by_language_code Get the details of the a country by ISO 639-1 language code. $api->search_by_language_code("ms"); search_by_region Get list of country by region: Africa, Americas, Asia, Europe, Oceania. Region name is case insensitive. $api->search_by_region("Asia"); $api->search_by_region("asia"); search_by_regional_bloc Get list of country by regional bloc: EU, EFTA, CARICOM, PA, AU, USAN, EEU, AL, ASEAN, CAIS, CEFTA, NAFTA, SAARC. Regional bloc name is case insensitive. $api->search_by_region_bloc("EU"); $api->search_by_regional_bloc("asean"); 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>