e;
use JSON;
use XML::Struct qw(readXML);
has items => (is => 'ro', required => 1);
has lang => (is => 'ro', default => 'nl-NL');
sub json {
my ($self) = @_;
my $tree = decode_json($self->
= shift;
my $url = sprintf('https://www.viaf.org/viaf/search?query=%s&httpAccept=application/json', $self->query);
my $response = $self->client->get($url);
if (!$response->is_success) {
fid => $id);
return $api_id->result;
}
sub parse {
my ($self, $response) = @_;
my $parser = Catmandu::VIAF::API::Parse->new(items => $response);
return $parser->json();
}
1;
__END__