NAME

Regru::API::Response - REG.API v2 response wrapper

VERSION

version 0.003

ATTRIBUTES

is_service_fail

Flag to show whether or not the most last answer from the API service has not been finished with code HTTP 200.

$resp = $client->bill->nop(bill_id => 123213);

if ($resp->is_success) {
    print "It works!";
}
elsif ($resp->is_service_fail) {
    print "Reg.ru API is gone :(";
}
else {
    print "Error code: ". $resp->error_code;
}

is_success

Flag to show whether or not the most last API request has been successful.

See example for #is_service_fail.

response

Contains a HTTP::Response object for the most last API request.

if ($resp->is_service_fail) {
    print "HTTP code: " . $resp->response->code;
}

answer

Contains decoded answer for the most last successful API request.

if ($resp->is_success) {
    print Dumper($resp->answer);
}

This is useful for debugging;

error_code

Contains error code for the most last API request if it has not been successful.

Full list error codes list is available at REG.API Common error codes.

error_text

Contains common error text for the most last API request if it has not been successful.

Default language is enlish. Language can be changed by passing option lang to the Regru::API constructor.

error_params

Contains additional parameters included into the common error text.

$error_params = $resp->error_params;
print "Details: " . $error_params->{error_detail};

METHODS

get

Gets a value from stored in answer.

$resp = $client->user->get_statistics;
print "Account balance: " . $resp->get("balance_total");

SEE ALSO

Regru::API

Regru::API::Role::Serializer

HTTP::Response

REG.API Common error codes.

BUGS

Please report any bugs or feature requests on the bugtracker website https://github.com/regru/regru-api-perl/issues

When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.

AUTHORS

  • Polina Shubina <shubina@reg.ru>

  • Anton Gerasimov <a.gerasimov@reg.ru>

COPYRIGHT AND LICENSE

This software is copyright (c) 2013 by REG.RU LLC.

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