NAME

Yandex::OAuth::Client - base class for any Yandex.API modules

SYNOPSIS

use Yandex::OAuth::Client;

my $client = Yandex::OAuth::Client->new(token => '************', endpoint => 'https://api-metrika.yandex.ru/');

my $client->get(['stat','user_vars'], {
        pretty => 1,
        # other params specified for resource
    });
# url converting to https://api-metrika.yandex.ru/stat/user_vars/?pretty=1

DESCRIPTION

Yandex::OAuth::Client is base class for any Yandex.API modules Contains get, post, put, delete methods for queries to any APIs Yandex.

Looking for contributors for this and other Yandex.APIs

CONSTRUCTOR

new()

Require two arguments: token and endpoint. For module based on Yandex::OAuth::Client you can override atribute 'endpoint'

extends 'Yandex::OAuth::Client';
has '+endpoint' => (
    is      => 'ro',
    default => 'https://api-metrika.yandex.ru/',
); 

METHODS

get()

Send GET request.

$client->get(['stat','load']);

# or full link. for example, when using "next" link from previous response

$client->get('https://api-metrika.yandex.ru/stat/load/?pretty=1');
post()

Send POST request.

$client->post(['counters'], {
        # query params 
    }, {
        # body params
    });
put()

Send PUT request.

$client->put(['counter', $counter_id], {
        # query params 
    }, {
        # body params
    });
delete()

Send DELETE request.

$client->delete(['counter', $counter_id]);

LICENSE

Copyright (C) Andrey Kuzmin.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

AUTHOR

Andrey Kuzmin <chipsoid@cpan.org>