Restish-Client

 view release on metacpan or  search on metacpan

README.md  view on Meta::CPAN

```
NAME
    Restish::Client - A RESTish client...in perl!

SYNOPSIS
    my $client = Restish::Client->new(
        uri_host            => 'https://vault.example.com/',
        head_params_default => { X-Vault-Token => a_token },
        agent_options       => { timeout => 5 },
        require_https       => 1,
        ssl_opts => {
            -=> 1,
            SSL_cert_file   => "/etc/ssl/certs/cert.pem",
            SSL_key_file    => "/etc/ssl/private_keys/key.pem",
        },
        cooke_jar           => 1,
    );

    $client->head_params_default({ 'X-Vault-Token' => $auth_token });
    $client->ssl_opts({ SSL_use_cert => 1 });

    $client->cookie_jar(1); # OR
    $client->cookie_jar(/path/to/cookiejar);

    $client->request( method      => 'POST',
                      uri         => 'already/escaped/path',  
                      query_params  => { param1 => value1, param2 => value2 },
                      body_params => { body_param1 => bvalue1, body_param2 => bvalue2 },
                      head_params => { X-Subject-Token => $subject_token } 
    );

    # request method shorthand
    $client->GET(
        uri => 'endpoint',
    );

DESCRIPTION
    This module provides a Perl wrapper for the REST-like API's.

  METHODS
    "new"

                Construct a new Restish::Client object. The uri_host is used
                as the base uri for each API call, and serves as a template
                if string interpolation is used (see below).

                Optionally provide any data that can be set via a mutator,
                such as head_params_default or the ssl_opts.

                Options can be passed to the user agent (currently LWP) via
                agent_options.

                If require_https is set, new() will die if uri_host is not
                an https uri.

    "head_params_default"

                Supply a hashref specifying default header parameters to be
                sent with every request using this object.

    "ssl_opts"
                Supply a hashref specifying default LWP UserAgent SSL
                options to be sent with every request using this object.

    "cookie_jar"
                Enable LWP UserAgent's cookie_jar. Optionally store the
                cookie jar to disk.

    "request"
                Send a request based off of the object's base uri_host,
                returning a Perl data structure of the parsed JSON response
                in the event of a 2xx series response code. c<method> and
                c<uri> are required.



( run in 1.346 second using v1.01-cache-2.11-cpan-39bf76dae61 )