| 1 | package WG::API::NET; | ||
| 2 | |||
| 3 | 2 | ▶ | use Const::Fast; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 2 | ▶ | use Carp qw/cluck/; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 2 | ▶ | use Moo; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | |||
| 7 | 2 | with 'WG::API::Base'; | |
| 8 | |||
| 9 | =head1 NAME | ||
| 10 | |||
| 11 | WG::API::NET - Module to work with Wargaming.net Public API | ||
| 12 | |||
| 13 | =head1 VERSION | ||
| 14 | |||
| 15 | Version v0.11 | ||
| 16 | |||
| 17 | =cut | ||
| 18 | |||
| 19 | 2 | our $VERSION = 'v0.11'; | |
| 20 | |||
| 21 | 2 | const my $api_uri => '//api.worldoftanks.ru/'; | |
| 22 | |||
| 23 | sub _api_uri { | ||
| 24 | 0 | ▶ | my ($self) = @_; |
|
Subroutine
_api_uri: not called CC=1 SCAR=6.9
| |||
| 25 | |||
| 26 | 0 | return $api_uri; | |
| 27 | } | ||
| 28 | |||
| 29 | =head1 SYNOPSIS | ||
| 30 | |||
| 31 | Wargaming.net Public API is a set of API methods that provide access to Wargaming.net content, including in-game and game-related content, as well as player statistics. | ||
| 32 | |||
| 33 | This module provide access to WG Public API | ||
| 34 | |||
| 35 | use WG::API; | ||
| 36 | |||
| 37 | my $net = WG::API->new( application_id => 'demo' )->net(); | ||
| 38 | ... | ||
| 39 | my $player = $net->account_info( account_id => '1' ); | ||
| 40 | |||
| 41 | |||
| 42 | |||
| 43 | =head1 CONSTRUCTOR | ||
| 44 | |||
| 45 | =head2 new | ||
| 46 | |||
| 47 | Create new object with params. Rerquired application id: L<https://developers.wargaming.net/documentation/guide/getting-started/> | ||
| 48 | |||
| 49 | Params: | ||
| 50 | |||
| 51 | - application_id * | ||
| 52 | - languare | ||
| 53 | |||
| 54 | =head1 METHODS | ||
| 55 | |||
| 56 | =head2 Accounts | ||
| 57 | |||
| 58 | =over 1 | ||
| 59 | |||
| 60 | =item B<accounts_list> | ||
| 61 | |||
| 62 | Method returns partial list of players. The list is filtered by initial characters of user name and sorted alphabetically. | ||
| 63 | |||
| 64 | =over 2 | ||
| 65 | |||
| 66 | =item I<required fields:> | ||
| 67 | |||
| 68 | search - Player name search string. Parameter "type" defines minimum length and type of search. Using the exact search type, you can enter several names, separated with commas. Maximum length: 24. | ||
| 69 | |||
| 70 | =back | ||
| 71 | |||
| 72 | =cut | ||
| 73 | |||
| 74 | sub accounts_list { | ||
| 75 | 0 | ▶ | return shift->_request( 'get', 'wgn/account/list/', [ 'fields', 'game', 'type', 'search', 'limit', 'language' ], ['search'], @_ ); |
|
Subroutine
accounts_list: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 76 | } | ||
| 77 | |||
| 78 | =item B<account_info> | ||
| 79 | |||
| 80 | Method returns Wargaming account details. | ||
| 81 | |||
| 82 | =over 2 | ||
| 83 | |||
| 84 | =item I<required fields:> | ||
| 85 | |||
| 86 | account_id - Account ID. Max limit is 100. Min value is 1. | ||
| 87 | |||
| 88 | =back | ||
| 89 | |||
| 90 | =back | ||
| 91 | |||
| 92 | =cut | ||
| 93 | |||
| 94 | sub account_info { | ||
| 95 | return shift->_request( | ||
| 96 | 0 | ▶ | 'get', 'wgn/account/info/', [ 'fields', 'access_token', 'account_id', 'language' ], ['account_id'], |
|
Subroutine
account_info: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 97 | @_ | ||
| 98 | ); | ||
| 99 | } | ||
| 100 | |||
| 101 | =head2 Clans | ||
| 102 | |||
| 103 | =over 1 | ||
| 104 | |||
| 105 | =item B<clans_list> | ||
| 106 | |||
| 107 | DEPRECATED: Method searches through clans and sorts them in a specified order. | ||
| 108 | |||
| 109 | =cut | ||
| 110 | |||
| 111 | sub clans_list { | ||
| 112 | 0 | ▶ | cluck "DEPRECATED!"; |
|
Subroutine
clans_list: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 113 | return shift->_request( | ||
| 114 | 0 | 'get', 'wgn/clans/list/', | |
| 115 | [ 'language', 'fields', 'search', 'limit', 'page_no', 'game' ], | ||
| 116 | undef, @_ | ||
| 117 | ); | ||
| 118 | } | ||
| 119 | |||
| 120 | =item B<clans> | ||
| 121 | |||
| 122 | Method searches through clans and sorts them in a specified order. | ||
| 123 | |||
| 124 | =cut | ||
| 125 | |||
| 126 | sub clans { | ||
| 127 | return shift->_request( | ||
| 128 | 0 | ▶ | 'get', 'wgn/clans/list/', |
|
Subroutine
clans: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 129 | [ 'language', 'fields', 'search', 'limit', 'page_no', 'game' ], | ||
| 130 | undef, @_ | ||
| 131 | ); | ||
| 132 | } | ||
| 133 | |||
| 134 | =item B<clans_info> | ||
| 135 | |||
| 136 | Method returns detailed clan information. | ||
| 137 | |||
| 138 | =over 2 | ||
| 139 | |||
| 140 | =item I<required fields:> | ||
| 141 | |||
| 142 | clan_id - Clan ID. Max limit is 100. | ||
| 143 | |||
| 144 | =back | ||
| 145 | |||
| 146 | =cut | ||
| 147 | |||
| 148 | sub clans_info { | ||
| 149 | 0 | ▶ | return shift->_request( 'get', 'wgn/clans/info/', [ 'language', 'fields', 'access_token', 'clan_id', 'extra', 'game', 'members_key' ], ['clan_id'], @_ ); |
|
Subroutine
clans_info: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 150 | } | ||
| 151 | |||
| 152 | =item B<clans_membersinfo> | ||
| 153 | |||
| 154 | Method returns clan member info and short info on the clan. Information is available for World of Tanks and World of Warplanes clans. | ||
| 155 | |||
| 156 | =over 2 | ||
| 157 | |||
| 158 | =item I<required fields:> | ||
| 159 | |||
| 160 | account_id - Account ID. Max limit is 100. Min value is 1. | ||
| 161 | |||
| 162 | =back | ||
| 163 | |||
| 164 | =cut | ||
| 165 | |||
| 166 | sub clans_membersinfo { | ||
| 167 | 0 | ▶ | return shift->_request( 'get', 'wgn/clans/membersinfo/', [ 'language', 'fields', 'account_id', 'game' ], ['account_id'], @_ ); |
|
Subroutine
clans_membersinfo: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 168 | } | ||
| 169 | |||
| 170 | =item B<clans_glossary> | ||
| 171 | |||
| 172 | Method returns information on clan entities in World of Tanks and World of Warplanes. | ||
| 173 | |||
| 174 | =cut | ||
| 175 | |||
| 176 | sub clans_glossary { | ||
| 177 | 0 | ▶ | return shift->_request( 'get', 'wgn/clans/glossary/', [ 'language', 'fields', 'game' ], undef, @_ ); |
|
Subroutine
clans_glossary: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 178 | } | ||
| 179 | |||
| 180 | =item B<clans_messageboard> | ||
| 181 | |||
| 182 | Method returns messages of clan message board. | ||
| 183 | |||
| 184 | =over 2 | ||
| 185 | |||
| 186 | =item I<required fields:> | ||
| 187 | |||
| 188 | access_token - Access token for the private data of a user's account; can be received via the authorization method; valid within a stated time period | ||
| 189 | |||
| 190 | =back | ||
| 191 | |||
| 192 | =cut | ||
| 193 | |||
| 194 | sub clans_messageboard { | ||
| 195 | return shift->_request( | ||
| 196 | 0 | ▶ | 'get', 'wgn/clans/mesageboard/', [ 'game', 'fields', 'access_token' ], ['access_token'], |
|
Subroutine
clans_messageboard: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 197 | @_ | ||
| 198 | ); | ||
| 199 | } | ||
| 200 | |||
| 201 | =item B<clans_memberhistory> | ||
| 202 | |||
| 203 | Method returns information about player's clan history. Data on 10 last clan memberships are presented in the response. | ||
| 204 | |||
| 205 | =over 2 | ||
| 206 | |||
| 207 | =item I<required fields:> | ||
| 208 | |||
| 209 | account_id - Account ID. Max limit is 100. Min value is 1. | ||
| 210 | |||
| 211 | =back | ||
| 212 | |||
| 213 | =back | ||
| 214 | |||
| 215 | =cut | ||
| 216 | |||
| 217 | sub clans_memberhistory { | ||
| 218 | return shift->_request( | ||
| 219 | 0 | ▶ | 'get', 'wgn/clans/memberhistory/', [ 'game', 'fields', 'account_id', 'language' ], ['account_id'], |
|
Subroutine
clans_memberhistory: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 220 | @_ | ||
| 221 | ); | ||
| 222 | } | ||
| 223 | |||
| 224 | =head2 Servers | ||
| 225 | |||
| 226 | =over 1 | ||
| 227 | |||
| 228 | =item B<servers_info> | ||
| 229 | |||
| 230 | Method returns the number of online players on the servers. | ||
| 231 | |||
| 232 | =back | ||
| 233 | |||
| 234 | =cut | ||
| 235 | |||
| 236 | sub servers_info { | ||
| 237 | 0 | ▶ | return shift->_request( 'get', 'wgn/servers/info/', [ 'language', 'fields', 'game' ], undef, @_ ); |
|
Subroutine
servers_info: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 238 | } | ||
| 239 | |||
| 240 | =head1 BUGS | ||
| 241 | |||
| 242 | Please report any bugs or feature requests to C<cynovg at cpan.org>, or through the web interface at L<https://gitlab.com/cynovg/WG-API/issues>. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. | ||
| 243 | |||
| 244 | =head1 SUPPORT | ||
| 245 | |||
| 246 | You can find documentation for this module with the perldoc command. | ||
| 247 | |||
| 248 | perldoc WG::API | ||
| 249 | |||
| 250 | You can also look for information at: | ||
| 251 | |||
| 252 | =over 4 | ||
| 253 | |||
| 254 | =item * RT: Gitlab's request tracker (report bugs here) | ||
| 255 | |||
| 256 | L<https://gitlab.com/cynovg/WG-API/issues> | ||
| 257 | |||
| 258 | =item * AnnoCPAN: Annotated CPAN documentation | ||
| 259 | |||
| 260 | L<http://annocpan.org/dist/WG-API> | ||
| 261 | |||
| 262 | =item * CPAN Ratings | ||
| 263 | |||
| 264 | L<http://cpanratings.perl.org/d/WG-API> | ||
| 265 | |||
| 266 | =item * Search CPAN | ||
| 267 | |||
| 268 | L<https://metacpan.org/pod/WG::API> | ||
| 269 | |||
| 270 | =back | ||
| 271 | |||
| 272 | |||
| 273 | =head1 ACKNOWLEDGEMENTS | ||
| 274 | |||
| 275 | ... | ||
| 276 | |||
| 277 | =head1 SEE ALSO | ||
| 278 | |||
| 279 | WG API Reference L<https://developers.wargaming.net/> | ||
| 280 | |||
| 281 | =head1 AUTHOR | ||
| 282 | |||
| 283 | Cyrill Novgorodcev , C<< <cynovg at cpan.org> >> | ||
| 284 | |||
| 285 | =head1 LICENSE AND COPYRIGHT | ||
| 286 | |||
| 287 | Copyright 2015 Cyrill Novgorodcev. | ||
| 288 | |||
| 289 | This program is free software; you can redistribute it and/or modify it | ||
| 290 | under the terms of the the Artistic License (2.0). You may obtain a | ||
| 291 | copy of the full license at: | ||
| 292 | |||
| 293 | L<http://www.perlfoundation.org/artistic_license_2_0> | ||
| 294 | |||
| 295 | Any use, modification, and distribution of the Standard or Modified | ||
| 296 | Versions is governed by this Artistic License. By using, modifying or | ||
| 297 | distributing the Package, you accept this license. Do not use, modify, | ||
| 298 | or distribute the Package, if you do not accept this license. | ||
| 299 | |||
| 300 | If your Modified Version has been derived from a Modified Version made | ||
| 301 | by someone other than you, you are nevertheless required to ensure that | ||
| 302 | your Modified Version complies with the requirements of this license. | ||
| 303 | |||
| 304 | This license does not grant you the right to use any trademark, service | ||
| 305 | mark, tradename, or logo of the Copyright Holder. | ||
| 306 | |||
| 307 | This license includes the non-exclusive, worldwide, free-of-charge | ||
| 308 | patent license to make, have made, use, offer to sell, sell, import and | ||
| 309 | otherwise transfer the Package with respect to any patent claims | ||
| 310 | licensable by the Copyright Holder that are necessarily infringed by the | ||
| 311 | Package. If you institute patent litigation (including a cross-claim or | ||
| 312 | counterclaim) against any party alleging that the Package constitutes | ||
| 313 | direct or contributory patent infringement, then this Artistic License | ||
| 314 | to you shall terminate on the date that such litigation is filed. | ||
| 315 | |||
| 316 | Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER | ||
| 317 | AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. | ||
| 318 | THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR | ||
| 319 | PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY | ||
| 320 | YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR | ||
| 321 | CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR | ||
| 322 | CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, | ||
| 323 | EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 324 | |||
| 325 | |||
| 326 | =cut | ||
| 327 | |||
| 328 | 2 | 1; # End of WG::API::NET | |
| 329 | |||