API-Client
view release on metacpan or search on metacpan
# PATCH /patch
my $patch = $client->resource('patch')->dispatch(
method => 'patch'
);
[$get, $head, $patch]
Building up an HTTP request is extremely easy, simply call the
"resource" to create a new object instance representing the API
endpoint you wish to issue a request against.
chaining
# given: synopsis
# https://httpbin.org/users
my $users = $client->resource('users');
# https://httpbin.org/users/c09e91a
my $user = $client->resource('users', 'c09e91a');
$client->process(
Mojo::UserAgent->new,
Mojo::Transaction::HTTP->new
);
resource
resource(Str @segments) : Object
The resource method returns a new instance of the object for the API
resource endpoint specified.
resource example #1
# given: synopsis
$client->resource('status', 200);
serialize
serialize() : HashRef
);
# PATCH /patch
my $patch = $client->resource('patch')->dispatch(
method => 'patch'
);
[$get, $head, $patch]
Building up an HTTP request is extremely easy, simply call the ["resource"](#resource) to
create a new object instance representing the API endpoint you wish to issue a
request against.
## chaining
# given: synopsis
# https://httpbin.org/users
my $users = $client->resource('users');
# https://httpbin.org/users/c09e91a
$client->process(
Mojo::UserAgent->new,
Mojo::Transaction::HTTP->new
);
## resource
resource(Str @segments) : Object
The resource method returns a new instance of the object for the API resource
endpoint specified.
- resource example #1
# given: synopsis
$client->resource('status', 200);
## serialize
serialize() : HashRef
lib/API/Client.pm view on Meta::CPAN
);
# PATCH /patch
my $patch = $client->resource('patch')->dispatch(
method => 'patch'
);
[$get, $head, $patch]
Building up an HTTP request is extremely easy, simply call the L</resource> to
create a new object instance representing the API endpoint you wish to issue a
request against.
=cut
=head2 chaining
# given: synopsis
# https://httpbin.org/users
my $users = $client->resource('users');
lib/API/Client.pm view on Meta::CPAN
=back
=cut
=head2 resource
resource(Str @segments) : Object
The resource method returns a new instance of the object for the API resource
endpoint specified.
=over 4
=item resource example #1
# given: synopsis
$client->resource('status', 200);
=back
t/API_Client.t view on Meta::CPAN
provides a simple and consistent mechanism for dynamically generating HTTP
requests. Additionally, this module has support for debugging and retrying API
calls as well as throwing exceptions when 4xx and 5xx server response codes are
returned.
=cut
=scenario building
Building up an HTTP request is extremely easy, simply call the L</resource> to
create a new object instance representing the API endpoint you wish to issue a
request against.
=example building
# given: synopsis
my $resource = $client->resource('get');
# GET /get
my $get = $client->resource('get')->dispatch;
t/API_Client.t view on Meta::CPAN
$client->process(
Mojo::UserAgent->new,
Mojo::Transaction::HTTP->new
);
=cut
=method resource
The resource method returns a new instance of the object for the API resource
endpoint specified.
=signature resource
resource(Str @segments) : Object
=example-1 resource
# given: synopsis
$client->resource('status', 200);
( run in 0.268 second using v1.01-cache-2.11-cpan-27979f6cc8f )