The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Net::Travis::API::UA - Travis Specific User Agent that handles authorization

VERSION

version 0.001000

SYNOPSIS

    use Net::Travis::API::UA;
    use Data::Dump qw( pp );

    my $ua = Net::Travis::API::UA->new(
        http_prefix => 'https://api.travis-ci.org', # default
        authtokens => [ 'sometoken' ]               # multiple supported, but it may not mean anything for travis
    );

    my $result = $ua->get('/users');
    if ( $result->content_type eq 'application/json' ) {
        print pp( $result->content_json );
    else {
        print pp( $result );
    }

This module does a few things:

1. Wrap HTTP::Tiny
2. Assume you want to use relative URI's to the travis service
3. Inject Authorization tokens where possible.

All requests return ::Response objects.

METHODS

has_authtokens

A predicate that returns whether authtokens is set or not

request

This method overrides HTTP::Tiny's request method so as to augment all other methods inherited.

This simply wraps all responses in a Net::Travis::API::UA::Response

ATTRIBUTES

http_prefix

Optional.

Determines the base URI to use for relative URIs.

Defaults as https://api.travis-ci.org but should be changed if you're using their paid-for service.

authtokens

Optional.

If specified, determines a list of authentication tokens to pass with all requests.

json

Optional.

Defines a JSON decoder object.

AUTHOR

Kent Fredric <kentfredric@gmail.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2014 by Kent Fredric <kentfredric@gmail.com>.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.