package AnyEvent::Lingr;
use Mouse;
our $VERSION = '0.07';
use AnyEvent::HTTP;
use Carp;
use JSON;
use Log::Minimal;
use Scalar::Util ();
use Try::Tiny;
use URI;
has ['user', 'password'] => (
ms);
my $cb_wrap = sub {
my ($body, $hdr) = @_;
my $json = try { decode_json $body };
$cb->($json, $hdr);
};
if ($http_method eq 'GET') {
http_get $uri,
sub {
my ($body, $hdr) = @_;
return unless $self;
my $res = try { decode_json $body };
if ($res and $res->{status} eq 'ok') {
if ($res->{counter}) {