Net::Travis::API::UA - Travis Specific User Agent that handles authorization
version 0.002000
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:
All requests return ::Response objects.
::Response
has_authtokens
A predicate that returns whether authtokens is set or not
authtokens
request
This method overrides HTTP::Tiny's request method so as to augment all other methods inherited.
HTTP::Tiny
This simply wraps all responses in a Net::Travis::API::UA::Response
Net::Travis::API::UA::Response
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.
https://api.travis-ci.org
http_default_accept_headers
Sets the default Accept headers to send to the Travis-CI service.
Accept
Defaults to application/vnd.travis-ci.2+json as per the API documentation. Without this, the deprecated version 1 API will be used instead.
application/vnd.travis-ci.2+json
If specified, determines a list of authentication tokens to pass with all requests.
json
Defines a JSON decoder object.
Kent Fredric <kentnl@cpan.org>
This software is copyright (c) 2016 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.
To install Net::Travis::API, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::Travis::API
CPAN shell
perl -MCPAN -e shell install Net::Travis::API
For more information on module installation, please visit the detailed CPAN module installation guide.