vice::Geocodio::JSON;
$WebService::Geocodio::JSON::VERSION = '0.05';
# ABSTRACT: A JSON de/serializer class
use Moo::Role;
use strictures 2;
use JSON;
use Carp qw(confess);
has 'json' => (
is =
efault => sub { JSON->new() },
);
sub encode {
my ($self, $aref) = @_;
return $self->json->encode($aref);
}
sub decode {
my ($self, $data) = @_;
return $self->json->decode($data)
WebService::Geocodio::JSON - A JSON de/serializer class
=head1 VERSION
version 0.05
=head1 ATTRIBUTES
=head2 json
A JSON serializer/deserializer instance. Default is L<JSON>.
=head1 METHODS
=h
TTP::Tiny;
use Carp qw(confess);
use WebService::Geocodio::Location;
with 'WebService::Geocodio::JSON';
# ABSTRACT: A request role for Geocod.io
has 'ua' => (
is => 'ro',
lazy => 1,
de
agent => "WebService-Geocodio ",
default_headers => { 'Content-Type' => 'application/json' },
) },
);
has 'base_url' => (
is => 'ro',
lazy => 1,
default => sub { 'http:/
you can use a fancy object like L<WebService::Geocodio::Location> which will serialize
itself to JSON automatically.
=head2 fields
You may request the following fields be included in the results: