EveOnline-SSO

 view release on metacpan or  search on metacpan

lib/EveOnline/SSO/Client.pm  view on Meta::CPAN

=encoding utf-8

=head1 NAME

EveOnline::SSO::Client - base class for any Eve Online ESI API calls

=head1 SYNOPSIS

    use EveOnline::SSO::Client;

    my $client = EveOnline::SSO::Client->new(token => '************', x_user_agent => 'Pilot Name <email@gmail.com>');

    $api->get(['characters', 90922771, 'location'] );
    # url converting to https://esi.tech.ccp.is/latest/characters/90922771/location/?datasource=tranquility

=head1 DESCRIPTION

EveOnline::SSO::Client is base class for any EveOnline ESI API
Contains get, post, put, delete methods for calls to any APIs.

=cut

package EveOnline::SSO::Client;
use 5.008001;
use utf8;
use Modern::Perl;

use LWP::UserAgent;
use Storable qw/ dclone /;
use JSON::XS;
use Moo;

has 'ua' => (
    is => 'ro',
    default => sub {
        my $ua = LWP::UserAgent->new();
        $ua->agent( 'EveOnline::SSO::Client Perl API Client' );
        $ua->timeout( 120 );
        return $ua;
    }
);

has 'token' => (
    is => 'rw',
    required => 1,
);

has 'endpoint' => (
    is => 'rw',
    required => 1,
    default  => 'https://esi.tech.ccp.is/latest/',
);

has 'datasource' => (
    is => 'rw',
    required => 1,
    default => 'tranquility',
);

has 'x_user_agent' => (
    is => 'rw',
    required => 1,
);

has 'demo' => (
    is => 'rw'
);

=head1 CONSTRUCTOR

=over

=item B<new()>

Require arguments: token, x_user_agent

    my $client = EveOnline::SSO::Client->new(
                    token        => 'lPhJ_DLk345334532yfssfdJgFsnKI9rR4EZpcQnJ2',
                    x_user_agent => 'Pilot Name <email@gmail.com>',
                    endpoint     => 'https://esi.tech.ccp.is/latest/', # optional
                    datasource   => 'tranquility',                     # optional 
                );

For module based on EveOnline::SSO::Client
you can override atributes:
    

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 0.482 second using v1.00-cache-2.02-grep-82fe00e-cpan-2c419f77a38b )