API-Client

 view release on metacpan or  search on metacpan

INSTALL  view on Meta::CPAN


## Installing with the CPAN shell

Alternatively, if your CPAN shell is set up, you should just be able to do:

    % cpan API::Client

## Manual installation

As a last resort, you can manually install it. Download the tarball, untar it,
install configure prerequisites (see below), then build it:

    % perl Makefile.PL
    % make && make test

Then install it:

    % make install

On Windows platforms, you should use `dmake` or `nmake`, instead of `make`.

INSTALL  view on Meta::CPAN

https://metacpan.org/pod/local::lib

The prerequisites of this distribution will also have to be installed manually. The
prerequisites are listed in one of the files: `MYMETA.yml` or `MYMETA.json` generated
by running the manual build process described above.

## Configure Prerequisites

This distribution requires other modules to be installed before this
distribution's installer can be run.  They can be found under the
"configure_requires" key of META.yml or the
"{prereqs}{configure}{requires}" key of META.json.

## Other Prerequisites

This distribution may require additional modules to be installed after running
Makefile.PL.
Look for prerequisites in the following phases:

* to run make, PHASE = build
* to use the module code itself, PHASE = runtime
* to run tests, PHASE = test

META.json  view on Meta::CPAN

   "generated_by" : "Dist::Zilla version 6.014, CPAN::Meta::Converter version 2.150010",
   "license" : [
      "perl_5"
   ],
   "meta-spec" : {
      "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
      "version" : 2
   },
   "name" : "API-Client",
   "prereqs" : {
      "configure" : {
         "requires" : {
            "ExtUtils::MakeMaker" : "0"
         }
      },
      "runtime" : {
         "requires" : {
            "Data::Object::Class" : "2.02",
            "Data::Object::ClassHas" : "2.01",
            "Data::Object::Role::Buildable" : "0.03",
            "Data::Object::Role::Stashable" : "2.01",

META.yml  view on Meta::CPAN

  Data::Object::Role::Buildable: '0.03'
  Data::Object::Role::Stashable: '2.01'
  Data::Object::Role::Throwable: '2.01'
  FlightRecorder: '0.03'
  Mojolicious: '8.35'
  Test::Auto: '0.10'
  perl: '5.014'
  routines: '0'
  strict: '0'
  warnings: '0'
configure_requires:
  ExtUtils::MakeMaker: '0'
dynamic_config: 0
generated_by: 'Dist::Zilla version 6.014, CPAN::Meta::Converter version 2.150010'
license: perl
meta-spec:
  url: http://module-build.sourceforge.net/META-spec-v1.4.html
  version: '1.4'
name: API-Client
requires:
  Data::Object::Class: '2.02'

README  view on Meta::CPAN

    
      # https://httpbin.org/users/c09e91a
      my $user = $client->resource('users', 'c09e91a');
    
      # https://httpbin.org/users/c09e91a
      my $new_user = $users->resource('c09e91a');
    
      [$users, $user, $new_user]

    Because each call to "resource" returns a new object instance
    configured with a path (resource locator) based on the supplied
    parameters, reuse and request isolation are made simple, i.e., you will
    only need to configure the client once in your application.

 creating

      # given: synopsis
    
      my $tx1 = $client->resource('post')->create(
        json => {active => 1}
      );
    
      # is equivalent to

README  view on Meta::CPAN

      }
    
      package main;
    
      my $hookbin = Hookbin->new;

    This package was designed to be subclassed and provides hooks into the
    client building and request dispatching processes. Specifically, there
    are three useful hooks (i.e. methods, which if present are used to
    build up the client object and requests), which are, the auth hook,
    which should return a Tuple[Str, Str] which is used to configure the
    basic auth header, the base hook which should return a Tuple[Str] which
    is used to configure the base URL, and the headers hook, which should
    return a ArrayRef[Tuple[Str, Str]] which are used to configure the HTTP
    request headers.

 transacting

      # given: synopsis
    
      my $tx1 = $client->resource('patch')->patch(
        json => {active => 1}
      );
    

README.md  view on Meta::CPAN

    my $users = $client->resource('users');

    # https://httpbin.org/users/c09e91a
    my $user = $client->resource('users', 'c09e91a');

    # https://httpbin.org/users/c09e91a
    my $new_user = $users->resource('c09e91a');

    [$users, $user, $new_user]

Because each call to ["resource"](#resource) returns a new object instance configured with
a path (resource locator) based on the supplied parameters, reuse and request
isolation are made simple, i.e., you will only need to configure the client
once in your application.

## creating

    # given: synopsis

    my $tx1 = $client->resource('post')->create(
      json => {active => 1}
    );

README.md  view on Meta::CPAN

    }

    package main;

    my $hookbin = Hookbin->new;

This package was designed to be subclassed and provides hooks into the client
building and request dispatching processes. Specifically, there are three
useful hooks (i.e. methods, which if present are used to build up the client
object and requests), which are, the `auth` hook, which should return a
`Tuple[Str, Str]` which is used to configure the basic auth header, the
`base` hook which should return a `Tuple[Str]` which is used to configure the
base URL, and the `headers` hook, which should return a
`ArrayRef[Tuple[Str, Str]]` which are used to configure the HTTP request
headers.

## transacting

    # given: synopsis

    my $tx1 = $client->resource('patch')->patch(
      json => {active => 1}
    );

cpanfile  view on Meta::CPAN

  requires "Data::Object::Role::Throwable" => "2.01";
  requires "FlightRecorder" => "0.03";
  requires "Mojolicious" => "8.35";
  requires "Test::Auto" => "0.10";
  requires "perl" => "5.014";
  requires "routines" => "0";
  requires "strict" => "0";
  requires "warnings" => "0";
};

on 'configure' => sub {
  requires "ExtUtils::MakeMaker" => "0";
};

lib/API/Client.pm  view on Meta::CPAN

  my $users = $client->resource('users');

  # https://httpbin.org/users/c09e91a
  my $user = $client->resource('users', 'c09e91a');

  # https://httpbin.org/users/c09e91a
  my $new_user = $users->resource('c09e91a');

  [$users, $user, $new_user]

Because each call to L</resource> returns a new object instance configured with
a path (resource locator) based on the supplied parameters, reuse and request
isolation are made simple, i.e., you will only need to configure the client
once in your application.

=cut

=head2 creating

  # given: synopsis

  my $tx1 = $client->resource('post')->create(
    json => {active => 1}

lib/API/Client.pm  view on Meta::CPAN

  }

  package main;

  my $hookbin = Hookbin->new;

This package was designed to be subclassed and provides hooks into the client
building and request dispatching processes. Specifically, there are three
useful hooks (i.e. methods, which if present are used to build up the client
object and requests), which are, the C<auth> hook, which should return a
C<Tuple[Str, Str]> which is used to configure the basic auth header, the
C<base> hook which should return a C<Tuple[Str]> which is used to configure the
base URL, and the C<headers> hook, which should return a
C<ArrayRef[Tuple[Str, Str]]> which are used to configure the HTTP request
headers.

=cut

=head2 transacting

  # given: synopsis

  my $tx1 = $client->resource('patch')->patch(
    json => {active => 1}

t/API_Client.t  view on Meta::CPAN

  my $patch = $client->resource('patch')->dispatch(
    method => 'patch'
  );

  [$get, $head, $patch]

=cut

=scenario chaining

Because each call to L</resource> returns a new object instance configured with
a path (resource locator) based on the supplied parameters, reuse and request
isolation are made simple, i.e., you will only need to configure the client
once in your application.

=example chaining

  # given: synopsis

  # https://httpbin.org/users
  my $users = $client->resource('users');

  # https://httpbin.org/users/c09e91a

t/API_Client.t  view on Meta::CPAN

  [$tx1, $tx2]

=cut

=scenario subclassing

This package was designed to be subclassed and provides hooks into the client
building and request dispatching processes. Specifically, there are three
useful hooks (i.e. methods, which if present are used to build up the client
object and requests), which are, the C<auth> hook, which should return a
C<Tuple[Str, Str]> which is used to configure the basic auth header, the
C<base> hook which should return a C<Tuple[Str]> which is used to configure the
base URL, and the C<headers> hook, which should return a
C<ArrayRef[Tuple[Str, Str]]> which are used to configure the HTTP request
headers.

=example subclassing

  package Hookbin;

  use Data::Object::Class;

  extends 'API::Client';



( run in 0.366 second using v1.01-cache-2.11-cpan-283623ac599 )