Regru::API::Response - REG.API v2 response wrapper
version 0.052
my $resp = Regru::API::Response->new( response => $response, );
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; }
Flag to show whether or not the most last API request has been successful.
See example for "is_service_fail".
Contains a HTTP::Response object for the most last API request.
if ($resp->is_service_fail) { print "HTTP code: " . $resp->response->code; }
Contains decoded answer for the most last successful API request.
if ($resp->is_success) { print Dumper($resp->answer); }
This is useful for debugging;
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.
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.
lang
Contains additional parameters included into the common error text.
$error_params = $resp->error_params; print "Details: " . $error_params->{error_detail};
A few messages will be printed to STDERR. Default value is 0 (suppressed debug activity).
Creates a response object from REG.API response. Available options:
Required. This should be a result of HTTP request to REG.API. In general, is a HTTP::Response object returned by LWP::UserAgent.
Not required. Print some debugging messages to STDERR. Default value is 0. Because of this contructor invoked from Regru::API::Role::Client mainly so this option sets to the value which passed to Regru::API constructor.
Gets a value from stored in answer.
$resp = $client->user->get_statistics; print "Account balance: " . $resp->get("balance_total");
Regru::API
Regru::API::Role::Client
Regru::API::Role::Serializer
Regru::API::Role::Loggable
HTTP::Response
LWP::UserAgent
REG.API Common error codes
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.
Polina Shubina <shubina@reg.ru>
Anton Gerasimov <a.gerasimov@reg.ru>
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.
To install Regru::API, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Regru::API
CPAN shell
perl -MCPAN -e shell install Regru::API
For more information on module installation, please visit the detailed CPAN module installation guide.