Apigee-Edge

 view release on metacpan or  search on metacpan

README.md  view on Meta::CPAN

    required. organization name.

- usr

    required. login email

- pwd

    required. login password

- endpoint

    optional. default to https://api.enterprise.apigee.com/v1

## Apps

[http://apigee.com/docs/api/apps-0](http://apigee.com/docs/api/apps-0)

### get\_app

    my $app = $apigee->get_app($app_id);

lib/Apigee/Edge.pm  view on Meta::CPAN

sub errstr { return $errstr }

sub new {    ## no critic (ArgUnpacking)
    my $class = shift;
    my %args = @_ % 2 ? %{$_[0]} : @_;

    for (qw/org usr pwd/) {
        $args{$_} || croak "Param $_ is required.";
    }

    $args{endpoint} ||= 'https://api.enterprise.apigee.com/v1';
    $args{timeout}  ||= 60;                                       # for ua timeout

    return bless \%args, $class;
}

sub __ua {
    my $self = shift;

    return $self->{ua} if exists $self->{ua};

lib/Apigee/Edge.pm  view on Meta::CPAN


sub request {
    my ($self, $method, $url, %params) = @_;

    $errstr = '';                # reset

    my $ua = $self->__ua;
    my $header = {Authorization => 'Basic ' . b64_encode($self->{usr} . ':' . $self->{pwd}, '')};
    $header->{'Content-Type'} = 'application/json' if %params;
    my @extra = %params ? (json => \%params) : ();
    my $tx = $ua->build_tx($method => $self->{endpoint} . $url => $header => @extra);
    $tx->req->headers->accept('application/json');

    $tx = $ua->start($tx);
    if ($tx->res->headers->content_type and $tx->res->headers->content_type =~ 'application/json') {
        return $tx->res->json;
    }
    if (!$tx->success) {
        $errstr = "Failed to fetch $url: " . $tx->error->{message};
        return;
    }

lib/Apigee/Edge.pm  view on Meta::CPAN

required. organization name.

=item * usr

required. login email

=item * pwd

required. login password

=item * endpoint

optional. default to https://api.enterprise.apigee.com/v1

=back

=head2 Apps

L<http://apigee.com/docs/api/apps-0>

=head3 get_app



( run in 0.439 second using v1.01-cache-2.11-cpan-b61123c0432 )