Group
Extension

Matches 3

Catmandu-Store-REST ( P/PI/PIETERDP/Catmandu-Store-REST-0.01.tar.gz, PIETERDP, 2017; MetaCPAN )
Catmandu-Store-REST/lib/Catmandu/Store/REST.pm ( view source; MetaCPAN )
on

1;
__END__

=encoding utf-8

=head1 NAME

Catmandu::Store::REST - Store/retrieve items from a JSON REST-API endpoint

=head1 SYNOPSIS

  # From the command line
  $ catmandu export REST --id 1234 
tore|http://librecat.org/Catmandu/#stores>.

The module allows you to use a RESTful API that uses JSON as data format and uses the URL format
C<[base_url]/[id][query_string]> as a I<Store> for I<Catma
 and deleting (C<DELETE>) single items is
supported. Data must be provided as JSON by the API, and the API must accept JSON for C<PUT>/C<POST>
requests. The URL must be of the format C<[base_url]/[id]
Catmandu-Store-REST ( P/PI/PIETERDP/Catmandu-Store-REST-0.01.tar.gz, PIETERDP, 2017; MetaCPAN )
Catmandu-Store-REST/lib/Catmandu/Store/REST/Bag.pm ( view source; MetaCPAN )
package Catmandu::Store::REST::Bag;

use Moo;
use JSON;

use Catmandu::Sane;
use Catmandu::Store::REST::API;

with 'Catmandu::Bag';

has api => (is => 'lazy');

sub _build_api {
    my $self = shift;
Catmandu-Store-REST ( P/PI/PIETERDP/Catmandu-Store-REST-0.01.tar.gz, PIETERDP, 2017; MetaCPAN )
Catmandu-Store-REST/lib/Catmandu/Store/REST/API.pm ( view source; MetaCPAN )
package Catmandu::Store::REST::API;

use Catmandu::Sane;
use Moo;
use JSON;
use LWP::UserAgent;

has base_url     => (is => 'ro', required => 1);
has query_string => (is => 'ro');

has client   => (is
 my $response = $self->client->get($url);

    if ($response->is_success) {
        return decode_json($response->decoded_content);
    } elsif ($response->code == 404) {
        return {};
    } else
 $url = $self->mk_url();
    my $json_data = encode_json($data);
    
    my $response = $self->client->post($url, Content_Type => 'application/json', Content => $json_data);

    if ($response->is_su

Powered by Groonga
Maintained by Kenichi Ishigaki <ishigaki@cpan.org>. If you find anything, submit it on GitHub.