The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

Megaport::Client

DESCRIPTION

This class provides a simple mechanism for making API calls and performing error handling and returning data in a well-known format intended for use in the rest of the Megaport package.

METHODS

login

Performs the appropriate login action based on the credentials provided (username/password or token).

verify

If no_verify is not set, this is called by login to validate the token.

request

    # Simple GET
    my $data = $client->request(GEt => '/locations');

    # POST
    my $data = $client->request(POST => '/profile', content => encode_json($user));

Performs a HTTP request, arguments are similar to HTTP::Request but trimmed. Creates a HTTP::Request object with the right base URI and auth headers.

If debug is set, this will also dump the response body to STDERR.

AUTHOR

Cameron Daniel <cdaniel@cpan.org>