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

NAME

Finance::Dogechain::Base - base class for all Finance::Dogechain classes

SYNOPSIS

    use Mojo::Base -base, -signatures, 'Finance::Dogechain::Base';

    # your methods here

DESCRIPTION

Finance::Dogechain::Base is a base class for all Finance::Dogechain classes. You should not use it directly; inherit from it.

METHODS

This module provides several methods.

new( ua => ..., base_url => ... )

Creates a new instance of this object. Default values are:

  • ua, a user agent. Defaults to an instance of Mojo::UserAgent.

  • base_url, the base URL path of the dogechain.info API (or an equivalent).

These attributes are available by instance methods ua() and base_url().

return_field_if_success($url_path, $field)

Given a URL path, suffixed to the base_url provided in the constructor, calls the API. If the result is successful, extracts and returns the JSON data structure in the returned JSON payload at the top-level field provided in $field.

Returns an undefined value (undef in scalar context or an empty list in list context) if the HTTP call did not succeed.

Returns 0 if the HTTP call did succeed but the API returned an unsuccessful payload.

COPYRIGHT & LICENSE

Copyright 2021 chromatic, some rights reserved.

This program is free software. You can redistribute it and/or modify it under the same terms as Perl 5.32.