NAME
WWW::Challonge - Perl wrapper for the Challonge API
VERSION
Version 1.01
SYNOPSIS
Access the Challonge API within Perl. Contains all the functions within the API, as documented here.
use WWW::Challonge;
my $c = WWW::Challonge->new($api_key)
...
SUBROUTINES/METHODS
new
Creates a new WWW::Challonge
object. Takes in an API key, which is required, and optionally a preconfigured LWP::UserAgent object, which is mostly used for testing.
my $c = WWW::Challonge->new($api_key);
my $c2 = WWW::Challonge->new({ key => $api_key, client => $my_client });
tournaments
Returns an arrayref of all WWW::Challonge::Tournament
objects owned by the user authenticated with in the 'new' request (the logged in user, so to speak). Takes a number of optional arguments:
- state
-
Get tournaments based on their progress:
- all
-
Gets all tournaments regardless of state.
- pending
-
Gets all tournaments that have yet to start.
- in_progress
-
Gets all tournaments that have started but have not finished.
- ended
-
Gets all tournaments that have finished.
- type
-
Gets all tournaments of the given type:
- single_elimination
- double_elimination
- round_robin
- swiss
- created_after
-
Gets all the tournaments created after the given date. Can be given as an ISO8601 date string or as a DateTime object.
- created_before
-
Gets all the tournaments created before the given date. Can be given as an ISO8601 string or as a DateTime object.
- subdomain
-
Gets all tournaments created under the given subdomian.
my $tournies = $c->tournaments;
my $tournies2 = $c->tournaments({
type => "double_elimination",
created_after => "2015-03-18",
});
tournament
Gets a single WWW::Challonge::Tournament
object by the given id or URL:
my $tourney = $c->tournament("sample_tournament_1");
If the tournament has a subdomain (e.g. test.challonge.com/mytourney), simply specify like so:
my $tourney = $c->tournament("test-mytourney")
new_tournament
Creates a new tournament, and returns it as a WWW::Challonge::Tournament
object. It takes an hashref of arguments. The name and URL are required, all others are optional.
- name
-
A string containing the name of the tournament.
- tournament_type
-
A string containing one of the following, detailing the type of tournament.
- url
-
The url of the tournament, containing only letters, numbers and underscores.
- subdomain
-
The subdomain of the tournament (requires write access to the given subdomain).
- description
-
The description of the tournament to be displayed above the bracket.
- game_name
-
The name of the game or sport being played.
- open_signup
-
True/false. Have Challonge host a sign-up page (otherwise, manually add participants).
- hold_third_place_match
-
True/false. Single elimination only. Hold a match for semifinals losers to determine third place? Default is false.
- pts_for_match_win
-
Decimal (to the nearest tenth). Number of points gained on winning a match. Swiss only. Default is 1.0.
- pts_for_match_tie
-
Decimal (to the nearest tenth). Number of points gained on drawing a match. Swiss only. Default is 0.5.
- pts_for_game_win
-
Decimal (to the nearest tenth). Number of points gained on winning a single game within a match. Swiss only. Default is 0.0.
- pts_for_game_tie
-
Decimal (to the nearest tenth). Number of points gained on drawing a single game within a match. Swiss only. Default is 0.0.
- pts_for_bye
-
Decimal (to the nearest tenth). Number of points gained on getting a bye. Swiss only. Default is 1.0.
- swiss_rounds
-
Integer. Number of swiss rounds to play. Swiss only. It is recommended that the number of rounds is limited to no more than two thirds of the number of players, otherwise an impossible pairing situation may occur and the tournament may end prematurely.
- ranked_by
-
How the tournament is ranked. Can be one of the following.
- rr_pts_for_match_win
-
Decimal (to the nearest tenth). Number of points gained by winning a match. Round Robin 'custom' only. Default is 1.0.
- rr_pts_for_match_tie
-
Decimal (to the nearest tenth). Number of points gained by drawing a match. Round Robin 'custom' only. Default is 0.5.
- rr_pts_for_game_win
-
Decimal (to the nearest tenth). Number of points gained by winning a single game within a match. Round Robin 'custom' only. Default is 0.0.
- rr_pts_for_game_tie
-
Decimal (to the nearest tenth). Number of points gained by drawing a single game within a match. Round Robin 'custom' only. Default is 0.0.
- accept_attachments
-
True/false. Allow match attachment uploads. Default is false.
- hide_forum
-
True/false. Hide the forum tab on your Challonge page. Default is false.
- show_rounds
-
True/false. Label each round about the bracket. Single and double elimination only. Default is false.
- private
-
True/false. Hide this tournament from the public browsable index and your profile. Default is false.
- notify_users_when_matches_open r
-
True/false. Send registered Challonge users an email when matches open up for them. Default is false.
- nofity_users_when_the_tournament_ends
-
True/false. Send registered Challonge users an email with the results when the tournament ends. Default is false.
- sequential_pairings
-
True/false. Instead of following traditional seeding rules, make the pairings go straight down the list of participants. For example, the first match will be the first seed versus the second. Default is false.
- signup_cap
-
Integer. The maximum number of participants. Any additional participants will go on a waiting list.
- start_at
-
DateTime. The planned time to start the tournament. Timezone defaults to Eastern (EST).
- check_in_duration
-
Integer. The length of the check-in window in minutes.
my $tournament = $c->new_tournament({
name => "sample tournament",
url => "sample_tournament_1",
type => "double elimination"
});
__handle_error
Used throughout the module to deal with when the Challonge API returns an error of some kind. Takes a HTTP::Response object.
__json_request
Transforms a URI, verb and hashref to a HTTP::Request object to use for a POST/PUT request with the hashref transformed to JSON.
AUTHOR
Alex Kerr, <kirby at cpan.org>
BUGS
Please report any bugs or feature requests to bug-www-challonge at rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=WWW-Challonge. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc WWW::Challonge
You can also look for information at:
RT: CPAN's request tracker (report bugs here)
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
Search CPAN
SEE ALSO
- WWW::Challonge::Tournament
- WWW::Challonge::Participant
- WWW::Challonge::Match
- WWW::Challonge::Match::Attachment
ACKNOWLEDGEMENTS
Everyone on the Challonge team for making such a great service.
LICENSE AND COPYRIGHT
Copyright 2015 Alex Kerr.
This program is free software; you can redistribute it and/or modify it under the terms of the the Artistic License (2.0). You may obtain a copy of the full license at:
http://www.perlfoundation.org/artistic_license_2_0
Any use, modification, and distribution of the Standard or Modified Versions is governed by this Artistic License. By using, modifying or distributing the Package, you accept this license. Do not use, modify, or distribute the Package, if you do not accept this license.
If your Modified Version has been derived from a Modified Version made by someone other than you, you are nevertheless required to ensure that your Modified Version complies with the requirements of this license.
This license does not grant you the right to use any trademark, service mark, tradename, or logo of the Copyright Holder.
This license includes the non-exclusive, worldwide, free-of-charge patent license to make, have made, use, offer to sell, sell, import and otherwise transfer the Package with respect to any patent claims licensable by the Copyright Holder that are necessarily infringed by the Package. If you institute patent litigation (including a cross-claim or counterclaim) against any party alleging that the Package constitutes direct or contributory patent infringement, then this Artistic License to you shall terminate on the date that such litigation is filed.
Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.