Net::Moip::V2::Endpoint - Send HTTP requests to an endpoint.
use Net::Moip::V2; my $moip = Net::Moip::V2->new( ... ); # List orders: GET /orders my $ep_orders = $moip->endpoint('orders'); my $response = $ep_orders->get; # $response is a Furl::Response object
This class represents a single endpoint in the Moip API v2. It provides methods for sending raw http requests, handling the authorization and other required http headers for you.
Sends a GET request to the endpoint url. Can optionally append the a resource id to the url. Returns the raw Furl::Response object.
# GET https://api.moip.com.br/v2/orders my $response = $moip->endpoint('orders')->get; if ($response->is_success) { my $data = $moip->decode_json($response->content); foreach my $order (@{ $data->{orders} }) { ... } } # GET https://api.moip.com.br/v2/orders/ORD-123456789012 my $response = $moip->endpoint('orders')->get('ORD-123456789012'); if ($response->is_success) { my $order = $moip->decode_json($response->content); ... }
For detailed information about the response format, see https://dev.moip.com.br/v2.0/reference#intro.
Sends a GET request to the endpoint url. The \%data hashref is encoded to JSON and the proper content type and authentication headers are set. Returns the raw Furl::Response object.
\%data
# POST https://api.moip.com.br/v2/orders my $response = $moip->endpoint('orders')->post({ ownId: '12345', amount: { ... }, ... }); if ($response->is_success) { my $new_order = $moip->decode_json($response->content); ... }
Consult the official API reference for detailed information about the required data for each endpoint.
Helper method for decoding json string into perl data.
Copyright (C) Carlos Fernando Avila Gratz.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Carlos Fernando Avila Gratz <cafe@kreato.com.br>
To install Net::Moip::V2, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::Moip::V2
CPAN shell
perl -MCPAN -e shell install Net::Moip::V2
For more information on module installation, please visit the detailed CPAN module installation guide.